importer.js 747 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933
  1. var __extends = (this && this.__extends) || function (d, b) {
  2. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  3. function __() { this.constructor = d; }
  4. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5. };
  6. /* Generated from Java with JSweet 2.0.0-rc1 - http://www.jsweet.org */
  7. var com;
  8. (function (com) {
  9. var mxgraph;
  10. (function (mxgraph) {
  11. var io;
  12. (function (io) {
  13. /**
  14. * Parses a .vsdx XML diagram file and imports it in the given graph.<br/>
  15. * @class
  16. */
  17. var mxVsdxCodec = (function () {
  18. function mxVsdxCodec(editorUi) {
  19. this.RESPONSE_END = "</mxfile>";
  20. this.RESPONSE_DIAGRAM_START = "";
  21. this.RESPONSE_DIAGRAM_END = "</diagram>";
  22. this.RESPONSE_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><mxfile>";
  23. /**
  24. * Stores the vertexes imported.
  25. */
  26. this.vertexMap = ({});
  27. /**
  28. * Stores the shapes that represent Edges.
  29. */
  30. this.edgeShapeMap = ({});
  31. /**
  32. * Stores the shapes that represent Vertexes.
  33. */
  34. this.vertexShapeMap = ({});
  35. /**
  36. * Stores the parents of the shapes imported.
  37. */
  38. this.parentsMap = ({});
  39. this.layerNames = [];
  40. /**
  41. * Set to true if you want to display spline debug data
  42. */
  43. this.debugPaths = false;
  44. this.vsdxModel = null;
  45. this.editorUi = editorUi;
  46. this.shapeIndexShift = 0;
  47. }
  48. mxVsdxCodec.vsdxPlaceholder_$LI$ = function ()
  49. {
  50. if (mxVsdxCodec.vsdxPlaceholder == null)
  51. {
  52. var tmp = "dmlzaW8=";
  53. mxVsdxCodec.vsdxPlaceholder = (window.atob) ? atob(tmp) : Base64.decode(tmp, true);
  54. }
  55. return mxVsdxCodec.vsdxPlaceholder;
  56. };
  57. mxVsdxCodec.parsererrorNS_$LI$ = function ()
  58. {
  59. mxVsdxCodec.parsererrorNS = mxConstants.NS_XHTML;
  60. // if (mxVsdxCodec.parsererrorNS == null)
  61. // {
  62. // mxVsdxCodec.parsererrorNS = "";
  63. //
  64. // if (window.DOMParser)
  65. // {
  66. // var parser = new DOMParser();
  67. //
  68. // try
  69. // {
  70. // mxVsdxCodec.parsererrorNS = parser.parseFromString('<', 'text/xml').getElementsByTagName("parsererror")[0].namespaceURI;
  71. // }
  72. // catch(e)
  73. // {
  74. // //ignore! IE11 throw an exception on XML syntax error
  75. // }
  76. // }
  77. // }
  78. return mxVsdxCodec.parsererrorNS;
  79. };
  80. mxVsdxCodec.parseXml = function (xml)
  81. {
  82. try
  83. {
  84. var doc = mxUtils.parseXml(xml);
  85. if (doc.getElementsByTagNameNS(mxVsdxCodec.parsererrorNS, 'parsererror').length > 0)
  86. {
  87. return null;
  88. }
  89. else
  90. {
  91. return doc;
  92. }
  93. }
  94. catch (e)
  95. {
  96. //IE11 throw an exception on XML syntax error
  97. return null;
  98. }
  99. };
  100. //TODO Optimize this function
  101. mxVsdxCodec.decodeUTF16LE = function ( binaryStr )
  102. {
  103. var cp = "";
  104. for( var i = 0; i < binaryStr.length; i+=2)
  105. {
  106. cp += String.fromCharCode(
  107. binaryStr.charCodeAt(i) |
  108. ( binaryStr.charCodeAt(i+1) << 8 )
  109. );
  110. }
  111. return cp ;
  112. }
  113. mxVsdxCodec.prototype.scaleGraph = function(graph, scale)
  114. {
  115. if (scale !== 1) {
  116. var model = graph.getModel();
  117. {
  118. for (var id in model.cells) {
  119. var c = model.cells[id];
  120. {
  121. var geo = model.getGeometry(c);
  122. if (geo != null) {
  123. this.scaleRect(geo, scale);
  124. this.scaleRect(geo.alternateBounds, scale);
  125. if (model.isEdge(c)) {
  126. this.scalePoint(geo.sourcePoint, scale);
  127. this.scalePoint(geo.targetPoint, scale);
  128. this.scalePoint(geo.offset, scale);
  129. var points = geo.points;
  130. if (points != null) {
  131. for (var index125 = 0; index125 < points.length; index125++) {
  132. var p = points[index125];
  133. {
  134. this.scalePoint(p, scale);
  135. }
  136. }
  137. }
  138. }
  139. }
  140. }
  141. }
  142. }
  143. }
  144. };
  145. mxVsdxCodec.incorrectXMLReqExp = [
  146. {
  147. regExp: /\&(?!amp;|lt;|gt;|quot;|#)/g,
  148. repl: '&amp;'
  149. }
  150. ];
  151. /**
  152. * Parses the input VSDX format and uses the information to populate
  153. * the specified graph.
  154. * @param docs All XML documents contained in the VSDX source file
  155. * @throws IOException
  156. * @throws ParserConfigurationException
  157. * @throws SAXException
  158. * @throws TransformerException
  159. * @param {Array} data
  160. * @param {string} charset
  161. * @return {string}
  162. */
  163. //FIXME TODO add charset support
  164. mxVsdxCodec.prototype.decodeVsdx = function (file, callback, charset, onerror) {
  165. var _this = this;
  166. var docData = ({});
  167. var mediaData = ({});
  168. var allDone = function ()
  169. {
  170. var path = mxVsdxCodec.vsdxPlaceholder + "/document.xml";
  171. var rootDoc = (function (m, k) { return m[k] ? m[k] : null; })(docData, path);
  172. var rootChild = rootDoc.firstChild;
  173. while (rootChild != null && !(rootChild.nodeType == 1)) {
  174. rootChild = rootChild.nextSibling;
  175. }
  176. ;
  177. if (rootChild != null && (rootChild.nodeType == 1)) {
  178. _this.importNodes(rootDoc, rootChild, path, docData);
  179. }
  180. else {
  181. return null;
  182. }
  183. _this.vsdxModel = new com.mxgraph.io.vsdx.mxVsdxModel(rootDoc, docData, mediaData);
  184. var pages = _this.vsdxModel.getPages();
  185. var xmlBuilder = { str: _this.RESPONSE_HEADER, toString: function () { return this.str; } };
  186. {
  187. var array122 = (function (m) { if (m.entries == null)
  188. m.entries = []; return m.entries; })(pages);
  189. var _loop_1 = function (index121, remaining) {
  190. var entry = array122[index121];
  191. {
  192. var page_1 = entry.getValue();
  193. //As per many requests, include all pages in the output
  194. //if (!page_1.isBackground())
  195. {
  196. var graph_1 = this_1.createMxGraph();
  197. graph_1.getModel().beginUpdate();
  198. this_1.importPage(page_1, graph_1, graph_1.getDefaultParent(), true);
  199. this_1.scaleGraph(graph_1, page_1.getPageScale() / page_1.getDrawingScale());
  200. graph_1.getModel().endUpdate();
  201. this_1.postImportPage(page_1, graph_1, function()
  202. {
  203. this_1.sanitiseGraph(graph_1);
  204. /* append */ (function (sb) { return sb.str = sb.str.concat(_this.RESPONSE_DIAGRAM_START); })(xmlBuilder);
  205. /* append */ (function (sb) { return sb.str = sb.str.concat(_this.processPage(graph_1, page_1)); })(xmlBuilder);
  206. /* append */ (function (sb) { return sb.str = sb.str.concat(_this.RESPONSE_DIAGRAM_END); })(xmlBuilder);
  207. if (index121 < array122.length - 1)
  208. {
  209. _loop_1(index121 + 1, remaining);
  210. }
  211. else
  212. {
  213. remaining();
  214. }
  215. });
  216. }
  217. }
  218. };
  219. var this_1 = _this;
  220. if (array122.length > 0)
  221. {
  222. _loop_1(0, remaining);
  223. }
  224. else
  225. {
  226. remaining();
  227. }
  228. }
  229. function remaining()
  230. {
  231. /* append */ (function (sb) { return sb.str = sb.str.concat(_this.RESPONSE_END); })(xmlBuilder);
  232. var dateAfter = new Date();
  233. //console.log("File processed in " + (dateAfter - dateBefore) + "ms");
  234. //console.log(xmlBuilder.str);
  235. if (callback)
  236. {
  237. callback(xmlBuilder.str);
  238. }
  239. }
  240. };
  241. var dateBefore = new Date();
  242. var filesCount = 0;
  243. var processedFiles = 0;
  244. var doneCheck = function()
  245. {
  246. if (processedFiles == filesCount)
  247. {
  248. var dateAfter = new Date();
  249. //console.log(processedFiles + " File extracted in " + (dateAfter - dateBefore) + "ms");
  250. try
  251. {
  252. allDone();
  253. }
  254. catch(e)
  255. {
  256. console.log(e);
  257. if (onerror != null)
  258. {
  259. onerror(e);
  260. }
  261. else
  262. {
  263. callback("");
  264. }
  265. }
  266. }
  267. };
  268. var emfChunkSize = window.EMF_CHUNK_SIZE || 10;
  269. function handleEmfEntriesPartition(emfEntries, index, mediaData)
  270. {
  271. var limit = Math.min(index + emfChunkSize, emfEntries.length);
  272. function done()
  273. {
  274. processedFiles++;
  275. doneCheck();
  276. index++;
  277. if (index == limit)
  278. {
  279. handleEmfEntriesPartition(emfEntries, index, mediaData);
  280. }
  281. }
  282. for (var i = index; i < limit; i++)
  283. {
  284. (function (zipEntry)
  285. {
  286. var retries = 0;
  287. function convertEmf(emfBlob)
  288. {
  289. //send to emf conversion service
  290. var formData = new FormData();
  291. formData.append('img', emfBlob, zipEntry.name);
  292. formData.append('inputformat', 'emf');
  293. formData.append('outputformat', 'png');
  294. var xhr = new XMLHttpRequest();
  295. xhr.open('POST', EMF_CONVERT_URL);
  296. xhr.responseType = 'blob';
  297. _this.editorUi.addRemoteServiceSecurityCheck(xhr);
  298. xhr.onreadystatechange = mxUtils.bind(this, function()
  299. {
  300. if (xhr.readyState == 4)
  301. {
  302. if (xhr.status >= 200 && xhr.status <= 299)
  303. {
  304. try
  305. {
  306. var reader = new FileReader();
  307. reader.readAsDataURL(xhr.response);
  308. reader.onloadend = function()
  309. {
  310. var dataPos = reader.result.indexOf(',') + 1;
  311. mediaData[zipEntry.name] = reader.result.substr(dataPos);
  312. done();
  313. }
  314. }
  315. catch (e)
  316. {
  317. console.log(e);
  318. done();
  319. }
  320. }
  321. else
  322. {
  323. retries++;
  324. if (retries < 3)
  325. {
  326. convertEmf(emfBlob);
  327. }
  328. else
  329. {
  330. done();
  331. }
  332. }
  333. }
  334. });
  335. xhr.send(formData);
  336. };
  337. zipEntry.async("blob").then(convertEmf);
  338. })(emfEntries[i]);
  339. }
  340. };
  341. JSZip.loadAsync(file)
  342. .then(function(zip)
  343. {
  344. if (Object.keys(zip.files).length == 0)
  345. {
  346. if (onerror != null)
  347. {
  348. onerror();
  349. }
  350. }
  351. else
  352. {
  353. var dateAfter = new Date();
  354. //console.log(" (loaded in " + (dateAfter - dateBefore) + "ms)");
  355. var emfEntries = [];
  356. zip.forEach(function (relativePath, zipEntry)
  357. {
  358. var filename = zipEntry.name;
  359. var name = filename.toLowerCase();
  360. var nameLen = name.length;
  361. if (name.indexOf('.xml') == nameLen - 4 || name.indexOf('.rels') == nameLen - 5) //xml files
  362. {
  363. filesCount++;
  364. zipEntry.async("string").then(function (str)
  365. {
  366. if (!(str.length === 0)) {
  367. //UTF-8 BOM causes exception while parsing, so remove it
  368. //TODO is the text encoding will be correct or string must be re-read as UTF-8?
  369. if (str.charCodeAt(0) == 65279)
  370. {
  371. str = str.substring(1);
  372. }
  373. var doc = mxVsdxCodec.parseXml(str);
  374. if (doc == null)
  375. {
  376. if (str.charCodeAt(1) === 0 && str.charCodeAt(3) === 0 && str.charCodeAt(5) === 0)
  377. {
  378. doc = mxVsdxCodec.parseXml(mxVsdxCodec.decodeUTF16LE(str));
  379. }
  380. else
  381. {
  382. for (var r = 0; r < mxVsdxCodec.incorrectXMLReqExp.length; r++)
  383. {
  384. if (mxVsdxCodec.incorrectXMLReqExp[r].regExp.test(str))
  385. {
  386. str = str.replace(mxVsdxCodec.incorrectXMLReqExp[r].regExp, mxVsdxCodec.incorrectXMLReqExp[r].repl);
  387. }
  388. }
  389. doc = mxVsdxCodec.parseXml(str);
  390. }
  391. //TODO add any other non-standard encoding that may be needed
  392. }
  393. if (doc != null)
  394. {
  395. doc.vsdxFileName = filename;
  396. /* put */ (docData[filename] = doc);
  397. }
  398. }
  399. processedFiles++;
  400. doneCheck();
  401. });
  402. }
  403. else if (name.indexOf(mxVsdxCodec.vsdxPlaceholder + "/media") === 0)//binary files
  404. {
  405. filesCount++;
  406. if ((function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(name, ".emf"))
  407. {
  408. if (JSZip.support.blob && window.EMF_CONVERT_URL)
  409. {
  410. emfEntries.push(zipEntry);
  411. }
  412. else
  413. {
  414. processedFiles++;
  415. doneCheck();
  416. }
  417. }
  418. else if ((function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(name, ".bmp")) {
  419. if (JSZip.support.uint8array)
  420. {
  421. zipEntry.async("uint8array").then(function (bmpData)
  422. {
  423. var bitmap = new BmpDecoder(bmpData);
  424. var c = document.createElement("canvas");
  425. c.width = bitmap.width;
  426. c.height = bitmap.height;
  427. var ctx = c.getContext("2d");
  428. ctx.putImageData(bitmap.imageData, 0, 0);
  429. var jpgData = c.toDataURL("image/jpeg");
  430. /* put */ (mediaData[filename] = jpgData.substr(23)); //23 is the length of "data:image/jpeg;base64,"
  431. processedFiles++;
  432. doneCheck();
  433. });
  434. }
  435. }
  436. else
  437. {
  438. zipEntry.async("base64").then(function (base64Str)
  439. {
  440. // if ((function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(name, ".bmp")) {
  441. // try
  442. // {
  443. // //convert BMP files to PNG
  444. // var bmpImg = new Image();
  445. //
  446. // bmpImg.onload = function() {
  447. // var c = document.createElement("canvas");
  448. // c.width = bmpImg.width;
  449. // c.height = bmpImg.height;
  450. // var ctx = c.getContext("2d");
  451. // ctx.drawImage(bmpImg, 0, 0);
  452. // var jpgData = c.toDataURL("image/jpeg");
  453. //
  454. // /* put */ (mediaData[filename] = jpgData.substr(23)); //23 is the length of "data:image/jpeg;base64,"
  455. //
  456. // processedFiles++;
  457. // doneCheck();
  458. // };
  459. //
  460. // bmpImg.src = "data:image/bmp;base64," + base64Str;
  461. // }
  462. // catch (e) {} //conversion failed. Nothing can be done!
  463. // }
  464. // else
  465. // {
  466. /* put */ (mediaData[filename] = base64Str);
  467. processedFiles++;
  468. doneCheck();
  469. // }
  470. });
  471. }
  472. }
  473. });
  474. handleEmfEntriesPartition(emfEntries, 0, mediaData);
  475. }
  476. }, function (e) {
  477. //console.log("Error!" + e.message);
  478. if (onerror != null)
  479. {
  480. onerror(e);
  481. }
  482. });
  483. };
  484. mxVsdxCodec.prototype.createMxGraph = function () {
  485. var graph = new Graph();
  486. graph.setExtendParents(false);
  487. graph.setExtendParentsOnAdd(false);
  488. graph.setConstrainChildren(false);
  489. graph.setHtmlLabels(true);
  490. graph.getModel().maintainEdgeParent = false;
  491. return graph;
  492. };
  493. mxVsdxCodec.prototype.processPage = function (graph, page) {
  494. var codec = new mxCodec();
  495. var node = codec.encode(graph.getModel());
  496. node.setAttribute("style", "default-style2");
  497. var modelString = mxUtils.getXml(node);
  498. var output = "";
  499. if (page != null) {
  500. //var pageName_1 = org.apache.commons.lang3.StringEscapeUtils.escapeXml11(page.getPageName());
  501. //TODO FIXME htmlEntities is not exactly as escapeXml11 but close
  502. var pageName_1 = mxUtils.htmlEntities(page.getPageName()) + (page.isBackground()? ' (Background)' : '');
  503. var pageNameU = mxUtils.htmlEntities(page.getPageNameU());
  504. output += '<diagram name="' + pageName_1 + '" id="' + pageNameU.replace(/\s/g, '_') + '">';
  505. }
  506. output += Graph.compress(modelString);
  507. return output;
  508. };
  509. /**
  510. * Scale a point in place
  511. *
  512. * @param {mxPoint} p point to scale in place
  513. * @param {number} scale scale
  514. * @return {mxPoint} scaled point
  515. * @private
  516. */
  517. /*private*/ mxVsdxCodec.prototype.scalePoint = function (p, scale) {
  518. if (p != null) {
  519. p.x = (p.x * scale);
  520. p.y = (p.y * scale);
  521. }
  522. return p;
  523. };
  524. /**
  525. * Scale a rectangle in place
  526. *
  527. * @param {mxRectangle} rect rectangle to scale in place
  528. * @param {number} scale scale
  529. * @return {mxRectangle} scaled rectangle
  530. * @private
  531. */
  532. /*private*/ mxVsdxCodec.prototype.scaleRect = function (rect, scale) {
  533. if (rect != null) {
  534. rect.x = (rect.x * scale);
  535. rect.y = (rect.y * scale);
  536. rect.height = (rect.height * scale);
  537. rect.width = (rect.width * scale);
  538. }
  539. return rect;
  540. };
  541. /**
  542. *
  543. * @param {*} rootDoc
  544. * @param {*} currentNode
  545. * @param {string} path
  546. * @param {*} docData
  547. * @private
  548. */
  549. /*private*/ mxVsdxCodec.prototype.importNodes = function (rootDoc, currentNode, path, docData) {
  550. var lastSlash = path.lastIndexOf("/");
  551. var dir = path;
  552. var fileName = path;
  553. if (lastSlash !== -1) {
  554. dir = path.substring(0, lastSlash);
  555. fileName = path.substring(lastSlash + 1, path.length);
  556. }
  557. else {
  558. return;
  559. }
  560. var relsPath = dir + "/_rels/" + fileName + ".rels";
  561. var relsDoc = (function (m, k) { return m[k] ? m[k] : null; })(docData, relsPath);
  562. if (relsDoc == null) {
  563. return;
  564. }
  565. var rels = relsDoc.getElementsByTagName("Relationship");
  566. var relMap = ({});
  567. for (var i = 0; i < rels.length; i++) {
  568. var currElem = rels.item(i);
  569. var id = currElem.getAttribute("Id");
  570. var target = currElem.getAttribute("Target");
  571. /* put */ (relMap[id] = target);
  572. }
  573. ;
  574. var relList = currentNode.getElementsByTagName("Rel");
  575. for (var i = 0; i < relList.length; i++) {
  576. var rel = relList.item(i);
  577. var pathSuffix = (function (m, k) { return m[k] ? m[k] : null; })(relMap, rel.getAttribute("r:id"));
  578. var target = dir + "/" + pathSuffix;
  579. if (target != null) {
  580. var childDoc = (function (m, k) { return m[k] ? m[k] : null; })(docData, target);
  581. if (childDoc != null) {
  582. var parent_1 = rel.parentNode;
  583. var rootChild = childDoc.firstChild;
  584. while (rootChild != null && !(rootChild.nodeType == 1)) {
  585. rootChild = rootChild.nextSibling;
  586. }
  587. ;
  588. if (rootChild != null && (rootChild.nodeType == 1)) {
  589. var importNode = rootChild.firstChild;
  590. while ((importNode != null)) {
  591. if (importNode != null && importNode.nodeType == 1) {
  592. var newNode = parent_1.appendChild(rootDoc.importNode(importNode, true));
  593. var pathTmp = target;
  594. this.importNodes(rootDoc, newNode, pathTmp, docData);
  595. }
  596. importNode = importNode.nextSibling;
  597. }
  598. ;
  599. }
  600. }
  601. }
  602. }
  603. ;
  604. };
  605. mxVsdxCodec.prototype.layerIndexToNames = function (indexes)
  606. {
  607. var names = [];
  608. if (indexes)
  609. {
  610. for (var i = 0; i < indexes.length; i++)
  611. {
  612. var layer = parseInt(indexes[i]);
  613. if (layer < this.layerNames.length)
  614. {
  615. names.push(this.layerNames[layer]);
  616. }
  617. }
  618. }
  619. return names.length > 0? names : [mxResources.get('background')]; // Add all non-layer members to Background tag
  620. };
  621. /**
  622. * Imports a page of the document with the actual pageHeight.<br/>
  623. * In .vdx, the Y-coordinate grows upward from the bottom of the page.<br/>
  624. * The page height is used for calculating the correct position in mxGraph using
  625. * this formula: mxGraph_Y_Coord = PageHeight - VSDX_Y_Coord.
  626. * @param {com.mxgraph.io.vsdx.mxVsdxPage} page Actual page Element to be imported
  627. * @param {mxGraph} graph Graph where the parsed graph is included.
  628. * @param {*} parent The parent of the elements to be imported.
  629. * @return {number}
  630. */
  631. mxVsdxCodec.prototype.importPage = function (page, graph, parent, noSanitize)
  632. {
  633. //BackPages can include another backPage, so it is recursive
  634. var backPage = page.getBackPage();
  635. if (backPage != null)
  636. {
  637. graph.getModel().setValue(graph.getDefaultParent(), page.getPageName());
  638. var backCell = new mxCell(backPage.getPageName());
  639. graph.addCell(backCell, graph.getModel().getRoot(), 0, null, null);
  640. this.importPage(backPage, graph, graph.getDefaultParent());
  641. }
  642. //TODO KNOWN ISSUE: VSDX layers are virtual grouping where parts of a group can be members of a layers while the remaining group members belong to another layer
  643. // This cannot be done in draw.io currently
  644. // Also, layers should NOT affect cells order. So, as a best effort solution, layers should be orders such that the cells order is maintained
  645. //add page layers
  646. var layers = page.getLayers();
  647. var shapes = page.getShapes();
  648. var hiddenTags = [];
  649. //console.log('layers', layers);
  650. for (var k = 0; k < layers.length; k++)
  651. {
  652. var layer = layers[k];
  653. // Tags cannot have spaces
  654. var layerName = layer.Name.replace(/\s/g, '_');
  655. this.layerNames.push(layerName);
  656. if (layer.Visible == 0)
  657. {
  658. hiddenTags.push(layerName);
  659. }
  660. // Lock is not supported for tags
  661. if (layer.Lock == 1)
  662. {
  663. //layerCell.setStyle("locked=1;");
  664. }
  665. }
  666. //add shapes
  667. var entries = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* entrySet */ (function (m) { if (m.entries == null)
  668. m.entries = []; return m.entries; })(shapes));
  669. var pageHeight = page.getPageDimensions().y;
  670. var pageId = page.getId();
  671. while ((entries.hasNext()))
  672. {
  673. var entry = entries.next();
  674. var shape = entry.getValue();
  675. var newCell = this.addShape(graph, shape, parent, pageId, pageHeight);
  676. // Map layers to draw.io tags which allows muliple layers(tags) per cell
  677. var layers = this.layerIndexToNames(shape.layerMember);
  678. // Edges are not available here yet
  679. if (newCell != null && layers != null)
  680. {
  681. graph.addTagsForCells([newCell], layers);
  682. }
  683. };
  684. var connects = page.getConnects();
  685. var entries2 = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* entrySet */ (function (m) { if (m.entries == null)
  686. m.entries = []; return m.entries; })(connects));
  687. while ((entries2.hasNext())) {
  688. var entry = entries2.next();
  689. var edgeId = this.addConnectedEdge(graph, entry.getValue(), pageId, pageHeight);
  690. if (edgeId != null) {
  691. /* remove */ (function (m, k) { if (m.entries == null)
  692. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  693. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  694. return m.entries.splice(i, 1)[0];
  695. } })(this.edgeShapeMap, edgeId);
  696. }
  697. }
  698. ;
  699. var it = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* entrySet */ (function (m) { if (m.entries == null)
  700. m.entries = []; return m.entries; })(this.edgeShapeMap));
  701. while ((it.hasNext())) {
  702. var edgeShapeEntry = it.next();
  703. if (edgeShapeEntry.getKey().getPageNumber() === pageId) {
  704. var edge = this.addUnconnectedEdge(graph, /* get */ (function (m, k) { if (m.entries == null)
  705. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  706. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  707. return m.entries[i].value;
  708. } return null; })(this.parentsMap, edgeShapeEntry.getKey()), edgeShapeEntry.getValue(), pageHeight);
  709. var layers = this.layerIndexToNames(edgeShapeEntry.getValue().layerMember);
  710. if (layers != null)
  711. {
  712. graph.addTagsForCells([edge], layers);
  713. }
  714. }
  715. };
  716. // Now after all used tags are found, add remaining ones and set visibility
  717. if (this.layerNames.length > 0)
  718. {
  719. var tags = graph.getAllTags();
  720. var emptyTags = false;
  721. for (var i = 0; i < this.layerNames.length; i++)
  722. {
  723. if (mxUtils.indexOf(tags, this.layerNames[i]) < 0)
  724. {
  725. emptyTags = true;
  726. break;
  727. }
  728. }
  729. // Cannot add tags without cells. Add a dummy cell
  730. if (emptyTags)
  731. {
  732. var dummyCell = graph.insertVertex(parent, null, null, 0, 0, 0, 0);
  733. graph.addTagsForCells([dummyCell], this.layerNames);
  734. dummyCell.setVisible(false);
  735. }
  736. graph.setHiddenTags(hiddenTags);
  737. }
  738. if (!noSanitize)
  739. {
  740. this.sanitiseGraph(graph);
  741. }
  742. return pageHeight;
  743. };
  744. /**
  745. * This function is for doing any async processing needed after importing a page
  746. */
  747. mxVsdxCodec.prototype.postImportPage = function(page, graph, callback)
  748. {
  749. try
  750. {
  751. var me = this;
  752. var toCropImgs = [];
  753. function checkShapes(shapes)
  754. {
  755. if (shapes != null)
  756. {
  757. shapes = shapes.entries || [];
  758. for (var i = 0; i < shapes.length; i++)
  759. {
  760. var shape = shapes[i].value || {};
  761. if (shape.toBeCroppedImg)
  762. {
  763. toCropImgs.push(shape);
  764. }
  765. checkShapes(shape.getChildShapes());
  766. }
  767. }
  768. }
  769. checkShapes(page.getShapes());
  770. if (toCropImgs.length > 0)
  771. {
  772. function cropImage(index, callback)
  773. {
  774. function next()
  775. {
  776. if (index < toCropImgs.length - 1)
  777. {
  778. cropImage(index + 1, callback);
  779. }
  780. else
  781. {
  782. callback();
  783. }
  784. };
  785. var shape = toCropImgs[index];
  786. var imgInfo = shape.toBeCroppedImg;
  787. var cell = (function (m, k) { if (m.entries == null)
  788. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  789. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  790. return m.entries[i].value;
  791. } return null; })(me.vertexMap, new com.mxgraph.io.vsdx.ShapePageId(page.Id, shape.Id));
  792. var img = new Image();
  793. img.onload = function()
  794. {
  795. var data = imgInfo.iData;
  796. var type = imgInfo.iType;
  797. try
  798. {
  799. //TODO There is still some minor inaccuracy in width/height
  800. var scaleX = img.width / imgInfo.imgWidth;
  801. var scaleY = img.height / imgInfo.imgHeight;
  802. var offsetX = (-imgInfo.imgOffsetX) * scaleX;
  803. var offsetY = (imgInfo.imgHeight - imgInfo.height + imgInfo.imgOffsetY) * scaleY;
  804. var c = document.createElement("canvas");
  805. c.width = imgInfo.width * scaleX;
  806. c.height = imgInfo.height * scaleY;
  807. var ctx = c.getContext("2d");
  808. ctx.fillStyle = "#FFFFFF";
  809. ctx.fillRect(0, 0, c.width, c.height);
  810. ctx.drawImage(img, offsetX, offsetY, c.width, c.height, 0, 0, c.width, c.height);
  811. var jpgData = c.toDataURL("image/jpeg");
  812. data = jpgData.substr(23); //23 is the length of "data:image/jpeg;base64,"
  813. type = 'jpg';
  814. }
  815. catch(e)
  816. {
  817. console.log(e);
  818. }
  819. cell.style += ';image=data:image/' + type + ',' + data;
  820. next();
  821. };
  822. img.src = 'data:image/' + imgInfo.iType + ';base64,' + imgInfo.iData;
  823. img.onerror = function()
  824. {
  825. cell.style += ';image=data:image/' + imgInfo.iType + ',' + imgInfo.iData;
  826. next();
  827. }
  828. };
  829. cropImage(0, callback);
  830. }
  831. else
  832. {
  833. callback();
  834. }
  835. }
  836. catch(e)
  837. {
  838. console.log(e);
  839. callback();
  840. }
  841. };
  842. /**
  843. * Adds a vertex to the graph if 'shape' is a vertex or add the shape to edgeShapeMap if it is an edge.
  844. * This method doesn't import sub-shapes of 'shape'.
  845. * @param {mxGraph} graph Graph where the parsed graph is included.
  846. * @param shp Shape to be imported.
  847. * @param {number} parentHeight Height of the parent cell.
  848. * @return {mxCell} the new vertex added. null if 'shape' is not a vertex.
  849. * @param {com.mxgraph.io.vsdx.VsdxShape} shape
  850. * @param {*} parent
  851. * @param {number} pageId
  852. */
  853. mxVsdxCodec.prototype.addShape = function (graph, shape, parent, pageId, parentHeight) {
  854. shape.parentHeight = parentHeight;
  855. var type = com.mxgraph.io.vsdx.VsdxShape.getType(shape.getShape());
  856. if (type != null && ((function (o1, o2) { if (o1 && o1.equals) {
  857. return o1.equals(o2);
  858. }
  859. else {
  860. return o1 === o2;
  861. } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.TYPE_SHAPE) || (function (o1, o2) { if (o1 && o1.equals) {
  862. return o1.equals(o2);
  863. }
  864. else {
  865. return o1 === o2;
  866. } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.TYPE_GROUP) || (function (o1, o2) { if (o1 && o1.equals) {
  867. return o1.equals(o2);
  868. }
  869. else {
  870. return o1 === o2;
  871. } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN))) {
  872. var id = shape.getId();
  873. if (shape.isVertex()) {
  874. var v1 = null;
  875. if (shape.isGroup()) {
  876. v1 = this.addGroup(graph, shape, parent, pageId, parentHeight);
  877. }
  878. else {
  879. v1 = this.addVertex(graph, shape, parent, pageId, parentHeight);
  880. }
  881. /* put */ (function (m, k, v) { if (m.entries == null)
  882. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  883. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  884. m.entries[i].value = v;
  885. return;
  886. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.vertexShapeMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, id), shape);
  887. var lnkObj = shape.getHyperlink();
  888. if (lnkObj.extLink)
  889. {
  890. graph.setLinkForCell(v1, lnkObj.extLink);
  891. }
  892. else if (lnkObj.pageLink)
  893. {
  894. graph.setLinkForCell(v1, 'data:page/id,' + lnkObj.pageLink.replace(/\s/g, '_'));
  895. }
  896. // Add Shape properties
  897. var props = shape.getProperties();
  898. for (var i = 0; i < props.length; i++)
  899. {
  900. try
  901. {
  902. graph.setAttributeForCell(v1, props[i].key, props[i].val);
  903. }
  904. catch(e)
  905. {
  906. console.log('Attribute: "', props[i].key, '" with value "', props[i].val, '" not allowed in HTML');
  907. }
  908. }
  909. return v1;
  910. }
  911. else
  912. {
  913. // When an edge is a group, we need to process the children (and keep the edge, so no fill (color) for the group)
  914. // TODO Not the best results (e.g, an extra edge is added in some cases), but covers most cases
  915. if (shape.isGroup())
  916. {
  917. this.addGroup(graph, shape, parent, pageId, parentHeight, true);
  918. }
  919. shape.setShapeIndex(graph.getModel().getChildCount(parent));
  920. /* put */ (function (m, k, v) { if (m.entries == null)
  921. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  922. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  923. m.entries[i].value = v;
  924. return;
  925. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.edgeShapeMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, id), shape);
  926. /* put */ (function (m, k, v) { if (m.entries == null)
  927. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  928. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  929. m.entries[i].value = v;
  930. return;
  931. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.parentsMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, id), parent);
  932. }
  933. }
  934. return null;
  935. };
  936. /**
  937. * Adds a group to the graph.
  938. * The sub-shapes of a complex shape are processed like part of the shape.
  939. * @param {mxGraph} graph Graph where the parsed graph is included.
  940. * @param {*} parent Parent cell of the shape.
  941. * @param {number} parentHeight Height of the parent cell of the shape.
  942. * @return {mxCell} Cell added to the graph.
  943. * @param {com.mxgraph.io.vsdx.VsdxShape} shape
  944. * @param {number} pageId
  945. */
  946. mxVsdxCodec.prototype.addGroup = function (graph, shape, parent, pageId, parentHeight, forceNoFill) {
  947. var d = shape.getDimensions();
  948. var master = shape.getMaster();
  949. var styleMap = shape.getStyleFromShape();
  950. var geomList = shape.getGeomList();
  951. if (geomList.isNoFill() || forceNoFill) {
  952. /* put */ (styleMap[mxConstants.STYLE_FILLCOLOR] = "none");
  953. /* put */ (styleMap[mxConstants.STYLE_GRADIENTCOLOR] = "none");
  954. }
  955. if (geomList.isNoLine() || forceNoFill) {
  956. /* put */ (styleMap[mxConstants.STYLE_STROKECOLOR] = "none");
  957. }
  958. /* put */ (styleMap["html"] = "1");
  959. /* put */ (styleMap[mxConstants.STYLE_WHITE_SPACE] = "wrap");
  960. var style = com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "=");
  961. var group = null;
  962. var children = shape.getChildShapes();
  963. var hasChildren = children != null && (function (m) { if (m.entries == null)
  964. m.entries = []; return m.entries.length; })(children) > 0;
  965. var subLabel = shape.isDisplacedLabel() || shape.isRotatedLabel() || hasChildren;
  966. var o = shape.getOriginPoint(parentHeight, true);
  967. if (subLabel) {
  968. group = graph.insertVertex(parent, null, null, Math.floor(Math.round(o.x * 100) / 100), Math.floor(Math.round(o.y * 100) / 100), Math.floor(Math.round(d.x * 100) / 100), Math.floor(Math.round(d.y * 100) / 100), style);
  969. }
  970. else {
  971. var textLabel = shape.getTextLabel();
  972. group = graph.insertVertex(parent, null, textLabel, Math.floor(Math.round(o.x * 100) / 100), Math.floor(Math.round(o.y * 100) / 100), Math.floor(Math.round(d.x * 100) / 100), Math.floor(Math.round(d.y * 100) / 100), style);
  973. }
  974. var potH = group.geometry.height;
  975. var entries = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* entrySet */ (function (m) { if (m.entries == null)
  976. m.entries = []; return m.entries; })(children));
  977. while ((entries.hasNext())) {
  978. var entry = entries.next();
  979. var subShape = entry.getValue();
  980. var Id = subShape.getId();
  981. if (subShape.isVertex()) {
  982. var type = com.mxgraph.io.vsdx.VsdxShape.getType(subShape.getShape());
  983. if (type != null && ((function (o1, o2) { if (o1 && o1.equals) {
  984. return o1.equals(o2);
  985. }
  986. else {
  987. return o1 === o2;
  988. } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.TYPE_SHAPE) || (function (o1, o2) { if (o1 && o1.equals) {
  989. return o1.equals(o2);
  990. }
  991. else {
  992. return o1 === o2;
  993. } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.TYPE_GROUP) || (function (o1, o2) { if (o1 && o1.equals) {
  994. return o1.equals(o2);
  995. }
  996. else {
  997. return o1 === o2;
  998. } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN))) {
  999. if (subShape.isVertex()) {
  1000. subShape.propagateRotation(shape.getRotation());
  1001. var tmpV;
  1002. if (subShape.isGroup()) {
  1003. tmpV = this.addGroup(graph, subShape, group, pageId, d.y);
  1004. }
  1005. else {
  1006. tmpV = this.addVertex(graph, subShape, group, pageId, d.y);
  1007. }
  1008. if (tmpV && tmpV.geometry)
  1009. {
  1010. potH = Math.max(tmpV.geometry.height, potH);
  1011. }
  1012. }
  1013. }
  1014. if (master == null) {
  1015. /* put */ (function (m, k, v) { if (m.entries == null)
  1016. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1017. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1018. m.entries[i].value = v;
  1019. return;
  1020. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.vertexShapeMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, Id), subShape);
  1021. }
  1022. }
  1023. else {
  1024. if (master == null) {
  1025. /* put */ (function (m, k, v) { if (m.entries == null)
  1026. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1027. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1028. m.entries[i].value = v;
  1029. return;
  1030. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.edgeShapeMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, Id), subShape);
  1031. /* put */ (function (m, k, v) { if (m.entries == null)
  1032. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1033. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1034. m.entries[i].value = v;
  1035. return;
  1036. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.parentsMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, Id), group);
  1037. }
  1038. else {
  1039. this.addUnconnectedEdge(graph, group, subShape, parentHeight);
  1040. }
  1041. }
  1042. }
  1043. ;
  1044. if (group.children && group.geometry.height == 0 && potH > 0)
  1045. {
  1046. group.geometry.height = potH;
  1047. for (var i = 0; i < group.children.length; i++)
  1048. {
  1049. var child = group.children[i];
  1050. if (child.geometry)
  1051. {
  1052. child.geometry.y += potH;
  1053. }
  1054. }
  1055. }
  1056. if (subLabel) {
  1057. shape.createLabelSubShape(graph, group);
  1058. }
  1059. var rotation = shape.getRotation();
  1060. if (rotation !== 0) {
  1061. var pgeo = group.getGeometry();
  1062. var hw = pgeo.width / 2;
  1063. var hh = pgeo.height / 2;
  1064. for (var i = 0; i < group.getChildCount(); i++) {
  1065. var child = group.getChildAt(i);
  1066. com.mxgraph.online.Utils.rotatedGeometry(child.getGeometry(), rotation, hw, hh);
  1067. }
  1068. ;
  1069. }
  1070. /* put */ (function (m, k, v) { if (m.entries == null)
  1071. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1072. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1073. m.entries[i].value = v;
  1074. return;
  1075. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.vertexMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, shape.getId()), group);
  1076. return group;
  1077. };
  1078. mxVsdxCodec.rotatedEdgePoint = function (pt, rotation, cx, cy) {
  1079. rotation = (function (x) { return x * Math.PI / 180; })(rotation);
  1080. var cos = Math.cos(rotation);
  1081. var sin = Math.sin(rotation);
  1082. var x = pt.x - cx;
  1083. var y = pt.y - cy;
  1084. var x1 = x * cos - y * sin;
  1085. var y1 = y * cos + x * sin;
  1086. pt.x = (Math.round(x1 + cx));
  1087. pt.y = (Math.round(y1 + cy));
  1088. };
  1089. /**
  1090. * Adds a simple shape to the graph
  1091. * @param {mxGraph} graph Graph where the parsed graph is included.
  1092. * @param {*} parent Parent cell of the shape.
  1093. * @param {number} parentHeight Height of the parent cell of the shape.
  1094. * @return {mxCell} Cell added to the graph.
  1095. * @param {com.mxgraph.io.vsdx.VsdxShape} shape
  1096. * @param {number} pageId
  1097. */
  1098. mxVsdxCodec.prototype.addVertex = function (graph, shape, parent, pageId, parentHeight) {
  1099. var textLabel = "";
  1100. var hasSubLabel = shape.isDisplacedLabel() || shape.isRotatedLabel();
  1101. if (!hasSubLabel) {
  1102. textLabel = shape.getTextLabel();
  1103. }
  1104. var dimensions = shape.getDimensions();
  1105. var styleMap = shape.getStyleFromShape();
  1106. /* put */ (styleMap["html"] = "1");
  1107. var geomExists = styleMap.hasOwnProperty(mxConstants.STYLE_SHAPE) || styleMap.hasOwnProperty("stencil");
  1108. if (!styleMap.hasOwnProperty(mxConstants.STYLE_FILLCOLOR) || !geomExists) {
  1109. /* put */ (styleMap[mxConstants.STYLE_FILLCOLOR] = "none");
  1110. }
  1111. if (!geomExists) {
  1112. /* put */ (styleMap[mxConstants.STYLE_STROKECOLOR] = "none");
  1113. }
  1114. if (!styleMap.hasOwnProperty(mxConstants.STYLE_GRADIENTCOLOR) || !geomExists) {
  1115. /* put */ (styleMap[mxConstants.STYLE_GRADIENTCOLOR] = "none");
  1116. }
  1117. /* put */ (styleMap[mxConstants.STYLE_WHITE_SPACE] = "wrap");
  1118. var coordinates = shape.getOriginPoint(parentHeight, true);
  1119. if (geomExists || textLabel != null) {
  1120. var style = com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "=");
  1121. var v1 = null;
  1122. if (hasSubLabel) {
  1123. v1 = graph.insertVertex(parent, null, null, Math.floor(Math.round(coordinates.x * 100) / 100), Math.floor(Math.round(coordinates.y * 100) / 100), Math.floor(Math.round(dimensions.x * 100) / 100), Math.floor(Math.round(dimensions.y * 100) / 100), style);
  1124. }
  1125. else {
  1126. v1 = graph.insertVertex(parent, null, textLabel, Math.floor(Math.round(coordinates.x * 100) / 100), Math.floor(Math.round(coordinates.y * 100) / 100), Math.floor(Math.round(dimensions.x * 100) / 100), Math.floor(Math.round(dimensions.y * 100) / 100), style);
  1127. }
  1128. /* put */ (function (m, k, v) { if (m.entries == null)
  1129. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1130. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1131. m.entries[i].value = v;
  1132. return;
  1133. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.vertexMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, shape.getId()), v1);
  1134. shape.setLabelOffset(v1, style);
  1135. if (hasSubLabel) {
  1136. shape.createLabelSubShape(graph, v1);
  1137. }
  1138. return v1;
  1139. }
  1140. return null;
  1141. };
  1142. mxVsdxCodec.calculateAbsolutePoint = function (cell)
  1143. {
  1144. var x = 0, y = 0;
  1145. while (cell != null)
  1146. {
  1147. var geo = cell.geometry;
  1148. if (geo != null)
  1149. {
  1150. x += geo.x;
  1151. y += geo.y;
  1152. }
  1153. cell = cell.parent;
  1154. }
  1155. return new mxPoint(x, y);
  1156. }
  1157. mxVsdxCodec.prototype.processEdgeGeo = function (edgeShape, edge)
  1158. {
  1159. //Detect Line jumps (best effots)
  1160. try
  1161. {
  1162. var rows = edgeShape.geomList.geomList[0].rows;
  1163. for (var i = 0; i < rows.length; i++)
  1164. {
  1165. if (rows[i] instanceof com.mxgraph.io.vsdx.geometry.ArcTo)
  1166. {
  1167. edge.style += 'jumpStyle=arc;';
  1168. break;
  1169. }
  1170. }
  1171. //Handle NURBS
  1172. for (var i = 0; i < rows.length; i++)
  1173. {
  1174. if (rows[i] instanceof com.mxgraph.io.vsdx.geometry.NURBSTo)
  1175. {
  1176. //TODO HAndle NURBS points (convert to curved edge with these points)
  1177. //var str = rows[i].handle({}, edgeShape);
  1178. }
  1179. }
  1180. }
  1181. catch(e){} //Ignore
  1182. };
  1183. function addEdgeSublabel(graph, edge, edgeShape, rotation, lblOffset)
  1184. {
  1185. var label = edgeShape.createLabelSubShape(graph, edge);
  1186. if (label != null)
  1187. {
  1188. if (rotation !== 0)
  1189. {
  1190. var lblRot = label.getStyle().match(/;rotation=(\d+\.*\d+)/);
  1191. if (lblRot != null)
  1192. {
  1193. rotation += parseFloat(lblRot[1]);
  1194. }
  1195. label.setStyle(label.getStyle().replace(/;rotation=(\d+\.*\d+)/, '') + ";rotation=" + (rotation > 60 && rotation < 240 ? (rotation + 180) % 360 : rotation));
  1196. }
  1197. var geo = label.getGeometry();
  1198. geo.x = (0);
  1199. geo.y = (0);
  1200. geo.relative = (true);
  1201. lblOffset = lblOffset || new mxPoint(0, 0);
  1202. geo.offset = (new mxPoint(lblOffset.x - geo.width / 2, lblOffset.y - geo.height / 2));
  1203. }
  1204. };
  1205. /**
  1206. * Adds a connected edge to the graph.
  1207. * These edged are the referenced in one Connect element at least.
  1208. * @param {mxGraph} graph graph Graph where the parsed graph is included.
  1209. * @param {com.mxgraph.io.vsdx.mxVsdxConnect} connect Connect Element that references an edge shape and the source vertex.
  1210. * @param {number} pageId
  1211. * @param {number} pageHeight
  1212. * @return {com.mxgraph.io.vsdx.ShapePageId}
  1213. */
  1214. mxVsdxCodec.prototype.addConnectedEdge = function (graph, connect, pageId, pageHeight) {
  1215. var fromSheet = connect.getFromSheet();
  1216. var edgeId = new com.mxgraph.io.vsdx.ShapePageId(pageId, fromSheet);
  1217. var edgeShape = (function (m, k) { if (m.entries == null)
  1218. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1219. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1220. return m.entries[i].value;
  1221. } return null; })(this.edgeShapeMap, edgeId);
  1222. if (edgeShape == null) {
  1223. return null;
  1224. }
  1225. var parent = (function (m, k) { if (m.entries == null)
  1226. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1227. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1228. return m.entries[i].value;
  1229. } return null; })(this.parentsMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, edgeShape.getId()));
  1230. var parentHeight = pageHeight;
  1231. if (parent != null) {
  1232. var parentGeo = graph.getModel().getGeometry(parent);
  1233. if (parentGeo != null) {
  1234. parentHeight = parentGeo.height;
  1235. }
  1236. }
  1237. var beginXY = edgeShape.getStartXY(parentHeight);
  1238. var endXY = edgeShape.getEndXY(parentHeight);
  1239. var points = edgeShape.getRoutingPoints(parentHeight, beginXY, edgeShape.getRotation());
  1240. this.rotateChildEdge(graph.getModel(), parent, beginXY, endXY, points);
  1241. var fromConstraint = null;
  1242. var sourceSheet = connect.getSourceToSheet();
  1243. var source = sourceSheet != null ? (function (m, k) { if (m.entries == null)
  1244. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1245. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1246. return m.entries[i].value;
  1247. } return null; })(this.vertexMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, sourceSheet)) : null;
  1248. var removeFirstPt = true;
  1249. //Treat source with zero height/width as null since constraint calc will be invalid
  1250. if (source == null || source.geometry.width == 0 || source.geometry.height == 0)
  1251. {
  1252. source = graph.insertVertex(parent, null, null, Math.floor(Math.round(beginXY.x * 100) / 100), Math.floor(Math.round(beginXY.y * 100) / 100), 0, 0);
  1253. }
  1254. else if (source.style && source.style.indexOf(';rotation=') == -1)
  1255. {
  1256. var absOriginFrom = mxVsdxCodec.calculateAbsolutePoint(source);
  1257. var absBeginXY = mxVsdxCodec.calculateAbsolutePoint(parent);
  1258. var srcGeo = source.geometry;
  1259. fromConstraint = new mxPoint(
  1260. (absBeginXY.x + beginXY.x - absOriginFrom.x)
  1261. / srcGeo.width,
  1262. (absBeginXY.y + beginXY.y - absOriginFrom.y)
  1263. / srcGeo.height);
  1264. //TODO fromConstraint rotation support
  1265. }
  1266. else
  1267. {
  1268. removeFirstPt = false;
  1269. }
  1270. var toConstraint = null;
  1271. var toSheet = connect.getTargetToSheet();
  1272. var target = toSheet != null ? (function (m, k) { if (m.entries == null)
  1273. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1274. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1275. return m.entries[i].value;
  1276. } return null; })(this.vertexMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, toSheet)) : null;
  1277. var removeLastPt = true;
  1278. //Treat target with zero height/width as null since constraint calc will be invalid
  1279. if (target == null || target.geometry.width == 0 || target.geometry.height == 0)
  1280. {
  1281. target = graph.insertVertex(parent, null, null, Math.floor(Math.round(endXY.x * 100) / 100), Math.floor(Math.round(endXY.y * 100) / 100), 0, 0);
  1282. }
  1283. else if (target.style && target.style.indexOf(';rotation=') == -1)
  1284. {
  1285. var absOriginTo = mxVsdxCodec.calculateAbsolutePoint(target);
  1286. var absEndXY = mxVsdxCodec.calculateAbsolutePoint(parent);
  1287. var trgGeo = target.geometry;
  1288. toConstraint = new mxPoint(
  1289. (absEndXY.x + endXY.x - absOriginTo.x)
  1290. / trgGeo.width,
  1291. (absEndXY.y + endXY.y - absOriginTo.y)
  1292. / trgGeo.height);
  1293. //TODO toConstraint rotation support
  1294. }
  1295. else
  1296. {
  1297. removeLastPt = false;
  1298. }
  1299. var styleMap = edgeShape.getStyleFromEdgeShape(parentHeight);
  1300. var edge;
  1301. var rotation = edgeShape.getRotation();
  1302. var textLabel = "";
  1303. var hasSubLabel = edgeShape.isDisplacedLabel() || edgeShape.isRotatedLabel() || rotation !== 0;
  1304. var lblOffset = edgeShape.getLblEdgeOffset(graph.getView(), points);
  1305. if (!hasSubLabel)
  1306. {
  1307. textLabel = edgeShape.getTextLabel(true);
  1308. }
  1309. edge = graph.insertEdge(parent, null, textLabel, source, target, com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "="));
  1310. if (hasSubLabel)
  1311. {
  1312. addEdgeSublabel(graph, edge, edgeShape, rotation, lblOffset);
  1313. }
  1314. else
  1315. {
  1316. edge.getGeometry().offset = lblOffset;
  1317. }
  1318. //add entry/exit points when edge, src, and trg are not rotated
  1319. if (fromConstraint != null)
  1320. {
  1321. graph.setConnectionConstraint(edge, source, true,
  1322. new mxConnectionConstraint(fromConstraint, false));
  1323. }
  1324. if (removeFirstPt)
  1325. {
  1326. points.shift();
  1327. }
  1328. if (toConstraint != null)
  1329. {
  1330. graph.setConnectionConstraint(edge, target, false,
  1331. new mxConnectionConstraint(toConstraint, false));
  1332. }
  1333. if (removeLastPt)
  1334. {
  1335. points.pop();
  1336. }
  1337. var edgeGeometry = graph.getModel().getGeometry(edge);
  1338. //when source.parent != target.parent the front end will change the edge parent to parent 1 but waypoints are not corrected
  1339. if (source.parent != target.parent && parent != null && parent.id != 1 && source.parent.id == 1)
  1340. {
  1341. var accX = 0;
  1342. var accY = 0;
  1343. var prnt = parent;
  1344. do
  1345. {
  1346. var prntGeo = prnt.geometry;
  1347. if (prntGeo != null)
  1348. {
  1349. accX += prntGeo.x;
  1350. accY += prntGeo.y;
  1351. }
  1352. prnt = prnt.parent;
  1353. }
  1354. while(prnt != null);
  1355. edge.parent = source.parent;
  1356. for (var i = 0; i < points.length; i++)
  1357. {
  1358. points[i].x += accX;
  1359. points[i].y += accY;
  1360. }
  1361. }
  1362. edgeGeometry.points = (points);
  1363. if (styleMap.hasOwnProperty("curved") && (function (o1, o2) { if (o1 && o1.equals) {
  1364. return o1.equals(o2);
  1365. }
  1366. else {
  1367. return o1 === o2;
  1368. } })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(styleMap, "curved"), "1")) {
  1369. edgeGeometry = graph.getModel().getGeometry(edge);
  1370. var pointList = edgeShape.getControlPoints(parentHeight);
  1371. edgeGeometry.points = (pointList);
  1372. }
  1373. this.processEdgeGeo(edgeShape, edge) ;
  1374. var layers = this.layerIndexToNames(edgeShape.layerMember);
  1375. if (layers != null)
  1376. {
  1377. graph.addTagsForCells([edge], layers);
  1378. }
  1379. return edgeId;
  1380. };
  1381. /**
  1382. * Adds a new edge not connected to any vertex to the graph.
  1383. * @param {mxGraph} graph Graph where the parsed graph is included.
  1384. * @param {*} parent Parent cell of the edge to be imported.
  1385. * @param {com.mxgraph.io.vsdx.VsdxShape} edgeShape Shape Element that represents an edge.
  1386. * @return {*} The new edge added.
  1387. * @param {number} pageHeight
  1388. */
  1389. mxVsdxCodec.prototype.addUnconnectedEdge = function (graph, parent, edgeShape, pageHeight) {
  1390. var parentHeight = pageHeight;
  1391. if (parent != null) {
  1392. var parentGeometry = graph.getModel().getGeometry(parent);
  1393. if (parentGeometry != null) {
  1394. parentHeight = parentGeometry.height;
  1395. }
  1396. }
  1397. var beginXY = edgeShape.getStartXY(parentHeight);
  1398. var endXY = edgeShape.getEndXY(parentHeight);
  1399. var styleMap = edgeShape.getStyleFromEdgeShape(parentHeight);
  1400. var edge;
  1401. var points = edgeShape.getRoutingPoints(parentHeight, beginXY, edgeShape.getRotation());
  1402. var rotation = edgeShape.getRotation();
  1403. var textLabel = "";
  1404. var hasSubLabel = edgeShape.isDisplacedLabel() || edgeShape.isRotatedLabel() || rotation !== 0;
  1405. var lblOffset = edgeShape.getLblEdgeOffset(graph.getView(), points);
  1406. if (!hasSubLabel)
  1407. {
  1408. textLabel = edgeShape.getTextLabel(true);
  1409. }
  1410. if (edgeShape.getShapeIndex() === 0) {
  1411. edge = graph.insertEdge(parent, null, textLabel, null, null, com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "="));
  1412. }
  1413. else {
  1414. edge = graph.createEdge(parent, null, textLabel, null, null, com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "="));
  1415. edge = graph.addEdge(edge, parent, null, null, edgeShape.getShapeIndex() + this.shapeIndexShift++);
  1416. }
  1417. if (hasSubLabel)
  1418. {
  1419. addEdgeSublabel(graph, edge, edgeShape, rotation, lblOffset);
  1420. }
  1421. else
  1422. {
  1423. edge.getGeometry().offset = lblOffset;
  1424. }
  1425. this.rotateChildEdge(graph.getModel(), parent, beginXY, endXY, points);
  1426. var edgeGeometry = graph.getModel().getGeometry(edge);
  1427. //remove begin/end points from points array
  1428. points.pop();
  1429. points.shift();
  1430. edgeGeometry.points = (points);
  1431. edgeGeometry.setTerminalPoint(beginXY, true);
  1432. edgeGeometry.setTerminalPoint(endXY, false);
  1433. if (styleMap.hasOwnProperty("curved") && (function (o1, o2) { if (o1 && o1.equals) {
  1434. return o1.equals(o2);
  1435. }
  1436. else {
  1437. return o1 === o2;
  1438. } })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(styleMap, "curved"), "1")) {
  1439. edgeGeometry = graph.getModel().getGeometry(edge);
  1440. var pointList = edgeShape.getControlPoints(parentHeight);
  1441. edgeGeometry.points = (pointList);
  1442. }
  1443. this.processEdgeGeo(edgeShape, edge) ;
  1444. return edge;
  1445. };
  1446. mxVsdxCodec.prototype.rotateChildEdge = function (model, parent, beginXY, endXY, points) {
  1447. if (parent != null) {
  1448. var pgeo = model.getGeometry(parent);
  1449. var pStyle = model.getStyle(parent);
  1450. if (pgeo != null && pStyle != null) {
  1451. var pos = pStyle.indexOf("rotation=");
  1452. if (pos > -1) {
  1453. var pRotation = parseFloat(pStyle.substring(pos + 9, pStyle.indexOf(';', pos)));
  1454. var hw = pgeo.width / 2;
  1455. var hh = pgeo.height / 2;
  1456. mxVsdxCodec.rotatedEdgePoint(beginXY, pRotation, hw, hh);
  1457. mxVsdxCodec.rotatedEdgePoint(endXY, pRotation, hw, hh);
  1458. for (var index126 = 0; index126 < points.length; index126++) {
  1459. var p = points[index126];
  1460. {
  1461. mxVsdxCodec.rotatedEdgePoint(p, pRotation, hw, hh);
  1462. }
  1463. }
  1464. }
  1465. }
  1466. }
  1467. };
  1468. /**
  1469. * Post processes groups to remove leaf vertices that render nothing
  1470. * @param group
  1471. * @param {mxGraph} graph
  1472. */
  1473. mxVsdxCodec.prototype.sanitiseGraph = function (graph) {
  1474. var root = graph.getModel().getRoot();
  1475. this.sanitiseCell(graph, root);
  1476. };
  1477. /*private*/ mxVsdxCodec.prototype.sanitiseCell = function (graph, cell) {
  1478. var model = graph.getModel();
  1479. var childCount = model.getChildCount(cell);
  1480. var removeList = ([]);
  1481. for (var i = 0; i < childCount; i++) {
  1482. var child = model.getChildAt(cell, i);
  1483. var remove = this.sanitiseCell(graph, child);
  1484. if (remove) {
  1485. /* add */ (removeList.push(child));
  1486. }
  1487. }
  1488. ;
  1489. for (var index127 = 0; index127 < removeList.length; index127++) {
  1490. var removeChild = removeList[index127];
  1491. {
  1492. model.remove(removeChild);
  1493. }
  1494. }
  1495. //Check for -ve width/height cells and correct it
  1496. var geo = cell.geometry;
  1497. if (geo != null)
  1498. {
  1499. if (geo.height < 0)
  1500. {
  1501. geo.height = Math.abs(geo.height);
  1502. geo.y -= geo.height;
  1503. cell.style += ';flipV=1;';
  1504. }
  1505. if (geo.width < 0)
  1506. {
  1507. geo.width = Math.abs(geo.width);
  1508. geo.x -= geo.width;
  1509. cell.style += ';flipH=1;';
  1510. }
  1511. }
  1512. if (childCount > 0) {
  1513. childCount = model.getChildCount(cell);
  1514. }
  1515. var value = new String(model.getValue(cell)).toString();
  1516. var style = model.getStyle(cell);
  1517. if (childCount === 0 && model.isVertex(cell)) {
  1518. if ((model.getValue(cell) == null || (value.length === 0)) && (style != null) && (style.indexOf(mxConstants.STYLE_FILLCOLOR + "=none") != -1) && (style.indexOf(mxConstants.STYLE_STROKECOLOR + "=none") != -1) && (style.indexOf("image=") == -1)) {
  1519. return true;
  1520. }
  1521. }
  1522. return false;
  1523. };
  1524. return mxVsdxCodec;
  1525. }());
  1526. io.mxVsdxCodec = mxVsdxCodec;
  1527. mxVsdxCodec["__class"] = "com.mxgraph.io.mxVsdxCodec";
  1528. })(io = mxgraph.io || (mxgraph.io = {}));
  1529. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  1530. })(com || (com = {}));
  1531. (function (com) {
  1532. var mxgraph;
  1533. (function (mxgraph) {
  1534. var io;
  1535. (function (io) {
  1536. var mxVssxCodec = (function (_super) {
  1537. __extends(mxVssxCodec, _super);
  1538. function mxVssxCodec(editorUi) {
  1539. var _this = _super.call(this) || this;
  1540. _this.RESPONSE_END = "";
  1541. _this.RESPONSE_DIAGRAM_START = "";
  1542. _this.RESPONSE_DIAGRAM_END = "";
  1543. _this.RESPONSE_HEADER = "";
  1544. _this.editorUi = editorUi;
  1545. return _this;
  1546. }
  1547. mxVssxCodec.prototype.decodeVssx = function (file, callback, charset, onerror) {
  1548. var _this = this;
  1549. var library = { str: "<mxlibrary>[", toString: function () { return this.str; } };
  1550. this.decodeVsdx(file, function(shapesInPages)
  1551. {
  1552. /* append */ (function (sb) { return sb.str = sb.str.concat(shapesInPages); })(library);
  1553. var masterShapes = _this.vsdxModel.getMasterShapes();
  1554. var page = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (m) { var r = []; if (m.entries == null)
  1555. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1556. r.push(m.entries[i].value); return r; })(_this.vsdxModel.getPages())).next();
  1557. if (masterShapes != null) {
  1558. var shapes_1 = { str: "", toString: function () { return this.str; } };
  1559. var comma_1 = (shapesInPages.length === 0) ? "" : ",";
  1560. {
  1561. var array129 = (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(masterShapes);
  1562. var _loop_1 = function (index128) {
  1563. var master = array129[index128];
  1564. {
  1565. var shapeGraph = this_1.createMxGraph();
  1566. var scale = 1;
  1567. if (master.pageSheet != null)
  1568. {
  1569. var dScaleV = 1, pScaleV = 1;
  1570. var dScale = master.pageSheet["DrawingScale"];
  1571. if (dScale != null)
  1572. {
  1573. dScaleV = parseFloat(dScale.getAttribute("V")) || 1;
  1574. }
  1575. var pScale = master.pageSheet["PageScale"];
  1576. if (pScale != null)
  1577. {
  1578. pScaleV = parseFloat(pScale.getAttribute("V")) || 1;
  1579. }
  1580. scale = pScaleV / dScaleV;
  1581. }
  1582. var hasCells = false;
  1583. for (var chI = 0; master.firstLevelShapes != null && chI < master.firstLevelShapes.length; chI++)
  1584. {
  1585. var shapeElem = master.firstLevelShapes[chI].getShape();
  1586. var shape = new com.mxgraph.io.vsdx.VsdxShape(page, shapeElem, !page.isEdge(shapeElem), masterShapes, null, this_1.vsdxModel);
  1587. var cell = null;
  1588. if (shape.isVertex()) {
  1589. /* clear */ this_1.edgeShapeMap.entries = [];
  1590. /* clear */ this_1.parentsMap.entries = [];
  1591. cell = this_1.addShape(shapeGraph, shape, shapeGraph.getDefaultParent(), 0, 1169);
  1592. {
  1593. var array131 = (function (m) { if (m.entries == null)
  1594. m.entries = []; return m.entries; })(this_1.edgeShapeMap);
  1595. for (var index130 = 0; index130 < array131.length; index130++) {
  1596. var edgeEntry = array131[index130];
  1597. {
  1598. var parent_1 = (function (m, k) { if (m.entries == null)
  1599. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1600. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1601. return m.entries[i].value;
  1602. } return null; })(this_1.parentsMap, edgeEntry.getKey());
  1603. this_1.addUnconnectedEdge(shapeGraph, parent_1, edgeEntry.getValue(), 1169);
  1604. }
  1605. }
  1606. }
  1607. }
  1608. else {
  1609. cell = this_1.addUnconnectedEdge(shapeGraph, null, shape, 1169);
  1610. }
  1611. hasCells |= (cell != null);
  1612. }
  1613. if (hasCells)
  1614. {
  1615. this_1.scaleGraph(shapeGraph, scale);
  1616. var size = this_1.normalizeGraph(shapeGraph);
  1617. this_1.sanitiseGraph(shapeGraph);
  1618. if (shapeGraph.getModel().getChildCount(shapeGraph.getDefaultParent()) === 0)
  1619. return "continue";
  1620. /* append */ (function (sb) { return sb.str = sb.str.concat(comma_1); })(shapes_1);
  1621. /* append */ (function (sb) { return sb.str = sb.str.concat("{\"xml\":\""); })(shapes_1);
  1622. var shapeXML_1 = _super.prototype.processPage.call(this_1, shapeGraph, null);
  1623. /* append */ (function (sb) { return sb.str = sb.str.concat(shapeXML_1); })(shapes_1);
  1624. /* append */ (function (sb) { return sb.str = sb.str.concat("\",\"w\":"); })(shapes_1);
  1625. /* append */ (function (sb) { return sb.str = sb.str.concat(size.width); })(shapes_1);
  1626. /* append */ (function (sb) { return sb.str = sb.str.concat(",\"h\":"); })(shapes_1);
  1627. /* append */ (function (sb) { return sb.str = sb.str.concat(size.height); })(shapes_1);
  1628. /* append */ (function (sb) { return sb.str = sb.str.concat(",\"title\":"); })(shapes_1);
  1629. var shapeName_1 = master.getName();
  1630. if (shapeName_1 == null)
  1631. {
  1632. shapeName_1 = "";
  1633. }
  1634. shapeName_1 = mxUtils.htmlEntities(JSON.stringify(shapeName_1));
  1635. /* append */ (function (sb) { return sb.str = sb.str.concat(shapeName_1); })(shapes_1);
  1636. /* append */ (function (sb) { return sb.str = sb.str.concat("}"); })(shapes_1);
  1637. comma_1 = ",";
  1638. }
  1639. }
  1640. };
  1641. var this_1 = _this;
  1642. for (var index128 = 0; index128 < array129.length; index128++) {
  1643. _loop_1(index128);
  1644. }
  1645. }
  1646. /* append */ (function (sb) { return sb.str = sb.str.concat(shapes_1); })(library);
  1647. }
  1648. /* append */ (function (sb) { return sb.str = sb.str.concat("]</mxlibrary>"); })(library);
  1649. if (callback)
  1650. {
  1651. try
  1652. {
  1653. callback(library.str);
  1654. }
  1655. catch(e)
  1656. {
  1657. if (onerror != null)
  1658. {
  1659. onerror(e);
  1660. }
  1661. else
  1662. {
  1663. callback("");
  1664. }
  1665. }
  1666. }
  1667. }, charset);
  1668. };
  1669. mxVssxCodec.prototype.normalizeGeo = function (cell) {
  1670. var geo = cell.getGeometry();
  1671. geo.x = (0);
  1672. geo.y = (0);
  1673. var srcP = geo.sourcePoint;
  1674. if (cell.isEdge() && srcP != null) {
  1675. this.transPoint(geo.targetPoint, srcP);
  1676. this.transPoint(geo.offset, srcP);
  1677. var points = geo.points;
  1678. if (points != null) {
  1679. for (var index132 = 0; index132 < points.length; index132++) {
  1680. var p = points[index132];
  1681. {
  1682. this.transPoint(p, srcP);
  1683. }
  1684. }
  1685. }
  1686. this.transPoint(srcP, srcP);
  1687. }
  1688. return geo;
  1689. };
  1690. mxVssxCodec.prototype.normalizeGraph = function (graph)
  1691. {
  1692. //Find minX/Y, maxX/Y
  1693. var minX, minY, maxX, maxY;
  1694. function getDimMinMax(pt)
  1695. {
  1696. if (pt != null)
  1697. {
  1698. if (minX == null)
  1699. {
  1700. minX = pt.x; minY = pt.y; maxX = pt.x + (pt.width || 0); maxY = pt.y + (pt.height || 0);
  1701. }
  1702. else
  1703. {
  1704. minX = Math.min(pt.x, minX);
  1705. minY = Math.min(pt.y, minY);
  1706. maxX = Math.max(pt.x + (pt.width || 0), maxX);
  1707. maxY = Math.max(pt.y + (pt.height || 0), maxY);
  1708. }
  1709. }
  1710. };
  1711. for (var id in graph.model.cells)
  1712. {
  1713. var cell = graph.model.cells[id];
  1714. var geo = cell.geometry;
  1715. if (geo != null && cell.parent.id == 1)
  1716. {
  1717. if (cell.vertex)
  1718. {
  1719. getDimMinMax(geo);
  1720. }
  1721. else
  1722. {
  1723. getDimMinMax(geo.sourcePoint);
  1724. getDimMinMax(geo.targetPoint);
  1725. var points = geo.points;
  1726. for (var i = 0; points != null && i < points.length; i++)
  1727. {
  1728. getDimMinMax(points[i]);
  1729. }
  1730. }
  1731. }
  1732. }
  1733. //Remove minX, minY from all geo and fix edges also
  1734. var srcP = {x: minX, y: minY};
  1735. for (var id in graph.model.cells)
  1736. {
  1737. var cell = graph.model.cells[id];
  1738. var geo = cell.geometry;
  1739. if (geo != null && cell.parent.id == 1)
  1740. {
  1741. geo.x -= minX;
  1742. geo.y -= minY;
  1743. if (cell.isEdge())
  1744. {
  1745. this.transPoint(geo.sourcePoint, srcP);
  1746. this.transPoint(geo.targetPoint, srcP);
  1747. this.transPoint(geo.offset, srcP);
  1748. var points = geo.points;
  1749. for (var i = 0; points != null && i < points.length; i++)
  1750. {
  1751. this.transPoint(points[i], srcP);
  1752. }
  1753. }
  1754. }
  1755. }
  1756. return {width: maxX - minX, height: maxY - minY}
  1757. };
  1758. mxVssxCodec.prototype.transPoint = function (p, srcP) {
  1759. if (p != null) {
  1760. p.x = (p.x - srcP.x);
  1761. p.y = (p.y - srcP.y);
  1762. }
  1763. };
  1764. /**
  1765. *
  1766. * @param {com.mxgraph.io.mxGraph} graph
  1767. * @param {com.mxgraph.io.vsdx.mxVsdxPage} page
  1768. * @return {string}
  1769. */
  1770. mxVssxCodec.prototype.processPage = function (graph, page) {
  1771. var model = graph.getModel();
  1772. var shapes = { str: "", toString: function () { return this.str; } };
  1773. var comma = "";
  1774. {
  1775. var this_2 = this;
  1776. for (var id in model.cells) {
  1777. var c = model.cells[id];
  1778. {
  1779. if (graph.getDefaultParent() === model.getParent(c)) {
  1780. /* append */ (function (sb) { return sb.str = sb.str.concat(comma); })(shapes);
  1781. /* append */ (function (sb) { return sb.str = sb.str.concat("{\"xml\":\""); })(shapes);
  1782. var shapeGraph = this_2.createMxGraph();
  1783. shapeGraph.addCell(c);
  1784. this_2.sanitiseGraph(shapeGraph);
  1785. if (shapeGraph.getModel().getChildCount(shapeGraph.getDefaultParent()) === 0)
  1786. return "continue";
  1787. var geo_2 = this_2.normalizeGeo(c);
  1788. var shapeXML_2 = _super.prototype.processPage.call(this_2, shapeGraph, null);
  1789. /* append */ (function (sb) { return sb.str = sb.str.concat(shapeXML_2); })(shapes);
  1790. /* append */ (function (sb) { return sb.str = sb.str.concat("\",\"w\":"); })(shapes);
  1791. /* append */ (function (sb) { return sb.str = sb.str.concat(geo_2.width); })(shapes);
  1792. /* append */ (function (sb) { return sb.str = sb.str.concat(",\"h\":"); })(shapes);
  1793. /* append */ (function (sb) { return sb.str = sb.str.concat(geo_2.height); })(shapes);
  1794. /* append */ (function (sb) { return sb.str = sb.str.concat(",\"title\":\""); })(shapes);
  1795. var style = model.getStyle(c);
  1796. var name_1 = "";
  1797. if (style != null) {
  1798. var p = style.indexOf(com.mxgraph.io.vsdx.mxVsdxConstants.VSDX_ID);
  1799. if (p >= 0) {
  1800. p += com.mxgraph.io.vsdx.mxVsdxConstants.VSDX_ID.length + 1;
  1801. var id = parseInt(style.substring(p, style.indexOf(";", p)));
  1802. var vsdxShape = (function (m, k) { if (m.entries == null)
  1803. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  1804. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  1805. return m.entries[i].value;
  1806. } return null; })(this_2.vertexShapeMap, new com.mxgraph.io.vsdx.ShapePageId(page.getId(), id));
  1807. if (vsdxShape != null)
  1808. name_1 = vsdxShape.getName();
  1809. }
  1810. }
  1811. /* append */ (function (sb) { return sb.str = sb.str.concat(name_1); })(shapes);
  1812. /* append */ (function (sb) { return sb.str = sb.str.concat("\"}"); })(shapes);
  1813. comma = ",";
  1814. }
  1815. }
  1816. };
  1817. }
  1818. if (shapes.str.length > 0)
  1819. this.RESPONSE_DIAGRAM_START = ",";
  1820. else
  1821. this.RESPONSE_DIAGRAM_START = "";
  1822. return shapes.str;
  1823. };
  1824. return mxVssxCodec;
  1825. }(com.mxgraph.io.mxVsdxCodec));
  1826. io.mxVssxCodec = mxVssxCodec;
  1827. mxVssxCodec["__class"] = "com.mxgraph.io.mxVssxCodec";
  1828. })(io = mxgraph.io || (mxgraph.io = {}));
  1829. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  1830. })(com || (com = {}));
  1831. (function (com) {
  1832. var mxgraph;
  1833. (function (mxgraph) {
  1834. var io;
  1835. (function (io) {
  1836. var vsdx;
  1837. (function (vsdx) {
  1838. var geometry;
  1839. (function (geometry) {
  1840. var Row = (function () {
  1841. function Row(index, x, y) {
  1842. this.x = null;
  1843. this.y = null;
  1844. this.a = null;
  1845. this.b = null;
  1846. this.c = null;
  1847. this.d = null;
  1848. this.formulaA = null;
  1849. this.formulaE = null;
  1850. this.index = 0;
  1851. this.index = index;
  1852. this.x = x;
  1853. this.y = y;
  1854. }
  1855. Row.prototype.getX = function () {
  1856. return this.x;
  1857. };
  1858. Row.prototype.getY = function () {
  1859. return this.y;
  1860. };
  1861. Row.prototype.getA = function () {
  1862. return this.a;
  1863. };
  1864. Row.prototype.getB = function () {
  1865. return this.b;
  1866. };
  1867. Row.prototype.getC = function () {
  1868. return this.c;
  1869. };
  1870. Row.prototype.getD = function () {
  1871. return this.d;
  1872. };
  1873. Row.prototype.getFormulaA = function () {
  1874. return this.formulaA;
  1875. };
  1876. Row.prototype.getFormulaE = function () {
  1877. return this.formulaE;
  1878. };
  1879. Row.prototype.getIndex = function () {
  1880. return this.index;
  1881. };
  1882. return Row;
  1883. }());
  1884. geometry.Row = Row;
  1885. Row["__class"] = "com.mxgraph.io.vsdx.geometry.Row";
  1886. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  1887. })(vsdx = io.vsdx || (io.vsdx = {}));
  1888. })(io = mxgraph.io || (mxgraph.io = {}));
  1889. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  1890. })(com || (com = {}));
  1891. (function (com) {
  1892. var mxgraph;
  1893. (function (mxgraph) {
  1894. var io;
  1895. (function (io) {
  1896. var vsdx;
  1897. (function (vsdx) {
  1898. var geometry;
  1899. (function (geometry) {
  1900. var RowFactory = (function () {
  1901. function RowFactory() {
  1902. }
  1903. /*private*/ RowFactory.getIndex = function (elem) {
  1904. try {
  1905. return parseInt(elem.getAttribute("IX")) || 1;
  1906. }
  1907. catch (e) {
  1908. return 1;
  1909. }
  1910. ;
  1911. };
  1912. /*private*/ RowFactory.getDoubleVal = function (val) {
  1913. try {
  1914. if (val != null && !(val.length === 0)) {
  1915. var fVal = parseFloat(val);
  1916. if (isFinite(fVal))
  1917. return fVal;
  1918. }
  1919. }
  1920. catch (e) {
  1921. }
  1922. ;
  1923. return null;
  1924. };
  1925. RowFactory.getRowObj = function (elem, pRows) {
  1926. var rowType = elem.getAttribute("T");
  1927. var index = RowFactory.getIndex(elem);
  1928. var del = elem.getAttribute("Del");
  1929. if (!(function (o1, o2) { if (o1 && o1.equals) {
  1930. return o1.equals(o2);
  1931. }
  1932. else {
  1933. return o1 === o2;
  1934. } })(del, "1")) {
  1935. var parentObj = null;
  1936. if (index <= pRows.length) {
  1937. parentObj = pRows[index - 1];
  1938. }
  1939. var x = null;
  1940. var y = null;
  1941. var a = null;
  1942. var b = null;
  1943. var c = null;
  1944. var d = null;
  1945. var formulaE = null;
  1946. var formulaA = null;
  1947. if (parentObj != null) {
  1948. x = parentObj.x;
  1949. y = parentObj.y;
  1950. a = parentObj.getA();
  1951. b = parentObj.getB();
  1952. c = parentObj.getC();
  1953. d = parentObj.getD();
  1954. formulaA = parentObj.getFormulaA();
  1955. formulaE = parentObj.getFormulaE();
  1956. }
  1957. var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(elem);
  1958. for (var index121 = 0; index121 < cells.length; index121++) {
  1959. var cell = cells[index121];
  1960. {
  1961. var name_1 = cell.getAttribute("N");
  1962. var val = cell.getAttribute("V");
  1963. switch ((name_1)) {
  1964. case "X":
  1965. x = RowFactory.getDoubleVal(val);
  1966. break;
  1967. case "Y":
  1968. y = RowFactory.getDoubleVal(val);
  1969. break;
  1970. case "A":
  1971. a = RowFactory.getDoubleVal(val);
  1972. formulaA = cell.getAttribute("V");
  1973. break;
  1974. case "B":
  1975. b = RowFactory.getDoubleVal(val);
  1976. break;
  1977. case "C":
  1978. c = RowFactory.getDoubleVal(val);
  1979. break;
  1980. case "D":
  1981. d = RowFactory.getDoubleVal(val);
  1982. break;
  1983. case "E":
  1984. formulaE = val;
  1985. break;
  1986. }
  1987. }
  1988. }
  1989. switch ((rowType)) {
  1990. case "MoveTo":
  1991. return new com.mxgraph.io.vsdx.geometry.MoveTo(index, x, y);
  1992. case "LineTo":
  1993. return new com.mxgraph.io.vsdx.geometry.LineTo(index, x, y);
  1994. case "ArcTo":
  1995. return new com.mxgraph.io.vsdx.geometry.ArcTo(index, x, y, a);
  1996. case "Ellipse":
  1997. return new com.mxgraph.io.vsdx.geometry.Ellipse(index, x, y, a, b, c, d);
  1998. case "EllipticalArcTo":
  1999. return new com.mxgraph.io.vsdx.geometry.EllipticalArcTo(index, x, y, a, b, c, d);
  2000. case "InfiniteLine":
  2001. return new com.mxgraph.io.vsdx.geometry.InfiniteLine(index, x, y, a, b);
  2002. case "NURBSTo":
  2003. return new com.mxgraph.io.vsdx.geometry.NURBSTo(index, x, y, a, b, c, d, formulaE);
  2004. case "PolylineTo":
  2005. return new com.mxgraph.io.vsdx.geometry.PolylineTo(index, x, y, formulaA);
  2006. case "RelCubBezTo":
  2007. return new com.mxgraph.io.vsdx.geometry.RelCubBezTo(index, x, y, a, b, c, d);
  2008. case "RelEllipticalArcTo":
  2009. return new com.mxgraph.io.vsdx.geometry.RelEllipticalArcTo(index, x, y, a, b, c, d);
  2010. case "RelLineTo":
  2011. return new com.mxgraph.io.vsdx.geometry.RelLineTo(index, x, y);
  2012. case "RelMoveTo":
  2013. return new com.mxgraph.io.vsdx.geometry.RelMoveTo(index, x, y);
  2014. case "RelQuadBezTo":
  2015. return new com.mxgraph.io.vsdx.geometry.RelQuadBezTo(index, x, y, a, b);
  2016. case "SplineKnot":
  2017. return new com.mxgraph.io.vsdx.geometry.SplineKnot(index, x, y, a);
  2018. case "SplineStart":
  2019. return new com.mxgraph.io.vsdx.geometry.SplineStart(index, x, y, a, b, c, d);
  2020. }
  2021. }
  2022. return new com.mxgraph.io.vsdx.geometry.DelRow(index);
  2023. };
  2024. return RowFactory;
  2025. }());
  2026. geometry.RowFactory = RowFactory;
  2027. RowFactory["__class"] = "com.mxgraph.io.vsdx.geometry.RowFactory";
  2028. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  2029. })(vsdx = io.vsdx || (io.vsdx = {}));
  2030. })(io = mxgraph.io || (mxgraph.io = {}));
  2031. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  2032. })(com || (com = {}));
  2033. (function (com) {
  2034. var mxgraph;
  2035. (function (mxgraph) {
  2036. var io;
  2037. (function (io) {
  2038. var vsdx;
  2039. (function (vsdx) {
  2040. /**
  2041. * This is a singleton class that stores various global properties to document.<br/>
  2042. * The properties are:
  2043. * <ul>
  2044. * <li>
  2045. * document's colors
  2046. * </li>
  2047. * <li>
  2048. * document's fonts
  2049. * </li>
  2050. * <li>
  2051. * default text style
  2052. * </li>
  2053. * <li>
  2054. * default line style
  2055. * </li>
  2056. * <li>
  2057. * default fill style
  2058. * </li>
  2059. * </ul>
  2060. * @class
  2061. */
  2062. var mxPropertiesManager = (function () {
  2063. function mxPropertiesManager() {
  2064. /**
  2065. * Map with the document's colors.<br/>
  2066. * The key is the index number and the value is the hex representation of the color.
  2067. */
  2068. /*private*/ this.colorElementMap = ({});
  2069. /**
  2070. * Map with the document's fonts.<br/>
  2071. * The key is the ID and the value is the name of the font.
  2072. */
  2073. /*private*/ this.fontElementMap = ({});
  2074. }
  2075. mxPropertiesManager.__static_initialize = function () { if (!mxPropertiesManager.__static_initialized) {
  2076. mxPropertiesManager.__static_initialized = true;
  2077. mxPropertiesManager.__static_initializer_0();
  2078. } };
  2079. mxPropertiesManager.defaultColors_$LI$ = function () { mxPropertiesManager.__static_initialize(); if (mxPropertiesManager.defaultColors == null)
  2080. mxPropertiesManager.defaultColors = ({}); return mxPropertiesManager.defaultColors; };
  2081. ;
  2082. mxPropertiesManager.__static_initializer_0 = function () {
  2083. /* put */ (mxPropertiesManager.defaultColors_$LI$()["0"] = "#000000");
  2084. /* put */ (mxPropertiesManager.defaultColors_$LI$()["1"] = "#FFFFFF");
  2085. /* put */ (mxPropertiesManager.defaultColors_$LI$()["2"] = "#FF0000");
  2086. /* put */ (mxPropertiesManager.defaultColors_$LI$()["3"] = "#00FF00");
  2087. /* put */ (mxPropertiesManager.defaultColors_$LI$()["4"] = "#0000FF");
  2088. /* put */ (mxPropertiesManager.defaultColors_$LI$()["5"] = "#FFFF00");
  2089. /* put */ (mxPropertiesManager.defaultColors_$LI$()["6"] = "#FF00FF");
  2090. /* put */ (mxPropertiesManager.defaultColors_$LI$()["7"] = "#00FFFF");
  2091. /* put */ (mxPropertiesManager.defaultColors_$LI$()["8"] = "#800000");
  2092. /* put */ (mxPropertiesManager.defaultColors_$LI$()["9"] = "#008000");
  2093. /* put */ (mxPropertiesManager.defaultColors_$LI$()["10"] = "#000080");
  2094. /* put */ (mxPropertiesManager.defaultColors_$LI$()["11"] = "#808000");
  2095. /* put */ (mxPropertiesManager.defaultColors_$LI$()["12"] = "#800080");
  2096. /* put */ (mxPropertiesManager.defaultColors_$LI$()["13"] = "#008080");
  2097. /* put */ (mxPropertiesManager.defaultColors_$LI$()["14"] = "#C0C0C0");
  2098. /* put */ (mxPropertiesManager.defaultColors_$LI$()["15"] = "#E6E6E6");
  2099. /* put */ (mxPropertiesManager.defaultColors_$LI$()["16"] = "#CDCDCD");
  2100. /* put */ (mxPropertiesManager.defaultColors_$LI$()["17"] = "#B3B3B3");
  2101. /* put */ (mxPropertiesManager.defaultColors_$LI$()["18"] = "#9A9A9A");
  2102. /* put */ (mxPropertiesManager.defaultColors_$LI$()["19"] = "#808080");
  2103. /* put */ (mxPropertiesManager.defaultColors_$LI$()["20"] = "#666666");
  2104. /* put */ (mxPropertiesManager.defaultColors_$LI$()["21"] = "#4D4D4D");
  2105. /* put */ (mxPropertiesManager.defaultColors_$LI$()["22"] = "#333333");
  2106. /* put */ (mxPropertiesManager.defaultColors_$LI$()["23"] = "#1A1A1A");
  2107. };
  2108. /**
  2109. * Loads the properties of the document.
  2110. * @param doc Document with the properties.
  2111. * @param {*} elem
  2112. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  2113. */
  2114. mxPropertiesManager.prototype.initialise = function (elem, model) {
  2115. if (elem != null) {
  2116. var vdxColors = elem.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.COLORS);
  2117. if (vdxColors.length > 0) {
  2118. var colors = vdxColors.item(0);
  2119. var colorList = colors.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.COLOR_ENTRY);
  2120. var colorLength = colorList.length;
  2121. for (var i = 0; i < colorLength; i++) {
  2122. var color = colorList.item(i);
  2123. var colorId = color.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.INDEX);
  2124. var colorValue = color.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.RGB);
  2125. /* put */ (this.colorElementMap[colorId] = colorValue);
  2126. }
  2127. ;
  2128. }
  2129. var vdxFonts = elem.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.FACE_NAMES);
  2130. if (vdxFonts.length > 0) {
  2131. var fonts = vdxFonts.item(0);
  2132. var fontList = fonts.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.FACE_NAME);
  2133. var fontLength = fontList.length;
  2134. for (var i = 0; i < fontLength; i++) {
  2135. var font = fontList.item(i);
  2136. var fontId = font.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID);
  2137. var fontValue = font.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FONT_NAME);
  2138. /* put */ (this.fontElementMap[fontId] = fontValue);
  2139. }
  2140. ;
  2141. }
  2142. }
  2143. };
  2144. /**
  2145. * Returns the color of index indicated in 'ix'.
  2146. * @param {string} ix Index of the color.
  2147. * @return {string} Hexadecimal representation of the color.
  2148. */
  2149. mxPropertiesManager.prototype.getColor = function (ix) {
  2150. var color = (function (m, k) { return m[k] ? m[k] : null; })(this.colorElementMap, ix);
  2151. if (color == null) {
  2152. color = (function (m, k) { return m[k] ? m[k] : null; })(mxPropertiesManager.defaultColors_$LI$(), ix);
  2153. if (color == null) {
  2154. return "";
  2155. }
  2156. }
  2157. return color;
  2158. };
  2159. /**
  2160. * Returns the font of id indicated in 'id'
  2161. * @param {string} id font's ID
  2162. * @return {string} Name of the font.
  2163. */
  2164. mxPropertiesManager.prototype.getFont = function (id) {
  2165. var font = (function (m, k) { return m[k] ? m[k] : null; })(this.fontElementMap, id);
  2166. if (font == null) {
  2167. return "";
  2168. }
  2169. else {
  2170. return font;
  2171. }
  2172. };
  2173. return mxPropertiesManager;
  2174. }());
  2175. mxPropertiesManager.__static_initialized = false;
  2176. vsdx.mxPropertiesManager = mxPropertiesManager;
  2177. mxPropertiesManager["__class"] = "com.mxgraph.io.vsdx.mxPropertiesManager";
  2178. })(vsdx = io.vsdx || (io.vsdx = {}));
  2179. })(io = mxgraph.io || (mxgraph.io = {}));
  2180. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  2181. })(com || (com = {}));
  2182. (function (com) {
  2183. var mxgraph;
  2184. (function (mxgraph) {
  2185. var io;
  2186. (function (io) {
  2187. var vsdx;
  2188. (function (vsdx) {
  2189. /**
  2190. * Wrapper for connect element
  2191. * See https://msdn.microsoft.com/en-us/library/office/ff768299%28v=office.14%29.aspx
  2192. * @param {*} connectElem
  2193. * @class
  2194. */
  2195. var mxVsdxConnect = (function () {
  2196. function mxVsdxConnect(connectElem) {
  2197. /**
  2198. * ID of edge
  2199. */
  2200. this.fromSheet = null;
  2201. /**
  2202. * ID of source
  2203. */
  2204. this.sourceToSheet = null;
  2205. /**
  2206. * Where connection is made to source
  2207. */
  2208. this.sourceToPart = -1;
  2209. /**
  2210. * ID of target
  2211. */
  2212. this.targetToSheet = null;
  2213. /**
  2214. * Where connection is made to target
  2215. */
  2216. this.targetToPart = -1;
  2217. this.fromCell = null;
  2218. this.endShape = null;
  2219. var fromSheet = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FROM_SHEET);
  2220. this.fromSheet = (fromSheet != null && !(fromSheet.length === 0)) ? parseFloat(fromSheet) : -1;
  2221. var fromCell = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FROM_CELL);
  2222. this.addFromCell(connectElem, fromCell);
  2223. }
  2224. mxVsdxConnect.prototype.addFromCell = function (connectElem, fromCell) {
  2225. var toSheet = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TO_SHEET);
  2226. var source = true;
  2227. if (fromCell != null && (function (o1, o2) { if (o1 && o1.equals) {
  2228. return o1.equals(o2);
  2229. }
  2230. else {
  2231. return o1 === o2;
  2232. } })(fromCell, com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_X)) {
  2233. this.sourceToSheet = (toSheet != null && !(toSheet.length === 0)) ? parseFloat(toSheet) : -1;
  2234. source = true;
  2235. }
  2236. else if (fromCell != null && (function (o1, o2) { if (o1 && o1.equals) {
  2237. return o1.equals(o2);
  2238. }
  2239. else {
  2240. return o1 === o2;
  2241. } })(fromCell, com.mxgraph.io.vsdx.mxVsdxConstants.END_X)) {
  2242. this.targetToSheet = (toSheet != null && !(toSheet.length === 0)) ? parseFloat(toSheet) : -1;
  2243. source = false;
  2244. }
  2245. else if (this.sourceToSheet == null) {
  2246. this.sourceToSheet = (toSheet != null && !(toSheet.length === 0)) ? parseFloat(toSheet) : -1;
  2247. source = true;
  2248. }
  2249. else if (this.targetToSheet == null) {
  2250. this.targetToSheet = (toSheet != null && !(toSheet.length === 0)) ? parseFloat(toSheet) : -1;
  2251. source = false;
  2252. }
  2253. this.findToPart(connectElem, source);
  2254. };
  2255. mxVsdxConnect.prototype.findToPart = function (connectElem, source) {
  2256. var toPartString = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TO_PART);
  2257. var toPart = (toPartString != null && !(toPartString.length === 0)) ? parseFloat(toPartString) : -1;
  2258. if (source) {
  2259. this.sourceToPart = toPart;
  2260. }
  2261. else {
  2262. this.targetToPart = toPart;
  2263. }
  2264. };
  2265. mxVsdxConnect.prototype.getFromSheet = function () {
  2266. return this.fromSheet;
  2267. };
  2268. mxVsdxConnect.prototype.getSourceToSheet = function () {
  2269. return this.sourceToSheet;
  2270. };
  2271. mxVsdxConnect.prototype.getTargetToSheet = function () {
  2272. return this.targetToSheet;
  2273. };
  2274. mxVsdxConnect.prototype.getSourceToPart = function () {
  2275. return this.sourceToPart;
  2276. };
  2277. mxVsdxConnect.prototype.getTargetToPart = function () {
  2278. return this.targetToPart;
  2279. };
  2280. /**
  2281. *
  2282. * @param {*} connectElem
  2283. */
  2284. mxVsdxConnect.prototype.addConnect = function (connectElem) {
  2285. this.endShape = connectElem;
  2286. var fromCell = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FROM_CELL);
  2287. this.addFromCell(connectElem, fromCell);
  2288. };
  2289. return mxVsdxConnect;
  2290. }());
  2291. vsdx.mxVsdxConnect = mxVsdxConnect;
  2292. mxVsdxConnect["__class"] = "com.mxgraph.io.vsdx.mxVsdxConnect";
  2293. })(vsdx = io.vsdx || (io.vsdx = {}));
  2294. })(io = mxgraph.io || (mxgraph.io = {}));
  2295. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  2296. })(com || (com = {}));
  2297. (function (com) {
  2298. var mxgraph;
  2299. (function (mxgraph) {
  2300. var io;
  2301. (function (io) {
  2302. var vsdx;
  2303. (function (vsdx) {
  2304. /**
  2305. * This class contains constants used in the Import of .vdx documents.
  2306. * @class
  2307. */
  2308. var mxVsdxConstants = (function () {
  2309. function mxVsdxConstants() {
  2310. }
  2311. mxVsdxConstants.SET_VALUES_$LI$ = function () { if (mxVsdxConstants.SET_VALUES == null)
  2312. mxVsdxConstants.SET_VALUES = ["a", "b"]; return mxVsdxConstants.SET_VALUES; };
  2313. ;
  2314. mxVsdxConstants.MY_SET_$LI$ = function () { if (mxVsdxConstants.MY_SET == null)
  2315. mxVsdxConstants.MY_SET = (mxVsdxConstants.SET_VALUES_$LI$().slice(0).slice(0)); return mxVsdxConstants.MY_SET; };
  2316. ;
  2317. return mxVsdxConstants;
  2318. }());
  2319. mxVsdxConstants.ANGLE = "Angle";
  2320. mxVsdxConstants.ARC_TO = "ArcTo";
  2321. mxVsdxConstants.BACKGROUND = "Background";
  2322. mxVsdxConstants.BACK_PAGE = "BackPage";
  2323. mxVsdxConstants.BEGIN_ARROW = "BeginArrow";
  2324. mxVsdxConstants.BEGIN_ARROW_SIZE = "BeginArrowSize";
  2325. mxVsdxConstants.BEGIN_X = "BeginX";
  2326. mxVsdxConstants.BEGIN_Y = "BeginY";
  2327. mxVsdxConstants.BOTTOM_MARGIN = "BottomMargin";
  2328. mxVsdxConstants.BULLET = "Bullet";
  2329. mxVsdxConstants.CASE = "Case";
  2330. mxVsdxConstants.CHARACTER = "Character";
  2331. mxVsdxConstants.COLOR = "Color";
  2332. mxVsdxConstants.COLOR_ENTRY = "ColorEntry";
  2333. mxVsdxConstants.COLORS = "Colors";
  2334. /**
  2335. * Specifies the color transparency used for characters in a text run.
  2336. * The value is normalized such that a value of 1 corresponds to 100 percent.
  2337. * A value of zero specifies that the color is completely opaque;
  2338. * a value of one specifies that the color is completely transparent.
  2339. */
  2340. mxVsdxConstants.COLOR_TRANS = "ColorTrans";
  2341. mxVsdxConstants.CONNECT = "Connect";
  2342. mxVsdxConstants.CONNECTS = "Connects";
  2343. mxVsdxConstants.CONNECTION = "Connection";
  2344. mxVsdxConstants.CONTROL = "Control";
  2345. mxVsdxConstants.DELETED = "Del";
  2346. mxVsdxConstants.DOCUMENT_SHEET = "DocumentSheet";
  2347. mxVsdxConstants.ELLIPSE = "Ellipse";
  2348. mxVsdxConstants.ELLIPTICAL_ARC_TO = "EllipticalArcTo";
  2349. mxVsdxConstants.END_ARROW = "EndArrow";
  2350. mxVsdxConstants.END_ARROW_SIZE = "EndArrowSize";
  2351. mxVsdxConstants.END_X = "EndX";
  2352. mxVsdxConstants.END_Y = "EndY";
  2353. mxVsdxConstants.FACE_NAME = "FaceName";
  2354. mxVsdxConstants.FACE_NAMES = "FaceNames";
  2355. mxVsdxConstants.FALSE = "0";
  2356. mxVsdxConstants.FILL = "Fill";
  2357. mxVsdxConstants.FILL_BKGND = "FillBkgnd";
  2358. mxVsdxConstants.FILL_BKGND_TRANS = "FillBkgndTrans";
  2359. mxVsdxConstants.FILL_FOREGND = "FillForegnd";
  2360. mxVsdxConstants.FILL_FOREGND_TRANS = "FillForegndTrans";
  2361. mxVsdxConstants.FILL_PATTERN = "FillPattern";
  2362. mxVsdxConstants.FILL_STYLE = "FillStyle";
  2363. mxVsdxConstants.FILL_GRADIENT_ENABLED = "FillGradientEnabled";
  2364. mxVsdxConstants.FLAGS = "Flags";
  2365. mxVsdxConstants.FLIP_X = "FlipX";
  2366. mxVsdxConstants.FLIP_Y = "FlipY";
  2367. mxVsdxConstants.FONT = "Font";
  2368. mxVsdxConstants.FONT_NAME = "Name";
  2369. mxVsdxConstants.FOREIGN = "Foreign";
  2370. mxVsdxConstants.FROM_CELL = "FromCell";
  2371. mxVsdxConstants.FROM_SHEET = "FromSheet";
  2372. mxVsdxConstants.GEOM = "Geom";
  2373. mxVsdxConstants.HEIGHT = "Height";
  2374. mxVsdxConstants.HORIZONTAL_ALIGN = "HorzAlign";
  2375. mxVsdxConstants.ID = "ID";
  2376. mxVsdxConstants.INDENT_FIRST = "IndFirst";
  2377. mxVsdxConstants.INDENT_LEFT = "IndLeft";
  2378. mxVsdxConstants.INDENT_RIGHT = "IndRight";
  2379. mxVsdxConstants.INDEX = "IX";
  2380. mxVsdxConstants.LEFT_MARGIN = "LeftMargin";
  2381. mxVsdxConstants.LETTER_SPACE = "Letterspace";
  2382. mxVsdxConstants.LINE = "Line";
  2383. mxVsdxConstants.LINE_COLOR = "LineColor";
  2384. mxVsdxConstants.LINE_COLOR_TRANS = "LineColorTrans";
  2385. mxVsdxConstants.LINE_PATTERN = "LinePattern";
  2386. mxVsdxConstants.LINE_STYLE = "LineStyle";
  2387. mxVsdxConstants.LINE_TO = "LineTo";
  2388. mxVsdxConstants.LINE_WEIGHT = "LineWeight";
  2389. mxVsdxConstants.LOC_PIN_X = "LocPinX";
  2390. mxVsdxConstants.LOC_PIN_Y = "LocPinY";
  2391. mxVsdxConstants.MASTER = "Master";
  2392. mxVsdxConstants.MASTER_SHAPE = "MasterShape";
  2393. mxVsdxConstants.MASTERS = "Masters";
  2394. mxVsdxConstants.MOVE_TO = "MoveTo";
  2395. mxVsdxConstants.NAME = "Name";
  2396. mxVsdxConstants.NAME_U = "NameU";
  2397. mxVsdxConstants.NO_LINE = "NoLine";
  2398. mxVsdxConstants.NURBS_TO = "NURBSTo";
  2399. mxVsdxConstants.PAGE = "Page";
  2400. mxVsdxConstants.PAGE_HEIGHT = "PageHeight";
  2401. mxVsdxConstants.PAGE_WIDTH = "PageWidth";
  2402. mxVsdxConstants.PAGES = "Pages";
  2403. mxVsdxConstants.PARAGRAPH = "Paragraph";
  2404. mxVsdxConstants.PIN_X = "PinX";
  2405. mxVsdxConstants.PIN_Y = "PinY";
  2406. mxVsdxConstants.POS = "Pos";
  2407. mxVsdxConstants.RGB = "RGB";
  2408. mxVsdxConstants.RIGHT_MARGIN = "RightMargin";
  2409. mxVsdxConstants.ROUNDING = "Rounding";
  2410. mxVsdxConstants.RTL_TEXT = "RTLText";
  2411. mxVsdxConstants.SIZE = "Size";
  2412. mxVsdxConstants.SHAPE = "Shape";
  2413. mxVsdxConstants.SHAPES = "Shapes";
  2414. mxVsdxConstants.SHAPE_SHDW_SHOW = "ShapeShdwShow";
  2415. mxVsdxConstants.SHDW_PATTERN = "ShdwPattern";
  2416. mxVsdxConstants.SPACE_AFTER = "SpAfter";
  2417. mxVsdxConstants.SPACE_BEFORE = "SpBefore";
  2418. mxVsdxConstants.SPACE_LINE = "SpLine";
  2419. mxVsdxConstants.STRIKETHRU = "Strikethru";
  2420. mxVsdxConstants.STYLE = "Style";
  2421. mxVsdxConstants.STYLE_SHEET = "StyleSheet";
  2422. mxVsdxConstants.STYLE_SHEETS = "StyleSheets";
  2423. mxVsdxConstants.TEXT = "Text";
  2424. mxVsdxConstants.TEXT_BKGND = "TextBkgnd";
  2425. mxVsdxConstants.TEXT_BLOCK = "TextBlock";
  2426. mxVsdxConstants.TEXT_STYLE = "TextStyle";
  2427. mxVsdxConstants.TO_PART = "ToPart";
  2428. mxVsdxConstants.TO_SHEET = "ToSheet";
  2429. mxVsdxConstants.TOP_MARGIN = "TopMargin";
  2430. mxVsdxConstants.TRUE = "1";
  2431. mxVsdxConstants.TXT_ANGLE = "TxtAngle";
  2432. mxVsdxConstants.TXT_HEIGHT = "TxtHeight";
  2433. mxVsdxConstants.TXT_LOC_PIN_X = "TxtLocPinX";
  2434. mxVsdxConstants.TXT_LOC_PIN_Y = "TxtLocPinY";
  2435. mxVsdxConstants.TXT_PIN_X = "TxtPinX";
  2436. mxVsdxConstants.TXT_PIN_Y = "TxtPinY";
  2437. mxVsdxConstants.TXT_WIDTH = "TxtWidth";
  2438. mxVsdxConstants.TYPE = "Type";
  2439. mxVsdxConstants.TYPE_GROUP = "Group";
  2440. mxVsdxConstants.TYPE_SHAPE = "Shape";
  2441. mxVsdxConstants.UNIQUE_ID = "UniqueID";
  2442. mxVsdxConstants.VERTICAL_ALIGN = "VerticalAlign";
  2443. mxVsdxConstants.WIDTH = "Width";
  2444. mxVsdxConstants.X_CON = "XCon";
  2445. mxVsdxConstants.X_DYN = "XDyn";
  2446. mxVsdxConstants.X = "X";
  2447. mxVsdxConstants.Y_CON = "YCon";
  2448. mxVsdxConstants.Y_DYN = "YDyn";
  2449. mxVsdxConstants.Y = "Y";
  2450. mxVsdxConstants.HIDE_TEXT = "HideText";
  2451. mxVsdxConstants.VSDX_ID = "vsdxID";
  2452. mxVsdxConstants.CONNECT_TO_PART_WHOLE_SHAPE = 3;
  2453. vsdx.mxVsdxConstants = mxVsdxConstants;
  2454. mxVsdxConstants["__class"] = "com.mxgraph.io.vsdx.mxVsdxConstants";
  2455. })(vsdx = io.vsdx || (io.vsdx = {}));
  2456. })(io = mxgraph.io || (mxgraph.io = {}));
  2457. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  2458. })(com || (com = {}));
  2459. (function (com) {
  2460. var mxgraph;
  2461. (function (mxgraph) {
  2462. var io;
  2463. (function (io) {
  2464. var vsdx;
  2465. (function (vsdx) {
  2466. var mxVsdxGeometry = (function () {
  2467. function mxVsdxGeometry(elem, parentGeo) {
  2468. var _this = this;
  2469. /*private*/ this.noFill = false;
  2470. /*private*/ this.noLine = false;
  2471. /*private*/ this.noShow = false;
  2472. /*private*/ this.noSnap = false;
  2473. /*private*/ this.noQuickDrag = false;
  2474. /*private*/ this.rows = null;
  2475. if (((elem != null && elem.nodeType == 1) || elem === null) && ((parentGeo != null && (parentGeo instanceof Array)) || parentGeo === null)) {
  2476. var __args = Array.prototype.slice.call(arguments);
  2477. this.index = 0;
  2478. this.noFill = false;
  2479. this.noLine = false;
  2480. this.noShow = false;
  2481. this.noSnap = false;
  2482. this.noQuickDrag = false;
  2483. this.rows = null;
  2484. this.index = 0;
  2485. (function () {
  2486. _this.index = _this.getIndex$org_w3c_dom_Element(elem);
  2487. if (parentGeo != null && _this.index < parentGeo.length) {
  2488. _this.inheritGeo(/* get */ parentGeo[_this.index]);
  2489. }
  2490. _this.processGeoElem(elem);
  2491. })();
  2492. }
  2493. else if (((elem != null && (elem.nodeType == 1)) || elem === null) && parentGeo === undefined) {
  2494. var __args = Array.prototype.slice.call(arguments);
  2495. this.index = 0;
  2496. this.noFill = false;
  2497. this.noLine = false;
  2498. this.noShow = false;
  2499. this.noSnap = false;
  2500. this.noQuickDrag = false;
  2501. this.rows = null;
  2502. this.index = 0;
  2503. (function () {
  2504. _this.index = _this.getIndex$org_w3c_dom_Element(elem);
  2505. _this.processGeoElem(elem);
  2506. })();
  2507. }
  2508. else
  2509. throw new Error('invalid overload');
  2510. }
  2511. mxVsdxGeometry.prototype.getIndex$org_w3c_dom_Element = function (elem) {
  2512. try {
  2513. return parseInt(elem.getAttribute("IX")) || 0;
  2514. }
  2515. catch (e) {
  2516. return 0;
  2517. }
  2518. ;
  2519. };
  2520. mxVsdxGeometry.prototype.getIndex = function (elem) {
  2521. if (((elem != null && (elem.nodeType == 1)) || elem === null)) {
  2522. return this.getIndex$org_w3c_dom_Element(elem);
  2523. }
  2524. else if (elem === undefined) {
  2525. return this.getIndex$();
  2526. }
  2527. else
  2528. throw new Error('invalid overload');
  2529. };
  2530. /*private*/ mxVsdxGeometry.prototype.processGeoElem = function (elem) {
  2531. var cellElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(elem, "Cell");
  2532. var rowElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(elem, "Row");
  2533. if (this.rows == null) {
  2534. this.rows = ([]);
  2535. for (var i = 0; i < rowElems.length; i++) {
  2536. /* add */ (this.rows.push(null));
  2537. }
  2538. ;
  2539. }
  2540. for (var index122 = 0; index122 < cellElems.length; index122++) {
  2541. var cellElem = cellElems[index122];
  2542. {
  2543. var name_2 = cellElem.getAttribute("N");
  2544. var val = cellElem.getAttribute("V");
  2545. switch ((name_2)) {
  2546. case "NoFill":
  2547. this.noFill = (function (o1, o2) { if (o1 && o1.equals) {
  2548. return o1.equals(o2);
  2549. }
  2550. else {
  2551. return o1 === o2;
  2552. } })("1", val);
  2553. break;
  2554. case "NoLine":
  2555. this.noLine = (function (o1, o2) { if (o1 && o1.equals) {
  2556. return o1.equals(o2);
  2557. }
  2558. else {
  2559. return o1 === o2;
  2560. } })("1", val);
  2561. break;
  2562. case "NoShow":
  2563. this.noShow = (function (o1, o2) { if (o1 && o1.equals) {
  2564. return o1.equals(o2);
  2565. }
  2566. else {
  2567. return o1 === o2;
  2568. } })("1", val);
  2569. break;
  2570. case "NoSnap":
  2571. this.noSnap = (function (o1, o2) { if (o1 && o1.equals) {
  2572. return o1.equals(o2);
  2573. }
  2574. else {
  2575. return o1 === o2;
  2576. } })("1", val);
  2577. break;
  2578. case "NoQuickDrag":
  2579. this.noQuickDrag = (function (o1, o2) { if (o1 && o1.equals) {
  2580. return o1.equals(o2);
  2581. }
  2582. else {
  2583. return o1 === o2;
  2584. } })("1", val);
  2585. break;
  2586. }
  2587. }
  2588. }
  2589. var rowsLen = this.rows.length;
  2590. var sortNeeded = false;
  2591. for (var index123 = 0; index123 < rowElems.length; index123++) {
  2592. var rowElem = rowElems[index123];
  2593. {
  2594. var row = com.mxgraph.io.vsdx.geometry.RowFactory.getRowObj(rowElem, this.rows);
  2595. if (row.getIndex() > rowsLen) {
  2596. /* add */ (this.rows.push(row));
  2597. sortNeeded = true;
  2598. }
  2599. else {
  2600. /* set */ (this.rows[row.getIndex() - 1] = row);
  2601. }
  2602. }
  2603. }
  2604. if (sortNeeded) {
  2605. /* sort */ (function (l, c) { if (c.compare)
  2606. l.sort(function (e1, e2) { return c.compare(e1, e2); });
  2607. else
  2608. l.sort(c); })(this.rows, new mxVsdxGeometry.mxVsdxGeometry$0(this));
  2609. }
  2610. };
  2611. /*private*/ mxVsdxGeometry.prototype.inheritGeo = function (parent) {
  2612. this.noFill = parent.noFill;
  2613. this.noLine = parent.noLine;
  2614. this.noShow = parent.noShow;
  2615. this.noSnap = parent.noSnap;
  2616. this.noQuickDrag = parent.noQuickDrag;
  2617. this.rows = ([]);
  2618. /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(this.rows, parent.rows);
  2619. };
  2620. mxVsdxGeometry.prototype.getIndex$ = function () {
  2621. return this.index;
  2622. };
  2623. mxVsdxGeometry.prototype.isNoFill = function () {
  2624. return this.noFill;
  2625. };
  2626. mxVsdxGeometry.prototype.isNoLine = function () {
  2627. return this.noLine;
  2628. };
  2629. mxVsdxGeometry.prototype.isNoShow = function () {
  2630. return this.noShow;
  2631. };
  2632. mxVsdxGeometry.prototype.isNoSnap = function () {
  2633. return this.noSnap;
  2634. };
  2635. mxVsdxGeometry.prototype.isNoQuickDrag = function () {
  2636. return this.noQuickDrag;
  2637. };
  2638. mxVsdxGeometry.prototype.getRows = function () {
  2639. return this.rows;
  2640. };
  2641. mxVsdxGeometry.prototype.getPathXML = function (p, shape) {
  2642. if (this.noShow)
  2643. return "";
  2644. var geomElemParsed = { str: "", toString: function () { return this.str; } };
  2645. var _loop_1 = function (index124) {
  2646. var row = this_1.rows[index124];
  2647. {
  2648. /* append */
  2649. (function (sb)
  2650. {
  2651. //Some files has null rows
  2652. return sb.str = sb.str.concat(row != null? row.handle(p, shape) : '');
  2653. })(geomElemParsed);
  2654. }
  2655. };
  2656. var this_1 = this;
  2657. for (var index124 = 0; index124 < this.rows.length; index124++) {
  2658. _loop_1(index124);
  2659. }
  2660. return geomElemParsed.str;
  2661. };
  2662. return mxVsdxGeometry;
  2663. }());
  2664. vsdx.mxVsdxGeometry = mxVsdxGeometry;
  2665. mxVsdxGeometry["__class"] = "com.mxgraph.io.vsdx.mxVsdxGeometry";
  2666. (function (mxVsdxGeometry) {
  2667. var mxVsdxGeometry$0 = (function () {
  2668. function mxVsdxGeometry$0(__parent) {
  2669. this.__parent = __parent;
  2670. }
  2671. /**
  2672. *
  2673. * @param {com.mxgraph.io.vsdx.geometry.Row} r1
  2674. * @param {com.mxgraph.io.vsdx.geometry.Row} r2
  2675. * @return {number}
  2676. */
  2677. mxVsdxGeometry$0.prototype.compare = function (r1, r2) {
  2678. //Some files has null rows
  2679. var r1i = r1 != null? r1.getIndex() : 0;
  2680. var r2i = r2 != null? r2.getIndex() : 0;
  2681. return r1i - r2i;
  2682. };
  2683. return mxVsdxGeometry$0;
  2684. }());
  2685. mxVsdxGeometry.mxVsdxGeometry$0 = mxVsdxGeometry$0;
  2686. mxVsdxGeometry$0["__interfaces"] = ["java.util.Comparator"];
  2687. })(mxVsdxGeometry = vsdx.mxVsdxGeometry || (vsdx.mxVsdxGeometry = {}));
  2688. })(vsdx = io.vsdx || (io.vsdx = {}));
  2689. })(io = mxgraph.io || (mxgraph.io = {}));
  2690. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  2691. })(com || (com = {}));
  2692. (function (com) {
  2693. var mxgraph;
  2694. (function (mxgraph) {
  2695. var io;
  2696. (function (io) {
  2697. var vsdx;
  2698. (function (vsdx) {
  2699. var mxVsdxGeometryList = (function () {
  2700. function mxVsdxGeometryList(parentGeoList) {
  2701. /*private*/ this.geomList = ([]);
  2702. /*private*/ this.parentGeomList = null;
  2703. /*private*/ this.sortNeeded = false;
  2704. if (parentGeoList != null) {
  2705. this.parentGeomList = parentGeoList.geomList;
  2706. /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(this.geomList, parentGeoList.geomList);
  2707. }
  2708. }
  2709. mxVsdxGeometryList.prototype.addGeometry = function (geoElem) {
  2710. var geo = new com.mxgraph.io.vsdx.mxVsdxGeometry(geoElem, this.parentGeomList);
  2711. if (geo.getIndex() < this.geomList.length) {
  2712. /* set */ (this.geomList[geo.getIndex()] = geo);
  2713. }
  2714. else {
  2715. /* add */ (this.geomList.push(geo));
  2716. this.sortNeeded = true;
  2717. }
  2718. };
  2719. /*private*/ mxVsdxGeometryList.prototype.sort = function () {
  2720. if (this.sortNeeded) {
  2721. /* sort */ (function (l, c) { if (c.compare)
  2722. l.sort(function (e1, e2) { return c.compare(e1, e2); });
  2723. else
  2724. l.sort(c); })(this.geomList, new mxVsdxGeometryList.mxVsdxGeometryList$0(this));
  2725. this.sortNeeded = false;
  2726. }
  2727. };
  2728. mxVsdxGeometryList.prototype.isNoShow = function () {
  2729. for (var index125 = 0; index125 < this.geomList.length; index125++) {
  2730. var geo = this.geomList[index125];
  2731. {
  2732. if (!geo.isNoShow())
  2733. return false;
  2734. }
  2735. }
  2736. return true;
  2737. };
  2738. mxVsdxGeometryList.prototype.isNoFill = function () {
  2739. for (var index126 = 0; index126 < this.geomList.length; index126++) {
  2740. var geo = this.geomList[index126];
  2741. {
  2742. if (!(geo.isNoShow() || geo.isNoFill()))
  2743. return false;
  2744. }
  2745. }
  2746. return true;
  2747. };
  2748. mxVsdxGeometryList.prototype.isNoLine = function () {
  2749. for (var index127 = 0; index127 < this.geomList.length; index127++) {
  2750. var geo = this.geomList[index127];
  2751. {
  2752. if (!(geo.isNoShow() || geo.isNoLine()))
  2753. return false;
  2754. }
  2755. }
  2756. return true;
  2757. };
  2758. mxVsdxGeometryList.prototype.hasGeom = function () {
  2759. return !(this.geomList.length == 0);
  2760. };
  2761. mxVsdxGeometryList.prototype.getGeoCount = function () {
  2762. var count = 0;
  2763. for (var i = 0; i < this.geomList.length; i++)
  2764. {
  2765. if (!this.geomList[i].isNoShow())
  2766. count++;
  2767. }
  2768. return count;
  2769. };
  2770. /*private*/ mxVsdxGeometryList.prototype.rotatedPoint = function (pt, cos, sin) {
  2771. var x1 = pt.x * cos - pt.y * sin;
  2772. var y1 = pt.y * cos + pt.x * sin;
  2773. pt.x = (x1);
  2774. pt.y = (y1);
  2775. };
  2776. /**
  2777. * Returns the list of routing points of a edge shape.
  2778. * @param {number} parentHeight Height of the parent of the shape.
  2779. * @return {mxPoint[]} List of mxPoint that represents the routing points.
  2780. * @param {mxPoint} startPoint
  2781. * @param {number} rotation
  2782. */
  2783. mxVsdxGeometryList.prototype.getRoutingPoints = function (parentHeight, startPoint, rotation) {
  2784. this.sort();
  2785. var points = ([]);
  2786. /* add */ (points.push(startPoint.clone()));
  2787. var offsetX = 0;
  2788. var offsetY = 0;
  2789. for (var index128 = 0; index128 < this.geomList.length; index128++) {
  2790. var geo = this.geomList[index128];
  2791. {
  2792. if (!geo.isNoShow()) {
  2793. var rows = geo.getRows();
  2794. for (var index129 = 0; index129 < rows.length; index129++) {
  2795. var row = rows[index129];
  2796. {
  2797. //FIXME We don't support a moveTo inside the edge path
  2798. if (index129 == 0 && row != null && row instanceof com.mxgraph.io.vsdx.geometry.MoveTo) {
  2799. offsetX = row.x != null ? row.x : 0;
  2800. offsetY = row.y != null ? row.y : 0;
  2801. }
  2802. else if (row != null && row instanceof com.mxgraph.io.vsdx.geometry.LineTo) {
  2803. var x = row.x != null ? row.x : 0;
  2804. var y = row.y != null ? row.y : 0;
  2805. var p = new mxPoint(x, y);
  2806. if (rotation !== 0) {
  2807. rotation = (function (x) { return x * Math.PI / 180; })(360 - rotation);
  2808. this.rotatedPoint(p, Math.cos(rotation), Math.sin(rotation));
  2809. }
  2810. x = (p.x - offsetX) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  2811. x += startPoint.x;
  2812. y = ((p.y - offsetY) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$()) * -1;
  2813. y += startPoint.y;
  2814. x = Math.round(x * 100.0) / 100.0;
  2815. y = Math.round(y * 100.0) / 100.0;
  2816. p.x = (x);
  2817. p.y = (y);
  2818. /* add */ (points.push(p));
  2819. }
  2820. }
  2821. }
  2822. }
  2823. }
  2824. }
  2825. return points;
  2826. };
  2827. mxVsdxGeometryList.prototype.getShapeXML = function (shape) {
  2828. var p = new mxPoint(0, 0);
  2829. var parsedGeom = { str: "<shape strokewidth=\"inherit\"><foreground>", toString: function () { return this.str; } };
  2830. var initSize = parsedGeom.str.length;
  2831. var lastGeoStyle = -1;
  2832. lastGeoStyle = this.processGeo(shape, p, parsedGeom, lastGeoStyle, true);
  2833. lastGeoStyle = this.processGeo(shape, p, parsedGeom, lastGeoStyle, false);
  2834. if (parsedGeom.str.length === initSize) {
  2835. return "";
  2836. }
  2837. else {
  2838. this.closePath(parsedGeom, lastGeoStyle);
  2839. }
  2840. /* append */ (function (sb) { return sb.str = sb.str.concat("</foreground></shape>"); })(parsedGeom);
  2841. //If the geomertry has no move, it will cause errors in SVG. So, ignore this shape
  2842. //A path with no move in the beginning is invalid
  2843. //https://www.w3.org/TR/SVG11/paths.html#PathDataMovetoCommands
  2844. //https://stackoverflow.com/questions/56275231/do-all-svg-paths-have-to-start-with-a-move
  2845. //TODO Find a faster technique, then enable this
  2846. /*if (parsedGeom.str.indexOf('<move') < 0)
  2847. {
  2848. return '';
  2849. }*/
  2850. return parsedGeom.str;
  2851. };
  2852. /*private*/ mxVsdxGeometryList.prototype.processGeo = function (shape, p, parsedGeom, lastGeoStyle, withFill) {
  2853. var rounding = shape.getRounding();
  2854. var roundingStr = '';
  2855. if (rounding > 0)
  2856. {
  2857. roundingStr = ' rounded="1" arcSize="' + (rounding * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor) + '" ';
  2858. }
  2859. var _loop_2 = function (index130) {
  2860. var geo = this_2.geomList[index130];
  2861. {
  2862. if (withFill === geo.isNoFill())
  2863. return "continue";
  2864. var str_1 = geo.getPathXML(p, shape);
  2865. if (!(str_1.length === 0)) {
  2866. var geoStyle = this_2.getGeoStyle(geo);
  2867. if (lastGeoStyle === -1) {
  2868. /* append */ (function (sb) { return sb.str = sb.str.concat("<path" + roundingStr + ">"); })(parsedGeom);
  2869. /* append */ (function (sb) { return sb.str = sb.str.concat(str_1); })(parsedGeom);
  2870. }
  2871. else if (lastGeoStyle !== geoStyle) {
  2872. this_2.closePath(parsedGeom, lastGeoStyle);
  2873. /* append */ (function (sb) { return sb.str = sb.str.concat("<path" + roundingStr + ">"); })(parsedGeom);
  2874. /* append */ (function (sb) { return sb.str = sb.str.concat(str_1); })(parsedGeom);
  2875. }
  2876. else {
  2877. /* append */ (function (sb) { return sb.str = sb.str.concat(str_1); })(parsedGeom);
  2878. }
  2879. lastGeoStyle = geoStyle;
  2880. }
  2881. }
  2882. };
  2883. var this_2 = this;
  2884. for (var index130 = 0; index130 < this.geomList.length; index130++) {
  2885. _loop_2(index130);
  2886. }
  2887. return lastGeoStyle;
  2888. };
  2889. /*private*/ mxVsdxGeometryList.prototype.getGeoStyle = function (geo) {
  2890. var geoStyle = 0;
  2891. if (!geo.isNoLine() && !geo.isNoFill()) {
  2892. geoStyle = 1;
  2893. }
  2894. else if (!geo.isNoFill()) {
  2895. geoStyle = 2;
  2896. }
  2897. else if (!geo.isNoLine()) {
  2898. geoStyle = 3;
  2899. }
  2900. return geoStyle;
  2901. };
  2902. /*private*/ mxVsdxGeometryList.prototype.closePath = function (parsedGeom, geoStyle) {
  2903. /* append */ (function (sb) { return sb.str = sb.str.concat("</path>"); })(parsedGeom);
  2904. if (geoStyle === 1) {
  2905. /* append */ (function (sb) { return sb.str = sb.str.concat("<fillstroke/>"); })(parsedGeom);
  2906. }
  2907. else if (geoStyle === 2) {
  2908. /* append */ (function (sb) { return sb.str = sb.str.concat("<fill/>"); })(parsedGeom);
  2909. }
  2910. else if (geoStyle === 3) {
  2911. /* append */ (function (sb) { return sb.str = sb.str.concat("<stroke/>"); })(parsedGeom);
  2912. }
  2913. };
  2914. return mxVsdxGeometryList;
  2915. }());
  2916. vsdx.mxVsdxGeometryList = mxVsdxGeometryList;
  2917. mxVsdxGeometryList["__class"] = "com.mxgraph.io.vsdx.mxVsdxGeometryList";
  2918. (function (mxVsdxGeometryList) {
  2919. var mxVsdxGeometryList$0 = (function () {
  2920. function mxVsdxGeometryList$0(__parent) {
  2921. this.__parent = __parent;
  2922. }
  2923. /**
  2924. *
  2925. * @param {com.mxgraph.io.vsdx.mxVsdxGeometry} g1
  2926. * @param {com.mxgraph.io.vsdx.mxVsdxGeometry} g2
  2927. * @return {number}
  2928. */
  2929. mxVsdxGeometryList$0.prototype.compare = function (g1, g2) {
  2930. return g1.getIndex() - g2.getIndex();
  2931. };
  2932. return mxVsdxGeometryList$0;
  2933. }());
  2934. mxVsdxGeometryList.mxVsdxGeometryList$0 = mxVsdxGeometryList$0;
  2935. mxVsdxGeometryList$0["__interfaces"] = ["java.util.Comparator"];
  2936. })(mxVsdxGeometryList = vsdx.mxVsdxGeometryList || (vsdx.mxVsdxGeometryList = {}));
  2937. })(vsdx = io.vsdx || (io.vsdx = {}));
  2938. })(io = mxgraph.io || (mxgraph.io = {}));
  2939. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  2940. })(com || (com = {}));
  2941. (function (com) {
  2942. var mxgraph;
  2943. (function (mxgraph) {
  2944. var io;
  2945. (function (io) {
  2946. var vsdx;
  2947. (function (vsdx) {
  2948. /**
  2949. * Create a new instance of mxMasterElement and retrieves all the shapes contained
  2950. * in the Master element.
  2951. * @param {*} m Master Element to be wrapped.
  2952. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  2953. * @class
  2954. */
  2955. var mxVsdxMaster = (function () {
  2956. function mxVsdxMaster(m, model) {
  2957. /**
  2958. * Unique ID of the element within its parent element
  2959. */
  2960. this.Id = null;
  2961. this.masterShape = null;
  2962. this.childShapes = ({});
  2963. this.master = null;
  2964. this.master = m;
  2965. this.Id = m.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID) || "";
  2966. this.processMasterShapes(model);
  2967. }
  2968. /**
  2969. * Retrieves and wraps all the shapes contained in the 'shape' param.<br/>
  2970. * This method is recursive, it retrieves the subshapes of the shapes too.
  2971. * @param shape Shape from which the subshapes are retrieved.
  2972. * @return {void} Map with the shapes wrapped in instances of mxMasterShape.
  2973. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  2974. */
  2975. mxVsdxMaster.prototype.processMasterShapes = function (model) {
  2976. var child = this.master.firstChild;
  2977. while ((child != null)) {
  2978. if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  2979. return o1.equals(o2);
  2980. }
  2981. else {
  2982. return o1 === o2;
  2983. } })(child.nodeName, "Rel")) {
  2984. var relElem = model.getRelationship(child.getAttribute("r:id"), com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/masters/_rels/masters.xml.rels");
  2985. var target = relElem.getAttribute("Target");
  2986. var type = relElem.getAttribute("Type");
  2987. var masterDoc = null;
  2988. if (type != null && (function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(type, "master")) {
  2989. masterDoc = model.getXmlDoc(com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/masters/" + target);
  2990. }
  2991. if (masterDoc != null) {
  2992. var masterChild = masterDoc.firstChild;
  2993. while ((masterChild != null)) {
  2994. if ((masterChild != null && (masterChild.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  2995. return o1.equals(o2);
  2996. }
  2997. else {
  2998. return o1 === o2;
  2999. } })(masterChild.nodeName, "MasterContents")) {
  3000. this.processMasterShape(masterChild, model);
  3001. break;
  3002. }
  3003. masterChild = masterChild.nextSibling;
  3004. }
  3005. ;
  3006. }
  3007. }
  3008. else if (child.nodeType == 1 && child.nodeName == "PageSheet")
  3009. {
  3010. this.pageSheet = {};
  3011. var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(child, "Cell");
  3012. for (var i = 0; i < cells.length; i++)
  3013. {
  3014. this.pageSheet[cells[i].getAttribute("N")] = cells[i];
  3015. }
  3016. }
  3017. child = child.nextSibling;
  3018. }
  3019. ;
  3020. };
  3021. /**
  3022. * Retrieves and wraps all the shapes contained in the 'shape' param.<br/>
  3023. * This method is recursive, it retrieves the subshapes of the shapes too.
  3024. * @param shape Shape from which the subshapes are retrieved.
  3025. * @return {void} Map with the shapes wrapped in instances of mxMasterShape.
  3026. * @param {*} shapeElem
  3027. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  3028. */
  3029. mxVsdxMaster.prototype.processMasterShape = function (shapeElem, model, internal)
  3030. {
  3031. if (!internal)
  3032. {
  3033. this.firstLevelShapes = [];
  3034. }
  3035. var shapeChild = shapeElem.firstChild;
  3036. while ((shapeChild != null)) {
  3037. if ((shapeChild != null && (shapeChild.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  3038. return o1.equals(o2);
  3039. }
  3040. else {
  3041. return o1 === o2;
  3042. } })(shapeChild.nodeName, "Shapes")) {
  3043. var shapesChild = shapeChild.firstChild;
  3044. while ((shapesChild != null)) {
  3045. if ((shapesChild != null && (shapesChild.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  3046. return o1.equals(o2);
  3047. }
  3048. else {
  3049. return o1 === o2;
  3050. } })(shapesChild.nodeName, "Shape")) {
  3051. var shape = shapesChild;
  3052. var shapeId = shape.getAttribute("ID");
  3053. var masterShape = new com.mxgraph.io.vsdx.Shape(shape, model);
  3054. this.masterShape = (this.masterShape == null) ? masterShape : this.masterShape;
  3055. /* put */ (this.childShapes[shapeId] = masterShape);
  3056. if (!internal)
  3057. {
  3058. this.firstLevelShapes.push(masterShape);
  3059. }
  3060. this.processMasterShape(shape, model, true);
  3061. }
  3062. shapesChild = shapesChild.nextSibling;
  3063. }
  3064. ;
  3065. }
  3066. else if (shapeChild != null && shapeChild.nodeType == 1 && shapeChild.nodeName == "Connects")
  3067. {
  3068. this.connects = {};
  3069. var connectsChild = shapeChild.firstChild;
  3070. while (connectsChild != null)
  3071. {
  3072. if (connectsChild != null && connectsChild.nodeType == 1 && connectsChild.nodeName == "Connect")
  3073. {
  3074. var connectElem = connectsChild;
  3075. var connect = new com.mxgraph.io.vsdx.mxVsdxConnect(connectElem);
  3076. this.connects[connect.getFromSheet()] = connect;
  3077. }
  3078. connectsChild = connectsChild.nextSibling;
  3079. }
  3080. }
  3081. shapeChild = shapeChild.nextSibling;
  3082. }
  3083. ;
  3084. };
  3085. /**
  3086. * Returns the first shape in the Master
  3087. * @return {com.mxgraph.io.vsdx.Shape} First shape in the Master wrapped in a instance of mxMasterShape
  3088. */
  3089. mxVsdxMaster.prototype.getMasterShape = function () {
  3090. return this.masterShape;
  3091. };
  3092. /**
  3093. * Returns the shape in the master element with ID = 'id'.
  3094. * @param {string} id Shape's ID
  3095. * @return {com.mxgraph.io.vsdx.Shape} The shape in the master element with ID = 'id' wrapped in a instance of mxMasterShape
  3096. */
  3097. mxVsdxMaster.prototype.getSubShape = function (id) {
  3098. return (function (m, k) { return m[k] ? m[k] : null; })(this.childShapes, id);
  3099. };
  3100. /**
  3101. * Returns the NameU attribute.
  3102. * @return {string} Value of the NameU attribute.
  3103. */
  3104. mxVsdxMaster.prototype.getNameU = function () {
  3105. return this.master.getAttribute("NameU") || "";
  3106. };
  3107. /**
  3108. * Returns the NameU attribute.
  3109. * @return {string} Value of the NameU attribute.
  3110. */
  3111. mxVsdxMaster.prototype.getName = function () {
  3112. return this.master.getAttribute("Name") || "";
  3113. };
  3114. /**
  3115. * Returns the UniqueID attribute.
  3116. * @return {string} Value of the UniqueID attribute.
  3117. */
  3118. mxVsdxMaster.prototype.getUniqueID = function () {
  3119. var uniqueID = "";
  3120. if (this.master.hasAttribute("UniqueID")) {
  3121. uniqueID = this.master.getAttribute("UniqueID");
  3122. }
  3123. return uniqueID;
  3124. };
  3125. mxVsdxMaster.prototype.getId = function () {
  3126. return this.Id;
  3127. };
  3128. mxVsdxMaster.prototype.getMasterElement = function () {
  3129. return this.master;
  3130. };
  3131. return mxVsdxMaster;
  3132. }());
  3133. vsdx.mxVsdxMaster = mxVsdxMaster;
  3134. mxVsdxMaster["__class"] = "com.mxgraph.io.vsdx.mxVsdxMaster";
  3135. })(vsdx = io.vsdx || (io.vsdx = {}));
  3136. })(io = mxgraph.io || (mxgraph.io = {}));
  3137. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  3138. })(com || (com = {}));
  3139. (function (com) {
  3140. var mxgraph;
  3141. (function (mxgraph) {
  3142. var io;
  3143. (function (io) {
  3144. var vsdx;
  3145. (function (vsdx) {
  3146. /**
  3147. *
  3148. * A model representing vsdx files. As well as being a programmatic model, the XML DOMs of the unzipped
  3149. * files are held to enable round-tripping
  3150. * @param {*} doc
  3151. * @param {*} docData
  3152. * @param {*} mediaData
  3153. * @class
  3154. */
  3155. var mxVsdxModel = (function () {
  3156. function mxVsdxModel(doc, docData, mediaData) {
  3157. /**
  3158. * A map of Documents created by reading the XML files, indexed by the path to those files
  3159. */
  3160. this.xmlDocs = null;
  3161. /**
  3162. * Collection of media files encoded in Base64, indexed by the path to those files
  3163. */
  3164. this.media = null;
  3165. /**
  3166. * Map of page objects indexed by their ID.
  3167. */
  3168. this.pages = null;
  3169. /**
  3170. * Map of master objects indexed by their ID. Before you think you're being clever by making
  3171. * the index an Integer as for pages, don't, there are reasons.
  3172. */
  3173. this.masters = ({});
  3174. /**
  3175. * Map stylesheets indexed by their ID
  3176. */
  3177. this.stylesheets = ({});
  3178. /**
  3179. * Map themes indexed by their index
  3180. */
  3181. this.themes = ({});
  3182. this.rootElement = null;
  3183. this.pm = null;
  3184. this.xmlDocs = docData;
  3185. this.media = mediaData;
  3186. var childNode = doc.firstChild;
  3187. while ((childNode != null)) {
  3188. if ((childNode != null && (childNode.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  3189. return o1.equals(o2);
  3190. }
  3191. else {
  3192. return o1 === o2;
  3193. } })(childNode.tagName.toLowerCase(), com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "document")) {
  3194. this.rootElement = childNode;
  3195. break;
  3196. }
  3197. childNode = childNode.nextSibling;
  3198. }
  3199. ;
  3200. this.pm = new com.mxgraph.io.vsdx.mxPropertiesManager();
  3201. this.pm.initialise(this.rootElement, this);
  3202. this.initStylesheets();
  3203. this.initThemes();
  3204. this.initMasters();
  3205. this.initPages();
  3206. }
  3207. /**
  3208. * Initialize theme objects from the XML files
  3209. * @private
  3210. */
  3211. /*private*/ mxVsdxModel.prototype.initThemes = function () {
  3212. if (this.xmlDocs != null) {
  3213. var more = true;
  3214. var index = 1;
  3215. while ((more)) {
  3216. var path = com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/theme/theme" + index + ".xml";
  3217. var themeDoc = (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path);
  3218. if (themeDoc != null) {
  3219. var child = themeDoc.firstChild;
  3220. while ((child != null)) {
  3221. if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  3222. return o1.equals(o2);
  3223. }
  3224. else {
  3225. return o1 === o2;
  3226. } })(child.tagName, "a:theme")) {
  3227. var theme_1 = new com.mxgraph.io.vsdx.mxVsdxTheme(child);
  3228. if (theme_1.getThemeIndex() < 0) {
  3229. theme_1.processTheme();
  3230. }
  3231. var existingTheme = (function (m, k) { if (m.entries == null)
  3232. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  3233. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  3234. return m.entries[i].value;
  3235. } return null; })(this.themes, theme_1.getThemeIndex());
  3236. if (existingTheme == null || !existingTheme.isPure()) {
  3237. /* put */ (function (m, k, v) { if (m.entries == null)
  3238. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  3239. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  3240. m.entries[i].value = v;
  3241. return;
  3242. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.themes, theme_1.getThemeIndex(), theme_1);
  3243. }
  3244. break;
  3245. }
  3246. child = child.nextSibling;
  3247. }
  3248. ;
  3249. index++;
  3250. }
  3251. else {
  3252. more = false;
  3253. }
  3254. }
  3255. ;
  3256. }
  3257. };
  3258. /**
  3259. * Load the map with the stylesheets elements in the document.<br/>
  3260. * The masters are wrapped for instances of mxStyleSheet.
  3261. * @param doc Document with the stylesheets.
  3262. */
  3263. mxVsdxModel.prototype.initStylesheets = function () {
  3264. var vdxSheets = this.rootElement.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.STYLE_SHEETS);
  3265. if (vdxSheets.length > 0) {
  3266. var sheets_1 = vdxSheets.item(0);
  3267. var sheetList = sheets_1.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.STYLE_SHEET);
  3268. var sheetLength = sheetList.length;
  3269. for (var i = 0; i < sheetLength; i++) {
  3270. var sheet = sheetList.item(i);
  3271. var sheetId = sheet.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID);
  3272. var sheetElement = new com.mxgraph.io.vsdx.Style(sheet, this);
  3273. /* put */ (this.stylesheets[sheetId] = sheetElement);
  3274. }
  3275. ;
  3276. }
  3277. var sheets = (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(this.stylesheets);
  3278. var iter = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(sheets);
  3279. while ((iter.hasNext())) {
  3280. var sheet = iter.next();
  3281. sheet.stylesheetRefs(this);
  3282. }
  3283. ;
  3284. };
  3285. /**
  3286. * Initialize master objects from the XML files
  3287. */
  3288. mxVsdxModel.prototype.initMasters = function () {
  3289. if (this.xmlDocs != null) {
  3290. var path = com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/masters/masters.xml";
  3291. var masterDoc = (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path);
  3292. if (masterDoc != null) {
  3293. var child = masterDoc.firstChild;
  3294. while ((child != null)) {
  3295. if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  3296. return o1.equals(o2);
  3297. }
  3298. else {
  3299. return o1 === o2;
  3300. } })(child.tagName, com.mxgraph.io.vsdx.mxVsdxConstants.MASTERS)) {
  3301. var grandChild = child.firstChild;
  3302. while ((grandChild != null)) {
  3303. if ((grandChild != null && (grandChild.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  3304. return o1.equals(o2);
  3305. }
  3306. else {
  3307. return o1 === o2;
  3308. } })(grandChild.tagName, "Master")) {
  3309. var masterElement = grandChild;
  3310. var master = new com.mxgraph.io.vsdx.mxVsdxMaster(masterElement, this);
  3311. /* put */ (this.masters[master.getId()] = master);
  3312. }
  3313. grandChild = grandChild.nextSibling;
  3314. }
  3315. ;
  3316. break;
  3317. }
  3318. child = child.nextSibling;
  3319. }
  3320. ;
  3321. }
  3322. }
  3323. };
  3324. /**
  3325. * Initialize page objects from the XML files
  3326. */
  3327. mxVsdxModel.prototype.initPages = function () {
  3328. if (this.xmlDocs != null) {
  3329. var path = com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/pages/pages.xml";
  3330. var pageDoc = (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path);
  3331. if (pageDoc != null) {
  3332. var child = pageDoc.firstChild;
  3333. while ((child != null)) {
  3334. if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  3335. return o1.equals(o2);
  3336. }
  3337. else {
  3338. return o1 === o2;
  3339. } })(child.tagName, com.mxgraph.io.vsdx.mxVsdxConstants.PAGES)) {
  3340. var pages = child;
  3341. var pageList = pages.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.PAGE);
  3342. if (pageList != null && pageList.length > 0) {
  3343. this.pages = ({});
  3344. var backgroundMap = ({});
  3345. var pageListLen = pageList.length;
  3346. for (var i = 0; i < pageListLen; i++) {
  3347. var pageEle = pageList.item(i);
  3348. var page = this.createPage(pageEle);
  3349. if (page.isBackground()) {
  3350. /* put */ (function (m, k, v) { if (m.entries == null)
  3351. m.entries = []; for (var i_1 = 0; i_1 < m.entries.length; i_1++)
  3352. if (m.entries[i_1].key.equals != null && m.entries[i_1].key.equals(k) || m.entries[i_1].key === k) {
  3353. m.entries[i_1].value = v;
  3354. return;
  3355. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(backgroundMap, page.getId(), page);
  3356. }
  3357. /* put */ (function (m, k, v) { if (m.entries == null)
  3358. m.entries = []; for (var i_2 = 0; i_2 < m.entries.length; i_2++)
  3359. if (m.entries[i_2].key.equals != null && m.entries[i_2].key.equals(k) || m.entries[i_2].key === k) {
  3360. m.entries[i_2].value = v;
  3361. return;
  3362. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.pages, page.getId(), page);
  3363. }
  3364. ;
  3365. {
  3366. var array132 = (function (m) { if (m.entries == null)
  3367. m.entries = []; return m.entries; })(this.pages);
  3368. for (var index131 = 0; index131 < array132.length; index131++) {
  3369. var entry = array132[index131];
  3370. {
  3371. var page = entry.getValue();
  3372. var backId = page.getBackPageId();
  3373. if (backId != null) {
  3374. var background = (function (m, k) { if (m.entries == null)
  3375. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  3376. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  3377. return m.entries[i].value;
  3378. } return null; })(backgroundMap, backId);
  3379. page.setBackPage(background);
  3380. }
  3381. }
  3382. }
  3383. }
  3384. }
  3385. break;
  3386. }
  3387. child = child.nextSibling;
  3388. }
  3389. ;
  3390. }
  3391. }
  3392. };
  3393. mxVsdxModel.prototype.getPages = function () {
  3394. return this.pages;
  3395. };
  3396. mxVsdxModel.prototype.getThemes = function () {
  3397. return this.themes;
  3398. };
  3399. mxVsdxModel.prototype.getDefaultTheme = function ()
  3400. {
  3401. if (this.defaultTheme == null && this.themes.entries != null && this.themes.entries.length > 0)
  3402. {
  3403. this.defaultTheme = this.themes.entries[0].getValue();
  3404. }
  3405. return this.defaultTheme;
  3406. };
  3407. mxVsdxModel.prototype.getRelationship = function (rid, path) {
  3408. var relsDoc = (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path);
  3409. if (relsDoc == null || rid == null || (rid.length === 0)) {
  3410. return null;
  3411. }
  3412. var rels = relsDoc.getElementsByTagName("Relationship");
  3413. for (var i = 0; i < rels.length; i++) {
  3414. var currElem = rels.item(i);
  3415. var id = currElem.getAttribute("Id");
  3416. if ((function (o1, o2) { if (o1 && o1.equals) {
  3417. return o1.equals(o2);
  3418. }
  3419. else {
  3420. return o1 === o2;
  3421. } })(id, rid)) {
  3422. return currElem;
  3423. }
  3424. }
  3425. ;
  3426. return null;
  3427. };
  3428. mxVsdxModel.prototype.getMaster = function (masterId) {
  3429. return (function (m, k) { return m[k] ? m[k] : null; })(this.masters, masterId);
  3430. };
  3431. mxVsdxModel.prototype.createPage = function (pageEle) {
  3432. return new com.mxgraph.io.vsdx.mxVsdxPage(pageEle, this);
  3433. };
  3434. mxVsdxModel.prototype.getPropertiesManager = function () {
  3435. return this.pm;
  3436. };
  3437. mxVsdxModel.prototype.setPropertiesManager = function (pm) {
  3438. this.pm = pm;
  3439. };
  3440. mxVsdxModel.prototype.getMasterShapes = function () {
  3441. return this.masters;
  3442. };
  3443. mxVsdxModel.prototype.setMasterShapes = function (mm) {
  3444. this.masters = mm;
  3445. };
  3446. /**
  3447. * Returns the wrapper of the stylesheet element with id indicated by 'id'
  3448. * @param {string} id StyleSheet's ID.
  3449. * @return {com.mxgraph.io.vsdx.Style} StyleSheet element with id = 'id' wrapped in an instance of mxStyleSheet.
  3450. */
  3451. mxVsdxModel.prototype.getStylesheet = function (id) {
  3452. return (function (m, k) { return m[k] ? m[k] : null; })(this.stylesheets, id);
  3453. };
  3454. mxVsdxModel.prototype.getXmlDoc = function (path) {
  3455. return (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path);
  3456. };
  3457. mxVsdxModel.prototype.getMedia = function (path) {
  3458. return (function (m, k) { return m[k] ? m[k] : null; })(this.media, path);
  3459. };
  3460. return mxVsdxModel;
  3461. }());
  3462. vsdx.mxVsdxModel = mxVsdxModel;
  3463. mxVsdxModel["__class"] = "com.mxgraph.io.vsdx.mxVsdxModel";
  3464. })(vsdx = io.vsdx || (io.vsdx = {}));
  3465. })(io = mxgraph.io || (mxgraph.io = {}));
  3466. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  3467. })(com || (com = {}));
  3468. (function (com) {
  3469. var mxgraph;
  3470. (function (mxgraph) {
  3471. var io;
  3472. (function (io) {
  3473. var vsdx;
  3474. (function (vsdx) {
  3475. var mxVsdxPage = (function () {
  3476. function mxVsdxPage(pageElem, model) {
  3477. /**
  3478. * Unique ID of the element within its parent element
  3479. */
  3480. this.Id = null;
  3481. /**
  3482. * Name of the page taken from the "name" attribute of the page element
  3483. */
  3484. this.pageName = null;
  3485. this.__isBackground = false;
  3486. this.backPageId = null;
  3487. this.backPage = null;
  3488. this.pageElement = null;
  3489. this.pageSheet = null;
  3490. this.model = null;
  3491. this.shapes = ({});
  3492. this.connects = ({});
  3493. this.connectsMap = {};
  3494. this.cellElements = ({});
  3495. this.model = model;
  3496. this.pageElement = pageElem;
  3497. this.layers = [];
  3498. var backGround = pageElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.BACKGROUND);
  3499. this.__isBackground = (backGround != null && (function (o1, o2) { if (o1 && o1.equals) {
  3500. return o1.equals(o2);
  3501. }
  3502. else {
  3503. return o1 === o2;
  3504. } })(backGround, com.mxgraph.io.vsdx.mxVsdxConstants.TRUE)) ? true : false;
  3505. var back = pageElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.BACK_PAGE);
  3506. if (back != null && back.length > 0) {
  3507. this.backPageId = parseFloat(back);
  3508. }
  3509. this.Id = parseFloat(pageElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID));
  3510. this.pageName = pageElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME) || "";
  3511. this.pageNameU = pageElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U) || this.pageName;
  3512. var pageSheets = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(pageElem, "PageSheet");
  3513. if (pageSheets.length > 0) {
  3514. var pageSheet = pageSheets[0];
  3515. var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(pageSheet, "Cell");
  3516. for (var index133 = 0; index133 < cells.length; index133++) {
  3517. var cellElem = cells[index133];
  3518. {
  3519. var n = cellElem.getAttribute("N");
  3520. /* put */ (this.cellElements[n] = cellElem);
  3521. }
  3522. }
  3523. var sections = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(pageSheet, "Section");
  3524. for (var i134 = 0; i134 < sections.length; i134++)
  3525. {
  3526. var secElem = sections[i134];
  3527. var n = secElem.getAttribute("N");
  3528. if (n == "Layer")
  3529. {
  3530. var layers = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(secElem, "Row");
  3531. for (var i135 = 0; i135 < layers.length; i135++)
  3532. {
  3533. var layerAtts = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(layers[i135], "Cell");
  3534. var layerObj = {};
  3535. for (var i136 = 0; i136 < layerAtts.length; i136++)
  3536. {
  3537. layerObj[layerAtts[i136].getAttribute("N")] = layerAtts[i136].getAttribute("V");
  3538. }
  3539. if (layerObj.Name == null)
  3540. {
  3541. layerObj.Name = 'Layer ' + i135;
  3542. }
  3543. this.layers[parseInt(layers[i135].getAttribute("IX"))] = layerObj;
  3544. }
  3545. }
  3546. }
  3547. }
  3548. this.parseNodes(pageElem, model, "pages");
  3549. }
  3550. /**
  3551. * Parses the child nodes of the given element
  3552. * @param {*} pageElem the parent whose children to parse
  3553. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model the model of the vsdx file
  3554. * @param {string} pageName page information is split across pages.xml and pageX.xml where X is any number. We have to know which we're currently parsing to use the correct relationships file.
  3555. */
  3556. mxVsdxPage.prototype.parseNodes = function (pageElem, model, pageName) {
  3557. var pageChild = pageElem.firstChild;
  3558. // Parse connects first as it is needed in shapes types
  3559. while ((pageChild != null)) {
  3560. if (pageChild != null && (pageChild.nodeType == 1)) {
  3561. var pageChildElem = pageChild;
  3562. var childName = pageChildElem.nodeName;
  3563. if ((function (o1, o2) { if (o1 && o1.equals) {
  3564. return o1.equals(o2);
  3565. }
  3566. else {
  3567. return o1 === o2;
  3568. } })(childName, "Connects")) {
  3569. var connectList = pageChildElem.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.CONNECT);
  3570. var connectNode = (connectList != null && connectList.length > 0) ? connectList.item(0) : null;
  3571. while ((connectNode != null)) {
  3572. if (connectNode != null && (connectNode.nodeType == 1)) {
  3573. var connectElem = connectNode;
  3574. var connect = new com.mxgraph.io.vsdx.mxVsdxConnect(connectElem);
  3575. var fromSheet = connect.getFromSheet();
  3576. this.connectsMap[fromSheet] = (this.connectsMap[fromSheet] || 0) + 1;
  3577. var previousConnect = (fromSheet != null && fromSheet > -1) ? (function (m, k) { if (m.entries == null)
  3578. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  3579. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  3580. return m.entries[i].value;
  3581. } return null; })(this.connects, fromSheet) : null;
  3582. if (previousConnect != null) {
  3583. previousConnect.addConnect(connectElem);
  3584. }
  3585. else {
  3586. /* put */ (function (m, k, v) { if (m.entries == null)
  3587. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  3588. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  3589. m.entries[i].value = v;
  3590. return;
  3591. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.connects, connect.getFromSheet(), connect);
  3592. }
  3593. }
  3594. connectNode = connectNode.nextSibling;
  3595. }
  3596. ;
  3597. }
  3598. }
  3599. pageChild = pageChild.nextSibling;
  3600. }
  3601. ;
  3602. pageChild = pageElem.firstChild;
  3603. while ((pageChild != null)) {
  3604. if (pageChild != null && (pageChild.nodeType == 1)) {
  3605. var pageChildElem = pageChild;
  3606. var childName = pageChildElem.nodeName;
  3607. if ((function (o1, o2) { if (o1 && o1.equals) {
  3608. return o1.equals(o2);
  3609. }
  3610. else {
  3611. return o1 === o2;
  3612. } })(childName, "Rel")) {
  3613. this.resolveRel(pageChildElem, model, pageName);
  3614. }
  3615. else if ((function (o1, o2) { if (o1 && o1.equals) {
  3616. return o1.equals(o2);
  3617. }
  3618. else {
  3619. return o1 === o2;
  3620. } })(childName, "Shapes")) {
  3621. this.shapes = this.parseShapes(pageChildElem, null, false);
  3622. }
  3623. else if ((function (o1, o2) { if (o1 && o1.equals) {
  3624. return o1.equals(o2);
  3625. }
  3626. else {
  3627. return o1 === o2;
  3628. } })(childName, "PageSheet")) {
  3629. this.pageSheet = pageChildElem;
  3630. }
  3631. }
  3632. pageChild = pageChild.nextSibling;
  3633. }
  3634. ;
  3635. };
  3636. /**
  3637. *
  3638. * @param {*} relNode
  3639. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  3640. * @param {string} pageName
  3641. */
  3642. mxVsdxPage.prototype.resolveRel = function (relNode, model, pageName) {
  3643. var relElem = model.getRelationship(relNode.getAttribute("r:id"), com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/pages/_rels/" + pageName + ".xml.rels");
  3644. var target = relElem.getAttribute("Target");
  3645. var type = relElem.getAttribute("Type");
  3646. if ((function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(/* valueOf */ new String(type).toString(), "page")) {
  3647. var pageDoc = null;
  3648. if (type != null && (function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(type, "page")) {
  3649. pageDoc = model.getXmlDoc(com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/pages/" + target);
  3650. }
  3651. if (pageDoc != null) {
  3652. var child = pageDoc.firstChild;
  3653. while ((child != null)) {
  3654. if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  3655. return o1.equals(o2);
  3656. }
  3657. else {
  3658. return o1 === o2;
  3659. } })(child.tagName, "PageContents")) {
  3660. var index = target.indexOf('.');
  3661. if (index !== -1) {
  3662. this.parseNodes(child, model, target.substring(0, index));
  3663. }
  3664. break;
  3665. }
  3666. child = child.nextSibling;
  3667. }
  3668. ;
  3669. }
  3670. }
  3671. };
  3672. mxVsdxPage.prototype.parseShapes = function (shapesElement, master, recurse) {
  3673. var shapes = ({});
  3674. var shapeList = shapesElement.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.SHAPE);
  3675. var shapeNode = (shapeList != null && shapeList.length > 0) ? shapeList.item(0) : null;
  3676. while ((shapeNode != null)) {
  3677. if (shapeNode != null && (shapeNode.nodeType == 1)) {
  3678. var shapeElem = shapeNode;
  3679. var masterTmp = master;
  3680. if (masterTmp == null) {
  3681. var masterId = shapeElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER);
  3682. if (masterId != null && !(function (o1, o2) { if (o1 && o1.equals) {
  3683. return o1.equals(o2);
  3684. }
  3685. else {
  3686. return o1 === o2;
  3687. } })(masterId, "")) {
  3688. masterTmp = this.model.getMaster(masterId);
  3689. }
  3690. }
  3691. var isEdge = this.isEdge(shapeElem);
  3692. if (!isEdge && masterTmp != null) {
  3693. var masterId = shapeElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER_SHAPE);
  3694. var elem = masterTmp.getMasterElement();
  3695. if (masterId != null && !(function (o1, o2) { if (o1 && o1.equals) {
  3696. return o1.equals(o2);
  3697. }
  3698. else {
  3699. return o1 === o2;
  3700. } })(masterId, "")) {
  3701. var subShape = masterTmp.getSubShape(masterId)
  3702. //Some files has non-existing master sub-shapes
  3703. elem = subShape != null? subShape.getShape() : elem;
  3704. }
  3705. isEdge = this.isEdge(elem);
  3706. }
  3707. var shape = this.createCell(shapeElem, !isEdge, masterTmp);
  3708. /* put */ (function (m, k, v) { if (m.entries == null)
  3709. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  3710. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  3711. m.entries[i].value = v;
  3712. return;
  3713. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(shapes, shape.getId(), shape);
  3714. }
  3715. shapeNode = shapeNode.nextSibling;
  3716. }
  3717. ;
  3718. return shapes;
  3719. };
  3720. mxVsdxPage.prototype.createCell = function (shapeElem, vertex, masterTmp) {
  3721. return new com.mxgraph.io.vsdx.VsdxShape(this, shapeElem, vertex, this.model.getMasterShapes(), masterTmp, this.model);
  3722. };
  3723. mxVsdxPage.prototype.isEdge = function (shape) {
  3724. if (shape != null) {
  3725. var children = shape.childNodes;
  3726. if (children != null) {
  3727. var childNode = children.item(0);
  3728. while ((childNode != null)) {
  3729. if (childNode != null && (childNode.nodeType == 1)) {
  3730. var childElem = childNode;
  3731. if ((function (o1, o2) { if (o1 && o1.equals) {
  3732. return o1.equals(o2);
  3733. }
  3734. else {
  3735. return o1 === o2;
  3736. } })(childElem.nodeName, "Cell")) {
  3737. var n = childElem.getAttribute("N");
  3738. if ((function (o1, o2) { if (o1 && o1.equals) {
  3739. return o1.equals(o2);
  3740. }
  3741. else {
  3742. return o1 === o2;
  3743. } })(n, "BeginX") || (function (o1, o2) { if (o1 && o1.equals) {
  3744. return o1.equals(o2);
  3745. }
  3746. else {
  3747. return o1 === o2;
  3748. } })(n, "BeginY") || (function (o1, o2) { if (o1 && o1.equals) {
  3749. return o1.equals(o2);
  3750. }
  3751. else {
  3752. return o1 === o2;
  3753. } })(n, "EndY") || (function (o1, o2) { if (o1 && o1.equals) {
  3754. return o1.equals(o2);
  3755. }
  3756. else {
  3757. return o1 === o2;
  3758. } })(n, "EndX")) {
  3759. return true;
  3760. }
  3761. }
  3762. }
  3763. childNode = childNode.nextSibling;
  3764. }
  3765. ;
  3766. }
  3767. }
  3768. return false;
  3769. };
  3770. /**
  3771. * Returns the width and height of a Page expressed as an mxPoint.
  3772. * @return {mxPoint} mxPoint that represents the dimensions of the page
  3773. */
  3774. mxVsdxPage.prototype.getPageDimensions = function () {
  3775. var pageH = 0;
  3776. var pageW = 0;
  3777. var height = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, "PageHeight");
  3778. var width = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, "PageWidth");
  3779. if (height != null) {
  3780. pageH = parseFloat(height.getAttribute("V")) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  3781. pageH = Math.round(pageH * 100.0) / 100.0;
  3782. }
  3783. if (width != null) {
  3784. pageW = parseFloat(width.getAttribute("V")) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  3785. pageW = Math.round(pageW * 100.0) / 100.0;
  3786. }
  3787. return new mxPoint(pageW, pageH);
  3788. };
  3789. /**
  3790. * Returns the drawing scale attribute of this page
  3791. * @return {number} the DrawingScale
  3792. */
  3793. mxVsdxPage.prototype.getDrawingScale = function () {
  3794. var scale = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, "DrawingScale");
  3795. if (scale != null) {
  3796. return parseFloat(scale.getAttribute("V")) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  3797. }
  3798. return 1;
  3799. };
  3800. /**
  3801. * Returns the page scale attribute of this page
  3802. * @return {number} the PageScale
  3803. */
  3804. mxVsdxPage.prototype.getPageScale = function () {
  3805. var scale = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, "PageScale");
  3806. if (scale != null) {
  3807. return parseFloat(scale.getAttribute("V")) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  3808. }
  3809. return 1;
  3810. };
  3811. mxVsdxPage.prototype.getCellValue = function (cellName) {
  3812. var cell = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, cellName);
  3813. if (cell != null) {
  3814. return cell.getAttribute("V") || "";
  3815. }
  3816. return null;
  3817. };
  3818. mxVsdxPage.prototype.getCellIntValue = function (cellName, defVal) {
  3819. var val = this.getCellValue(cellName);
  3820. if (val != null) {
  3821. return parseInt(val);
  3822. }
  3823. return defVal;
  3824. };
  3825. /**
  3826. * Returns the ID of the page
  3827. * @return {number} the ID of the page
  3828. */
  3829. mxVsdxPage.prototype.getId = function () {
  3830. return this.Id;
  3831. };
  3832. mxVsdxPage.prototype.getPageName = function () {
  3833. return this.pageName;
  3834. };
  3835. mxVsdxPage.prototype.getPageNameU = function () {
  3836. return this.pageNameU;
  3837. };
  3838. mxVsdxPage.prototype.getShapes = function () {
  3839. return this.shapes;
  3840. };
  3841. mxVsdxPage.prototype.getLayers = function () {
  3842. return this.layers;
  3843. };
  3844. mxVsdxPage.prototype.getConnects = function () {
  3845. return this.connects;
  3846. };
  3847. mxVsdxPage.prototype.isBackground = function () {
  3848. return this.__isBackground;
  3849. };
  3850. /**
  3851. * Returns the background page ID, if any
  3852. * @return {number} the ID of any background page or null for no background page
  3853. */
  3854. mxVsdxPage.prototype.getBackPageId = function () {
  3855. return this.backPageId;
  3856. };
  3857. mxVsdxPage.prototype.setBackPage = function (page) {
  3858. this.backPage = page;
  3859. };
  3860. mxVsdxPage.prototype.getBackPage = function () {
  3861. return this.backPage;
  3862. };
  3863. return mxVsdxPage;
  3864. }());
  3865. vsdx.mxVsdxPage = mxVsdxPage;
  3866. mxVsdxPage["__class"] = "com.mxgraph.io.vsdx.mxVsdxPage";
  3867. })(vsdx = io.vsdx || (io.vsdx = {}));
  3868. })(io = mxgraph.io || (mxgraph.io = {}));
  3869. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  3870. })(com || (com = {}));
  3871. (function (com) {
  3872. var mxgraph;
  3873. (function (mxgraph) {
  3874. var io;
  3875. (function (io) {
  3876. var vsdx;
  3877. (function (vsdx) {
  3878. var mxVsdxTheme = (function () {
  3879. function mxVsdxTheme(theme) {
  3880. /*private*/ this.themeIndex = -1;
  3881. /*private*/ this.themeVariant = 0;
  3882. /*private*/ this.baseColors = ({});
  3883. /*private*/ this.variantsColors = (function (dims) { var allocate = function (dims) { if (dims.length == 0) {
  3884. return undefined;
  3885. }
  3886. else {
  3887. var array = [];
  3888. for (var i = 0; i < dims[0]; i++) {
  3889. array.push(allocate(dims.slice(1)));
  3890. }
  3891. return array;
  3892. } }; return allocate(dims); })([4, 7]);
  3893. /*private*/ this.isMonotoneVariant = new Array(4);
  3894. /*private*/ this.defaultClr = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255);
  3895. /*private*/ this.defaultLineClr = new com.mxgraph.io.vsdx.theme.Color(0, 0, 0);
  3896. /*private*/ this.defaultLineStyle = new com.mxgraph.io.vsdx.theme.LineStyle();
  3897. /*private*/ this.fillStyles = ([]);
  3898. /*private*/ this.connFillStyles = ([]);
  3899. /*private*/ this.lineStyles = ([]);
  3900. /*private*/ this.connLineStyles = ([]);
  3901. /*private*/ this.lineStylesExt = ([]);
  3902. /*private*/ this.connLineStylesExt = ([]);
  3903. /*private*/ this.connFontColors = ([]);
  3904. /*private*/ this.connFontStyles = ([]);
  3905. /*private*/ this.fontColors = ([]);
  3906. /*private*/ this.fontStyles = ([]);
  3907. /*private*/ this.variantEmbellishment = [0, 0, 0, 0];
  3908. /*private*/ this.variantFillIdx = (function (dims) { var allocate = function (dims) { if (dims.length == 0) {
  3909. return 0;
  3910. }
  3911. else {
  3912. var array = [];
  3913. for (var i = 0; i < dims[0]; i++) {
  3914. array.push(allocate(dims.slice(1)));
  3915. }
  3916. return array;
  3917. } }; return allocate(dims); })([4, 4]);
  3918. /*private*/ this.variantLineIdx = (function (dims) { var allocate = function (dims) { if (dims.length == 0) {
  3919. return 0;
  3920. }
  3921. else {
  3922. var array = [];
  3923. for (var i = 0; i < dims[0]; i++) {
  3924. array.push(allocate(dims.slice(1)));
  3925. }
  3926. return array;
  3927. } }; return allocate(dims); })([4, 4]);
  3928. /*private*/ this.variantEffectIdx = (function (dims) { var allocate = function (dims) { if (dims.length == 0) {
  3929. return 0;
  3930. }
  3931. else {
  3932. var array = [];
  3933. for (var i = 0; i < dims[0]; i++) {
  3934. array.push(allocate(dims.slice(1)));
  3935. }
  3936. return array;
  3937. } }; return allocate(dims); })([4, 4]);
  3938. /*private*/ this.variantFontIdx = (function (dims) { var allocate = function (dims) { if (dims.length == 0) {
  3939. return 0;
  3940. }
  3941. else {
  3942. var array = [];
  3943. for (var i = 0; i < dims[0]; i++) {
  3944. array.push(allocate(dims.slice(1)));
  3945. }
  3946. return array;
  3947. } }; return allocate(dims); })([4, 4]);
  3948. /*private*/ this.isProcessed = false;
  3949. /*private*/ this.__isPure = true;
  3950. this.theme = null;
  3951. this.bkgndColor = null;
  3952. this.name = null;
  3953. this.theme = theme;
  3954. this.name = theme.getAttribute("name") || "";
  3955. var themeId = (function (m, k) { return m[k] ? m[k] : null; })(mxVsdxTheme.themesIds_$LI$(), this.name);
  3956. if (themeId != null) {
  3957. this.themeIndex = themeId;
  3958. }
  3959. }
  3960. mxVsdxTheme.__static_initialize = function () { if (!mxVsdxTheme.__static_initialized) {
  3961. mxVsdxTheme.__static_initialized = true;
  3962. mxVsdxTheme.__static_initializer_0();
  3963. mxVsdxTheme.__static_initializer_1();
  3964. } };
  3965. mxVsdxTheme.themesIds_$LI$ = function () { mxVsdxTheme.__static_initialize(); if (mxVsdxTheme.themesIds == null)
  3966. mxVsdxTheme.themesIds = ({}); return mxVsdxTheme.themesIds; };
  3967. ;
  3968. mxVsdxTheme.__static_initializer_0 = function () {
  3969. /* put */ (mxVsdxTheme.themesIds_$LI$()["Office"] = 33);
  3970. /* put */ (mxVsdxTheme.themesIds_$LI$()["Linear"] = 34);
  3971. /* put */ (mxVsdxTheme.themesIds_$LI$()["Zephyr"] = 35);
  3972. /* put */ (mxVsdxTheme.themesIds_$LI$()["Integral"] = 36);
  3973. /* put */ (mxVsdxTheme.themesIds_$LI$()["Simple"] = 37);
  3974. /* put */ (mxVsdxTheme.themesIds_$LI$()["Whisp"] = 38);
  3975. /* put */ (mxVsdxTheme.themesIds_$LI$()["Daybreak"] = 39);
  3976. /* put */ (mxVsdxTheme.themesIds_$LI$()["Parallel"] = 40);
  3977. /* put */ (mxVsdxTheme.themesIds_$LI$()["Sequence"] = 41);
  3978. /* put */ (mxVsdxTheme.themesIds_$LI$()["Slice"] = 42);
  3979. /* put */ (mxVsdxTheme.themesIds_$LI$()["Ion"] = 43);
  3980. /* put */ (mxVsdxTheme.themesIds_$LI$()["Retrospect"] = 44);
  3981. /* put */ (mxVsdxTheme.themesIds_$LI$()["Organic"] = 45);
  3982. /* put */ (mxVsdxTheme.themesIds_$LI$()["Bubble"] = 46);
  3983. /* put */ (mxVsdxTheme.themesIds_$LI$()["Clouds"] = 47);
  3984. /* put */ (mxVsdxTheme.themesIds_$LI$()["Gemstone"] = 48);
  3985. /* put */ (mxVsdxTheme.themesIds_$LI$()["Lines"] = 49);
  3986. /* put */ (mxVsdxTheme.themesIds_$LI$()["Facet"] = 50);
  3987. /* put */ (mxVsdxTheme.themesIds_$LI$()["Prominence"] = 51);
  3988. /* put */ (mxVsdxTheme.themesIds_$LI$()["Smoke"] = 52);
  3989. /* put */ (mxVsdxTheme.themesIds_$LI$()["Radiance"] = 53);
  3990. /* put */ (mxVsdxTheme.themesIds_$LI$()["Shade"] = 54);
  3991. /* put */ (mxVsdxTheme.themesIds_$LI$()["Pencil"] = 55);
  3992. /* put */ (mxVsdxTheme.themesIds_$LI$()["Pen"] = 56);
  3993. /* put */ (mxVsdxTheme.themesIds_$LI$()["Marker"] = 57);
  3994. /* put */ (mxVsdxTheme.themesIds_$LI$()["Whiteboard"] = 58);
  3995. };
  3996. mxVsdxTheme.colorIds_$LI$ = function () { mxVsdxTheme.__static_initialize(); if (mxVsdxTheme.colorIds == null)
  3997. mxVsdxTheme.colorIds = ({}); return mxVsdxTheme.colorIds; };
  3998. ;
  3999. mxVsdxTheme.__static_initializer_1 = function () {
  4000. /* put */ (function (m, k, v) { if (m.entries == null)
  4001. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  4002. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  4003. m.entries[i].value = v;
  4004. return;
  4005. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 0, "dk1");
  4006. /* put */ (function (m, k, v) { if (m.entries == null)
  4007. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  4008. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  4009. m.entries[i].value = v;
  4010. return;
  4011. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 1, "lt1");
  4012. /* put */ (function (m, k, v) { if (m.entries == null)
  4013. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  4014. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  4015. m.entries[i].value = v;
  4016. return;
  4017. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 2, "accent1");
  4018. /* put */ (function (m, k, v) { if (m.entries == null)
  4019. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  4020. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  4021. m.entries[i].value = v;
  4022. return;
  4023. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 3, "accent2");
  4024. /* put */ (function (m, k, v) { if (m.entries == null)
  4025. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  4026. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  4027. m.entries[i].value = v;
  4028. return;
  4029. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 4, "accent3");
  4030. /* put */ (function (m, k, v) { if (m.entries == null)
  4031. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  4032. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  4033. m.entries[i].value = v;
  4034. return;
  4035. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 5, "accent4");
  4036. /* put */ (function (m, k, v) { if (m.entries == null)
  4037. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  4038. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  4039. m.entries[i].value = v;
  4040. return;
  4041. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 6, "accent5");
  4042. /* put */ (function (m, k, v) { if (m.entries == null)
  4043. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  4044. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  4045. m.entries[i].value = v;
  4046. return;
  4047. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 7, "accent6");
  4048. };
  4049. mxVsdxTheme.prototype.getThemeIndex = function () {
  4050. return this.themeIndex;
  4051. };
  4052. mxVsdxTheme.prototype.setVariant = function (variant) {
  4053. this.themeVariant = variant;
  4054. };
  4055. mxVsdxTheme.prototype.isPure = function () {
  4056. return this.__isPure;
  4057. };
  4058. mxVsdxTheme.prototype.processTheme = function () {
  4059. if (this.isProcessed)
  4060. return;
  4061. try {
  4062. var child = this.theme.firstChild;
  4063. while ((child != null)) {
  4064. if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  4065. return o1.equals(o2);
  4066. }
  4067. else {
  4068. return o1 === o2;
  4069. } })(child.nodeName, "a:themeElements")) {
  4070. var child2 = child.firstChild;
  4071. while ((child2 != null)) {
  4072. if (child2 != null && (child2.nodeType == 1)) {
  4073. var elem = child2;
  4074. var nodeName = elem.nodeName;
  4075. if ((function (o1, o2) { if (o1 && o1.equals) {
  4076. return o1.equals(o2);
  4077. }
  4078. else {
  4079. return o1 === o2;
  4080. } })(nodeName, "a:clrScheme")) {
  4081. if (!(function (o1, o2) { if (o1 && o1.equals) {
  4082. return o1.equals(o2);
  4083. }
  4084. else {
  4085. return o1 === o2;
  4086. } })(this.name, elem.getAttribute("name"))) {
  4087. this.__isPure = false;
  4088. }
  4089. this.processColors(elem);
  4090. }
  4091. else if ((function (o1, o2) { if (o1 && o1.equals) {
  4092. return o1.equals(o2);
  4093. }
  4094. else {
  4095. return o1 === o2;
  4096. } })(nodeName, "a:fontScheme")) {
  4097. if (!(function (o1, o2) { if (o1 && o1.equals) {
  4098. return o1.equals(o2);
  4099. }
  4100. else {
  4101. return o1 === o2;
  4102. } })(this.name, elem.getAttribute("name"))) {
  4103. this.__isPure = false;
  4104. }
  4105. this.processFonts(elem);
  4106. }
  4107. else if ((function (o1, o2) { if (o1 && o1.equals) {
  4108. return o1.equals(o2);
  4109. }
  4110. else {
  4111. return o1 === o2;
  4112. } })(nodeName, "a:fmtScheme")) {
  4113. if (!(function (o1, o2) { if (o1 && o1.equals) {
  4114. return o1.equals(o2);
  4115. }
  4116. else {
  4117. return o1 === o2;
  4118. } })(this.name, elem.getAttribute("name"))) {
  4119. this.__isPure = false;
  4120. }
  4121. this.processFormats(elem);
  4122. }
  4123. else if ((function (o1, o2) { if (o1 && o1.equals) {
  4124. return o1.equals(o2);
  4125. }
  4126. else {
  4127. return o1 === o2;
  4128. } })(nodeName, "a:extLst")) {
  4129. this.processExtras(elem);
  4130. }
  4131. }
  4132. child2 = child2.nextSibling;
  4133. }
  4134. ;
  4135. }
  4136. child = child.nextSibling;
  4137. }
  4138. ;
  4139. }
  4140. catch (e) {
  4141. // console.error(e.message, e);
  4142. }
  4143. ;
  4144. this.isProcessed = true;
  4145. };
  4146. /*private*/ mxVsdxTheme.prototype.processExtras = function (element) {
  4147. var exts = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(element);
  4148. for (var index134 = 0; index134 < exts.length; index134++) {
  4149. var ext = exts[index134];
  4150. {
  4151. var vt = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(ext);
  4152. switch ((vt.nodeName)) {
  4153. case "vt:fmtConnectorScheme":
  4154. if (!(function (o1, o2) { if (o1 && o1.equals) {
  4155. return o1.equals(o2);
  4156. }
  4157. else {
  4158. return o1 === o2;
  4159. } })(this.name, vt.getAttribute("name"))) {
  4160. this.__isPure = false;
  4161. }
  4162. var connSchemes = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(vt);
  4163. for (var index135 = 0; index135 < connSchemes.length; index135++) {
  4164. var scheme = connSchemes[index135];
  4165. {
  4166. var name_3 = scheme.nodeName;
  4167. switch ((name_3)) {
  4168. case "a:fillStyleLst":
  4169. var fillStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(scheme);
  4170. for (var index136 = 0; index136 < fillStyleElems.length; index136++) {
  4171. var fillStyle = fillStyleElems[index136];
  4172. {
  4173. /* add */ (this.connFillStyles.push(com.mxgraph.io.vsdx.theme.FillStyleFactory.getFillStyle(fillStyle)));
  4174. }
  4175. }
  4176. break;
  4177. case "a:lnStyleLst":
  4178. var lineStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(scheme);
  4179. for (var index137 = 0; index137 < lineStyleElems.length; index137++) {
  4180. var lineStyle = lineStyleElems[index137];
  4181. {
  4182. /* add */ (this.connLineStyles.push(new com.mxgraph.io.vsdx.theme.LineStyle(lineStyle)));
  4183. }
  4184. }
  4185. break;
  4186. }
  4187. }
  4188. }
  4189. break;
  4190. case "vt:lineStyles":
  4191. var styles = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(vt);
  4192. for (var index138 = 0; index138 < styles.length; index138++) {
  4193. var style = styles[index138];
  4194. {
  4195. var name_4 = style.nodeName;
  4196. switch ((name_4)) {
  4197. case "vt:fmtConnectorSchemeLineStyles":
  4198. var connStylesElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(style);
  4199. for (var index139 = 0; index139 < connStylesElems.length; index139++) {
  4200. var connStyle = connStylesElems[index139];
  4201. {
  4202. /* add */ (this.connLineStylesExt.push(new com.mxgraph.io.vsdx.theme.LineStyleExt(connStyle)));
  4203. }
  4204. }
  4205. break;
  4206. case "vt:fmtSchemeLineStyles":
  4207. var schemeStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(style);
  4208. for (var index140 = 0; index140 < schemeStyleElems.length; index140++) {
  4209. var schemeStyle = schemeStyleElems[index140];
  4210. {
  4211. /* add */ (this.lineStylesExt.push(new com.mxgraph.io.vsdx.theme.LineStyleExt(schemeStyle)));
  4212. }
  4213. }
  4214. break;
  4215. }
  4216. }
  4217. }
  4218. break;
  4219. case "vt:fontStylesGroup":
  4220. var fontStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(vt);
  4221. for (var index141 = 0; index141 < fontStyleElems.length; index141++) {
  4222. var fontStyle = fontStyleElems[index141];
  4223. {
  4224. var name_5 = fontStyle.nodeName;
  4225. switch ((name_5)) {
  4226. case "vt:connectorFontStyles":
  4227. this.fillFontStyles(fontStyle, this.connFontColors, this.connFontStyles);
  4228. break;
  4229. case "vt:fontStyles":
  4230. this.fillFontStyles(fontStyle, this.fontColors, this.fontStyles);
  4231. break;
  4232. }
  4233. }
  4234. }
  4235. break;
  4236. case "vt:variationStyleSchemeLst":
  4237. var varStyleSchemes = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(vt);
  4238. var i = 0;
  4239. for (var index142 = 0; index142 < varStyleSchemes.length; index142++) {
  4240. var varStyleScheme = varStyleSchemes[index142];
  4241. {
  4242. this.variantEmbellishment[i] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyleScheme, "embellishment");
  4243. var varStyles = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(varStyleScheme);
  4244. var j = 0;
  4245. for (var index143 = 0; index143 < varStyles.length; index143++) {
  4246. var varStyle = varStyles[index143];
  4247. {
  4248. this.variantFillIdx[i][j] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyle, "fillIdx");
  4249. this.variantLineIdx[i][j] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyle, "lineIdx");
  4250. this.variantEffectIdx[i][j] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyle, "effectIdx");
  4251. this.variantFontIdx[i][j] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyle, "fontIdx");
  4252. j++;
  4253. }
  4254. }
  4255. i++;
  4256. }
  4257. }
  4258. break;
  4259. }
  4260. }
  4261. }
  4262. };
  4263. /*private*/ mxVsdxTheme.prototype.fillFontStyles = function (fontStyle, fontColors, fontStyles) {
  4264. var fontProps = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(fontStyle);
  4265. for (var index144 = 0; index144 < fontProps.length; index144++) {
  4266. var fontProp = fontProps[index144];
  4267. {
  4268. /* add */ (fontStyles.push(com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(fontProp, "style")));
  4269. var color = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(fontProp);
  4270. if (color != null)
  4271. (fontColors.push(com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color))));
  4272. }
  4273. }
  4274. };
  4275. /*private*/ mxVsdxTheme.prototype.processFormats = function (element) {
  4276. var styles = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(element);
  4277. for (var index145 = 0; index145 < styles.length; index145++) {
  4278. var style = styles[index145];
  4279. {
  4280. var name_6 = style.nodeName;
  4281. switch ((name_6)) {
  4282. case "a:fillStyleLst":
  4283. var fillStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(style);
  4284. for (var index146 = 0; index146 < fillStyleElems.length; index146++) {
  4285. var fillStyle = fillStyleElems[index146];
  4286. {
  4287. /* add */ (this.fillStyles.push(com.mxgraph.io.vsdx.theme.FillStyleFactory.getFillStyle(fillStyle)));
  4288. }
  4289. }
  4290. break;
  4291. case "a:lnStyleLst":
  4292. var lineStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(style);
  4293. for (var index147 = 0; index147 < lineStyleElems.length; index147++) {
  4294. var lineStyle = lineStyleElems[index147];
  4295. {
  4296. /* add */ (this.lineStyles.push(new com.mxgraph.io.vsdx.theme.LineStyle(lineStyle)));
  4297. }
  4298. }
  4299. break;
  4300. case "a:effectStyleLst":
  4301. break;
  4302. case "a:bgFillStyleLst":
  4303. break;
  4304. }
  4305. }
  4306. }
  4307. };
  4308. /*private*/ mxVsdxTheme.prototype.processFonts = function (element) {
  4309. };
  4310. /*private*/ mxVsdxTheme.prototype.processColors = function (element) {
  4311. var child = element.firstChild;
  4312. while ((child != null)) {
  4313. if (child != null && (child.nodeType == 1)) {
  4314. var elem = child;
  4315. var nodeName = elem.nodeName;
  4316. var children = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(elem);
  4317. if ((function (o1, o2) { if (o1 && o1.equals) {
  4318. return o1.equals(o2);
  4319. }
  4320. else {
  4321. return o1 === o2;
  4322. } })(nodeName, "a:extLst")) {
  4323. if (children.length === 3) {
  4324. if (this.themeIndex < 0) {
  4325. this.extractThemeIndex(/* get */ children[0]);
  4326. }
  4327. this.addBkgndColor(/* get */ children[1]);
  4328. this.addVariantColors(/* get */ children[2]);
  4329. }
  4330. }
  4331. else {
  4332. var clrName = nodeName.substring(2);
  4333. if (children.length > 0) {
  4334. this.addBasicColor(clrName, /* get */ children[0]);
  4335. }
  4336. }
  4337. }
  4338. child = child.nextSibling;
  4339. }
  4340. ;
  4341. };
  4342. /*private*/ mxVsdxTheme.prototype.addVariantColors = function (element) {
  4343. var parent = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(element);
  4344. if (parent != null) {
  4345. var variants = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(parent);
  4346. var i = 0;
  4347. for (var index148 = 0; index148 < variants.length; index148++) {
  4348. var variant = variants[index148];
  4349. {
  4350. this.addVariantColorsSet(i++, variant);
  4351. }
  4352. }
  4353. }
  4354. };
  4355. /*private*/ mxVsdxTheme.prototype.addVariantColorsSet = function (index, variant) {
  4356. var colors = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(variant);
  4357. this.isMonotoneVariant[index] = variant.hasAttribute("monotone");
  4358. for (var index149 = 0; index149 < colors.length; index149++) {
  4359. var color = colors[index149];
  4360. {
  4361. var name_7 = color.nodeName;
  4362. switch ((name_7)) {
  4363. case "vt:varColor1":
  4364. this.variantsColors[index][0] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color));
  4365. break;
  4366. case "vt:varColor2":
  4367. this.variantsColors[index][1] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color));
  4368. break;
  4369. case "vt:varColor3":
  4370. this.variantsColors[index][2] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color));
  4371. break;
  4372. case "vt:varColor4":
  4373. this.variantsColors[index][3] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color));
  4374. break;
  4375. case "vt:varColor5":
  4376. this.variantsColors[index][4] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color));
  4377. break;
  4378. case "vt:varColor6":
  4379. this.variantsColors[index][5] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color));
  4380. break;
  4381. case "vt:varColor7":
  4382. this.variantsColors[index][6] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color));
  4383. break;
  4384. }
  4385. }
  4386. }
  4387. };
  4388. /*private*/ mxVsdxTheme.prototype.addBkgndColor = function (element) {
  4389. var elem = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(element);
  4390. if (elem != null) {
  4391. this.bkgndColor = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(elem));
  4392. }
  4393. };
  4394. /*private*/ mxVsdxTheme.prototype.extractThemeIndex = function (element) {
  4395. var elem = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(element);
  4396. if (elem != null) {
  4397. this.themeIndex = parseInt(elem.getAttribute("schemeEnum"));
  4398. }
  4399. };
  4400. /*private*/ mxVsdxTheme.prototype.addBasicColor = function (clrName, element) {
  4401. /* put */ (this.baseColors[clrName] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(element));
  4402. };
  4403. mxVsdxTheme.prototype.getSchemeColor = function (val) {
  4404. this.processTheme();
  4405. var color = (function (m, k) { return m[k] ? m[k] : null; })(this.baseColors, val);
  4406. return color != null ? color.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(this) : this.defaultClr;
  4407. };
  4408. mxVsdxTheme.prototype.getStyleColor = function (styleColor) {
  4409. this.processTheme();
  4410. if (styleColor < 8) {
  4411. var color = (function (m, k) { return m[k] ? m[k] : null; })(this.baseColors, /* get */ (function (m, k) { if (m.entries == null)
  4412. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  4413. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  4414. return m.entries[i].value;
  4415. } return null; })(mxVsdxTheme.colorIds_$LI$(), styleColor));
  4416. if (color != null) {
  4417. return color.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(this);
  4418. }
  4419. }
  4420. else if (styleColor === 8) {
  4421. if (this.bkgndColor != null) {
  4422. return this.bkgndColor.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(this);
  4423. }
  4424. }
  4425. else {
  4426. var color = null;
  4427. var clrIndex = 0;
  4428. if (styleColor >= 200) {
  4429. clrIndex = styleColor - 200;
  4430. }
  4431. else if (styleColor >= 100) {
  4432. clrIndex = styleColor - 100;
  4433. }
  4434. if (clrIndex >= 0 && clrIndex <= 6) {
  4435. color = this.variantsColors[this.themeVariant][clrIndex];
  4436. }
  4437. if (color != null) {
  4438. return color.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(this);
  4439. }
  4440. }
  4441. return this.defaultClr;
  4442. };
  4443. mxVsdxTheme.prototype.getFillGraientColor = function (quickStyleVals) {
  4444. return this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean(quickStyleVals, true);
  4445. };
  4446. mxVsdxTheme.prototype.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) {
  4447. return this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean(quickStyleVals, false);
  4448. };
  4449. mxVsdxTheme.prototype.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean = function (quickStyleVals, getGradient) {
  4450. this.processTheme();
  4451. var fillColorStyle = quickStyleVals.getQuickStyleFillColor();
  4452. var fillStyle = null;
  4453. switch ((quickStyleVals.getQuickStyleFillMatrix())) {
  4454. case 1:
  4455. case 2:
  4456. case 3:
  4457. case 4:
  4458. case 5:
  4459. case 6:
  4460. fillStyle = this.fillStyles[quickStyleVals.getQuickStyleFillMatrix() - 1];
  4461. break;
  4462. case 100:
  4463. case 101:
  4464. case 102:
  4465. case 103:
  4466. if (this.isMonotoneVariant[this.themeVariant])
  4467. fillColorStyle = 100;
  4468. var index = quickStyleVals.getQuickStyleFillMatrix() - 100;
  4469. fillStyle = this.fillStyles[this.variantFillIdx[this.themeVariant][index] - 1];
  4470. break;
  4471. }
  4472. var retColor;
  4473. if (fillStyle != null) {
  4474. if (getGradient) {
  4475. retColor = (fillStyle != null && fillStyle instanceof com.mxgraph.io.vsdx.theme.GradFill) ? fillStyle.applyStyle(fillColorStyle, this).getGradientClr() : null;
  4476. }
  4477. else {
  4478. retColor = fillStyle.applyStyle(fillColorStyle, this);
  4479. }
  4480. }
  4481. else {
  4482. if (getGradient) {
  4483. retColor = null;
  4484. }
  4485. else {
  4486. retColor = this.getStyleColor(fillColorStyle);
  4487. }
  4488. }
  4489. var styleVariation = quickStyleVals.getQuickStyleVariation();
  4490. //TODO This is the best efforts of interpreting the documentation and also this article https://visualsignals.typepad.co.uk/vislog/2013/05/visio-2013-themes-in-the-shapesheet-part-2.html
  4491. if (retColor != null && (styleVariation & 8) > 0)
  4492. {
  4493. var bkgHSLClr = this.getStyleColor(8).toHsl();
  4494. var lineClr = this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4495. var lineHSLClr = lineClr.toHsl();
  4496. var fillHSLClr = retColor.toHsl();
  4497. if (Math.abs(bkgHSLClr.getLum() - fillHSLClr.getLum()) >= 0.1666)
  4498. {
  4499. //nothing
  4500. }
  4501. else if (bkgHSLClr.getLum() <= 0.7292)
  4502. {
  4503. retColor = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255);
  4504. }
  4505. else if (Math.abs(bkgHSLClr.getLum() - lineHSLClr.getLum()) > Math.abs(bkgHSLClr.getLum() - fillHSLClr.getLum()))
  4506. {
  4507. retColor = lineClr;
  4508. }
  4509. }
  4510. return retColor;
  4511. };
  4512. mxVsdxTheme.prototype.getFillColor = function (quickStyleVals, getGradient) {
  4513. if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((typeof getGradient === 'boolean') || getGradient === null)) {
  4514. return this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean(quickStyleVals, getGradient);
  4515. }
  4516. else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && getGradient === undefined) {
  4517. return this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4518. }
  4519. else
  4520. throw new Error('invalid overload');
  4521. };
  4522. /*private*/ mxVsdxTheme.prototype.getLineStyle = function (quickStyleLineMatrix, lineStyles) {
  4523. this.processTheme();
  4524. var lineStyle = null;
  4525. switch ((quickStyleLineMatrix)) {
  4526. case 1:
  4527. case 2:
  4528. case 3:
  4529. case 4:
  4530. case 5:
  4531. case 6:
  4532. lineStyle = lineStyles[quickStyleLineMatrix - 1];
  4533. break;
  4534. case 100:
  4535. case 101:
  4536. case 102:
  4537. case 103:
  4538. var index = quickStyleLineMatrix - 100;
  4539. if (lineStyles === this.lineStyles) {
  4540. lineStyle = this.lineStyles[this.variantLineIdx[this.themeVariant][index] - 1];
  4541. }
  4542. else {
  4543. lineStyle = this.defaultLineStyle;
  4544. }
  4545. break;
  4546. }
  4547. return lineStyle;
  4548. };
  4549. /*private*/ mxVsdxTheme.prototype.getLineStyleExt = function (quickStyleLineMatrix, lineStylesExt) {
  4550. this.processTheme();
  4551. var lineStyleExt = null;
  4552. switch ((quickStyleLineMatrix)) {
  4553. case 0:
  4554. case 1:
  4555. case 2:
  4556. case 3:
  4557. case 4:
  4558. case 5:
  4559. case 6:
  4560. lineStyleExt = lineStylesExt[quickStyleLineMatrix];
  4561. break;
  4562. }
  4563. return lineStyleExt;
  4564. };
  4565. mxVsdxTheme.prototype.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList = function (quickStyleVals, lineStyles) {
  4566. this.processTheme();
  4567. var lineColorStyle = quickStyleVals.getQuickStyleLineColor();
  4568. var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles);
  4569. switch ((quickStyleVals.getQuickStyleLineMatrix())) {
  4570. case 100:
  4571. case 101:
  4572. case 102:
  4573. case 103:
  4574. if (this.isMonotoneVariant[this.themeVariant])
  4575. lineColorStyle = 100;
  4576. break;
  4577. }
  4578. var lineClr;
  4579. if (lineStyle != null) {
  4580. lineClr = lineStyle.getLineColor(lineColorStyle, this);
  4581. }
  4582. else {
  4583. lineClr = this.getStyleColor(lineColorStyle);
  4584. }
  4585. var styleVariation = quickStyleVals.getQuickStyleVariation();
  4586. //TODO This is the best efforts of interpreting the documentation and also this article https://visualsignals.typepad.co.uk/vislog/2013/05/visio-2013-themes-in-the-shapesheet-part-2.html
  4587. if ((styleVariation & 4) > 0)
  4588. {
  4589. var bkgHSLClr = this.getStyleColor(8).toHsl();
  4590. var fillColor = this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4591. var fillHSLClr = fillColor.toHsl();
  4592. var lineHSLClr = lineClr.toHsl();
  4593. if (Math.abs(bkgHSLClr.getLum() - lineHSLClr.getLum()) >= 0.1666)
  4594. {
  4595. //nothing
  4596. }
  4597. else if (bkgHSLClr.getLum() <= 0.7292)
  4598. {
  4599. lineClr = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255);
  4600. }
  4601. else if (Math.abs(bkgHSLClr.getLum() - fillHSLClr.getLum()) > Math.abs(bkgHSLClr.getLum() - lineHSLClr.getLum()))
  4602. {
  4603. lineClr = fillColor;
  4604. }
  4605. }
  4606. return lineClr;
  4607. };
  4608. mxVsdxTheme.prototype.getLineColor = function (quickStyleVals, lineStyles) {
  4609. if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((lineStyles != null && (lineStyles instanceof Array)) || lineStyles === null)) {
  4610. return this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, lineStyles);
  4611. }
  4612. else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && lineStyles === undefined) {
  4613. return this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4614. }
  4615. else
  4616. throw new Error('invalid overload');
  4617. };
  4618. mxVsdxTheme.prototype.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) {
  4619. return this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.lineStyles);
  4620. };
  4621. mxVsdxTheme.prototype.getConnLineColor = function (quickStyleVals) {
  4622. return this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.connLineStyles);
  4623. };
  4624. mxVsdxTheme.prototype.getDefaultLineClr = function () {
  4625. return this.defaultLineClr;
  4626. };
  4627. mxVsdxTheme.prototype.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList = function (quickStyleVals, lineStylesExt, lineStyles) {
  4628. var lineStyleExt = this.getLineStyleExt(quickStyleVals.getQuickStyleLineMatrix(), lineStylesExt);
  4629. if (lineStyleExt != null) {
  4630. return lineStyleExt.isDashed();
  4631. }
  4632. else {
  4633. var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles);
  4634. return lineStyle != null ? lineStyle.isDashed() : false;
  4635. }
  4636. };
  4637. mxVsdxTheme.prototype.isLineDashed = function (quickStyleVals, lineStylesExt, lineStyles) {
  4638. if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((lineStylesExt != null && (lineStylesExt instanceof Array)) || lineStylesExt === null) && ((lineStyles != null && (lineStyles instanceof Array)) || lineStyles === null)) {
  4639. return this.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, lineStylesExt, lineStyles);
  4640. }
  4641. else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && lineStylesExt === undefined && lineStyles === undefined) {
  4642. return this.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4643. }
  4644. else
  4645. throw new Error('invalid overload');
  4646. };
  4647. mxVsdxTheme.prototype.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) {
  4648. return this.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, this.lineStylesExt, this.lineStyles);
  4649. };
  4650. mxVsdxTheme.prototype.isConnLineDashed = function (quickStyleVals) {
  4651. return this.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, this.connLineStylesExt, this.connLineStyles);
  4652. };
  4653. mxVsdxTheme.prototype.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList = function (quickStyleVals, lineStylesExt, lineStyles) {
  4654. var lineStyleExt = this.getLineStyleExt(quickStyleVals.getQuickStyleLineMatrix(), lineStylesExt);
  4655. if (lineStyleExt != null) {
  4656. return lineStyleExt.getLineDashPattern();
  4657. }
  4658. else {
  4659. var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles);
  4660. return lineStyle != null ? lineStyle.getLineDashPattern() : null;
  4661. }
  4662. };
  4663. mxVsdxTheme.prototype.getLineDashPattern = function (quickStyleVals, lineStylesExt, lineStyles) {
  4664. if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((lineStylesExt != null && (lineStylesExt instanceof Array)) || lineStylesExt === null) && ((lineStyles != null && (lineStyles instanceof Array)) || lineStyles === null)) {
  4665. return this.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, lineStylesExt, lineStyles);
  4666. }
  4667. else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && lineStylesExt === undefined && lineStyles === undefined) {
  4668. return this.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4669. }
  4670. else
  4671. throw new Error('invalid overload');
  4672. };
  4673. mxVsdxTheme.prototype.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) {
  4674. return this.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, this.lineStylesExt, this.lineStyles);
  4675. };
  4676. mxVsdxTheme.prototype.getConnLineDashPattern = function (quickStyleVals) {
  4677. return this.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, this.connLineStylesExt, this.connLineStyles);
  4678. };
  4679. /*private*/ mxVsdxTheme.prototype.getArrowSize = function (quickStyleVals, isStart, lineStylesExt, lineStyles) {
  4680. var lineStyleExt = this.getLineStyleExt(quickStyleVals.getQuickStyleLineMatrix(), lineStylesExt);
  4681. if (lineStyleExt != null) {
  4682. return isStart ? lineStyleExt.getStartSize() : lineStyleExt.getEndSize();
  4683. }
  4684. else {
  4685. var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles);
  4686. return lineStyle != null ? (isStart ? lineStyle.getStartSize() : lineStyle.getEndSize()) : 4;
  4687. }
  4688. };
  4689. mxVsdxTheme.prototype.getStartSize = function (quickStyleVals) {
  4690. return this.getArrowSize(quickStyleVals, true, this.lineStylesExt, this.lineStyles);
  4691. };
  4692. mxVsdxTheme.prototype.getConnStartSize = function (quickStyleVals) {
  4693. return this.getArrowSize(quickStyleVals, true, this.connLineStylesExt, this.connLineStyles);
  4694. };
  4695. mxVsdxTheme.prototype.getEndSize = function (quickStyleVals) {
  4696. return this.getArrowSize(quickStyleVals, false, this.lineStylesExt, this.lineStyles);
  4697. };
  4698. mxVsdxTheme.prototype.getConnEndSize = function (quickStyleVals) {
  4699. return this.getArrowSize(quickStyleVals, false, this.connLineStylesExt, this.connLineStyles);
  4700. };
  4701. mxVsdxTheme.prototype.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList = function (quickStyleVals, fontColors) {
  4702. this.processTheme();
  4703. var fontColorStyle = quickStyleVals.getQuickStyleFontColor();
  4704. var fontColor = null;
  4705. switch ((quickStyleVals.getQuickStyleFontMatrix())) {
  4706. case 1:
  4707. case 2:
  4708. case 3:
  4709. case 4:
  4710. case 5:
  4711. case 6:
  4712. fontColor = fontColors[quickStyleVals.getQuickStyleFontMatrix() - 1];
  4713. break;
  4714. case 100:
  4715. case 101:
  4716. case 102:
  4717. case 103:
  4718. if (this.isMonotoneVariant[this.themeVariant])
  4719. fontColorStyle = 100;
  4720. var index = quickStyleVals.getQuickStyleFontMatrix() - 100;
  4721. if (fontColors !== this.fontColors) {
  4722. fontColor = (function (m, k) { return m[k] ? m[k] : null; })(this.baseColors, "dk1");
  4723. }
  4724. else {
  4725. fontColor = fontColors[this.variantFontIdx[this.themeVariant][index] - 1];
  4726. }
  4727. break;
  4728. }
  4729. var txtColor;
  4730. if (fontColor != null) {
  4731. txtColor = fontColor.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(fontColorStyle, this);
  4732. }
  4733. else {
  4734. txtColor = this.getStyleColor(fontColorStyle);
  4735. }
  4736. var styleVariation = quickStyleVals.getQuickStyleVariation();
  4737. //TODO This is the best efforts of interpreting the documentation and also this article https://visualsignals.typepad.co.uk/vislog/2013/05/visio-2013-themes-in-the-shapesheet-part-2.html
  4738. if ((styleVariation & 2) > 0)
  4739. {
  4740. var bkgHSLClr = this.getStyleColor(8).toHsl();
  4741. var txtHSLClr = txtColor.toHsl();
  4742. var fillColor = this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4743. var fillHSLClr = fillColor.toHsl();
  4744. var lineClr = this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4745. var lineHSLClr = lineClr.toHsl();
  4746. if (Math.abs(bkgHSLClr.getLum() - txtHSLClr.getLum()) >= 0.1666)
  4747. {
  4748. //nothing
  4749. }
  4750. else if (bkgHSLClr.getLum() <= 0.7292)
  4751. {
  4752. txtColor = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255);
  4753. }
  4754. else
  4755. {
  4756. var lineDiff = Math.abs(bkgHSLClr.getLum() - lineHSLClr.getLum());
  4757. var fillDiff = Math.abs(bkgHSLClr.getLum() - fillHSLClr.getLum());
  4758. var txtDiff = Math.abs(bkgHSLClr.getLum() - txtHSLClr.getLum());
  4759. var max = Math.max(lineDiff, fillDiff, txtDiff);
  4760. if (max == lineDiff)
  4761. {
  4762. txtColor = lineClr;
  4763. }
  4764. else if (max == fillDiff)
  4765. {
  4766. txtColor = fillColor;
  4767. }
  4768. }
  4769. }
  4770. return txtColor;
  4771. };
  4772. mxVsdxTheme.prototype.getFontColor = function (quickStyleVals, fontColors) {
  4773. if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((fontColors != null && (fontColors instanceof Array)) || fontColors === null)) {
  4774. return this.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, fontColors);
  4775. }
  4776. else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && fontColors === undefined) {
  4777. return this.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4778. }
  4779. else
  4780. throw new Error('invalid overload');
  4781. };
  4782. mxVsdxTheme.prototype.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) {
  4783. return this.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.fontColors);
  4784. };
  4785. mxVsdxTheme.prototype.getConnFontColor = function (quickStyleVals) {
  4786. return this.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.connFontColors);
  4787. };
  4788. /*private*/ mxVsdxTheme.prototype.getArrowType = function (quickStyleVals, isStart, lineStylesExt, lineStyles) {
  4789. var lineStyleExt = this.getLineStyleExt(quickStyleVals.getQuickStyleLineMatrix(), lineStylesExt);
  4790. if (lineStyleExt != null) {
  4791. return isStart ? lineStyleExt.getStart() : lineStyleExt.getEnd();
  4792. }
  4793. else {
  4794. var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles);
  4795. return lineStyle != null ? (isStart ? lineStyle.getStart() : lineStyle.getEnd()) : 0;
  4796. }
  4797. };
  4798. mxVsdxTheme.prototype.getEdgeMarker = function (isStart, quickStyleVals) {
  4799. return this.getArrowType(quickStyleVals, isStart, this.lineStylesExt, this.lineStyles);
  4800. };
  4801. mxVsdxTheme.prototype.getConnEdgeMarker = function (isStart, quickStyleVals) {
  4802. return this.getArrowType(quickStyleVals, isStart, this.connLineStylesExt, this.connLineStyles);
  4803. };
  4804. mxVsdxTheme.prototype.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList = function (quickStyleVals, lineStyles) {
  4805. var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles);
  4806. return lineStyle != null ? lineStyle.getLineWidth() : 0;
  4807. };
  4808. mxVsdxTheme.prototype.getLineWidth = function (quickStyleVals, lineStyles) {
  4809. if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((lineStyles != null && (lineStyles instanceof Array)) || lineStyles === null)) {
  4810. return this.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, lineStyles);
  4811. }
  4812. else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && lineStyles === undefined) {
  4813. return this.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals);
  4814. }
  4815. else
  4816. throw new Error('invalid overload');
  4817. };
  4818. mxVsdxTheme.prototype.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) {
  4819. return this.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.lineStyles);
  4820. };
  4821. mxVsdxTheme.prototype.getConnLineWidth = function (quickStyleVals) {
  4822. return this.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.connLineStyles);
  4823. };
  4824. return mxVsdxTheme;
  4825. }());
  4826. mxVsdxTheme.__static_initialized = false;
  4827. vsdx.mxVsdxTheme = mxVsdxTheme;
  4828. mxVsdxTheme["__class"] = "com.mxgraph.io.vsdx.mxVsdxTheme";
  4829. })(vsdx = io.vsdx || (io.vsdx = {}));
  4830. })(io = mxgraph.io || (mxgraph.io = {}));
  4831. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  4832. })(com || (com = {}));
  4833. (function (com) {
  4834. var mxgraph;
  4835. (function (mxgraph) {
  4836. var io;
  4837. (function (io) {
  4838. var vsdx;
  4839. (function (vsdx) {
  4840. /**
  4841. * General utilities for .vdx format support
  4842. * @class
  4843. */
  4844. var mxVsdxUtils = (function () {
  4845. function mxVsdxUtils() {
  4846. }
  4847. mxVsdxUtils.conversionFactor_$LI$ = function () { if (mxVsdxUtils.conversionFactor == null)
  4848. mxVsdxUtils.conversionFactor = mxVsdxUtils.screenCoordinatesPerCm * mxVsdxUtils.CENTIMETERS_PER_INCHES; return mxVsdxUtils.conversionFactor; };
  4849. ;
  4850. /**
  4851. * Returns a collection of direct child Elements that match the specified tag name
  4852. * @param {*} parent the parent whose direct children will be processed
  4853. * @param {string} name the child tag name to match
  4854. * @return {*[]} a collection of matching Elements
  4855. */
  4856. mxVsdxUtils.getDirectChildNamedElements = function (parent, name) {
  4857. var result = ([]);
  4858. for (var child = parent.firstChild; child != null; child = child.nextSibling) {
  4859. if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) {
  4860. return o1.equals(o2);
  4861. }
  4862. else {
  4863. return o1 === o2;
  4864. } })(name, child.nodeName)) {
  4865. /* add */ (result.push(child));
  4866. }
  4867. }
  4868. ;
  4869. return result;
  4870. };
  4871. /**
  4872. * Returns a collection of direct child Elements
  4873. * @param {*} parent the parent whose direct children will be processed
  4874. * @return {*[]} a collection of all child Elements
  4875. */
  4876. mxVsdxUtils.getDirectChildElements = function (parent) {
  4877. var result = ([]);
  4878. for (var child = parent.firstChild; child != null; child = child.nextSibling) {
  4879. if (child != null && (child.nodeType == 1)) {
  4880. /* add */ (result.push(child));
  4881. }
  4882. }
  4883. ;
  4884. return result;
  4885. };
  4886. /**
  4887. * Returns the first direct child Element
  4888. * @param {*} parent the parent whose direct first child will be processed
  4889. * @return {*} the first child Element
  4890. */
  4891. mxVsdxUtils.getDirectFirstChildElement = function (parent) {
  4892. for (var child = parent.firstChild; child != null; child = child.nextSibling) {
  4893. if (child != null && (child.nodeType == 1)) {
  4894. return child;
  4895. }
  4896. }
  4897. ;
  4898. return null;
  4899. };
  4900. mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String$int = function (elem, attName, defVal) {
  4901. try {
  4902. var val = elem.getAttribute(attName);
  4903. if (val != null) {
  4904. return parseInt(val);
  4905. }
  4906. }
  4907. catch (e) {
  4908. }
  4909. ;
  4910. return defVal;
  4911. };
  4912. /**
  4913. * Return the value of an integer attribute or the default value
  4914. * @param {*} elem Element
  4915. * @param {string} attName Attribute name
  4916. * @param {number} defVal default value
  4917. * @return {number} the parsed attribute value or the default value
  4918. */
  4919. mxVsdxUtils.getIntAttr = function (elem, attName, defVal) {
  4920. if (((elem != null && (elem.nodeType == 1)) || elem === null) && ((typeof attName === 'string') || attName === null) && ((typeof defVal === 'number') || defVal === null)) {
  4921. return com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String$int(elem, attName, defVal);
  4922. }
  4923. else if (((elem != null && (elem.nodeType == 1)) || elem === null) && ((typeof attName === 'string') || attName === null) && defVal === undefined) {
  4924. return com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(elem, attName);
  4925. }
  4926. else
  4927. throw new Error('invalid overload');
  4928. };
  4929. mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String = function (elem, attName) {
  4930. return mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String$int(elem, attName, 0);
  4931. };
  4932. /**
  4933. * Returns the string that represents the content of a given style map.
  4934. * @param {*} styleMap Map with the styles values
  4935. * @return {string} string that represents the style.
  4936. * @param {string} asig
  4937. */
  4938. mxVsdxUtils.getStyleString = function (styleMap, asig) {
  4939. var style = "";
  4940. var it = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* values */ (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(styleMap));
  4941. var kit = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(/* keySet */ Object.keys(styleMap));
  4942. while ((kit.hasNext())) {
  4943. var key = kit.next();
  4944. var value = it.next();
  4945. if (!(function (o1, o2) { if (o1 && o1.equals) {
  4946. return o1.equals(o2);
  4947. }
  4948. else {
  4949. return o1 === o2;
  4950. } })(key, mxConstants.STYLE_SHAPE) || (!(function (str, searchString, position) {
  4951. if (position === void 0) { position = 0; }
  4952. return str.substr(position, searchString.length) === searchString;
  4953. })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(styleMap, key), "image") && !(function (str, searchString, position) {
  4954. if (position === void 0) { position = 0; }
  4955. return str.substr(position, searchString.length) === searchString;
  4956. })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(styleMap, key), "rounded="))) {
  4957. try {
  4958. style = style + key + asig;
  4959. }
  4960. catch (e) {
  4961. //console.error("mxVsdxUtils.getStyleString," + e + ",style.length=" + style.length + ",key.length=" + key.length + ",asig.length=" + asig.length);
  4962. }
  4963. ;
  4964. }
  4965. style = style + value + ";";
  4966. }
  4967. ;
  4968. return style;
  4969. };
  4970. /**
  4971. * Returns a text surrounded by tags html.
  4972. * @param {string} text Text to be surrounded.
  4973. * @param {string} tag Name of the tag.
  4974. * @return {string} &lt tag &gt text &lt /tag &gt
  4975. */
  4976. mxVsdxUtils.surroundByTags = function (text, tag, style) {
  4977. return "<" + tag + (style? ' style="' + style + '"' : '') + ">" + text + "</" + tag + ">";
  4978. };
  4979. /**
  4980. * Converts the ampersand, quote, prime, less-than and greater-than
  4981. * characters to their corresponding HTML entities in the given string.
  4982. *
  4983. * Note: this is the same method of mxUtils but we cannot use it as it is not compatible with google app engine
  4984. * @param {string} text
  4985. * @return {string}
  4986. */
  4987. mxVsdxUtils.htmlEntities = function (text) {
  4988. return text.replace(new RegExp("&", 'g'), "&amp;").replace(new RegExp("\"", 'g'), "&quot;").replace(new RegExp("\'", 'g'), "&prime;").replace(new RegExp("<", 'g'), "&lt;").replace(new RegExp(">", 'g'), "&gt;");
  4989. };
  4990. /**
  4991. * Converts the initial letter of each word in text to uppercase
  4992. * @param {string} text Text to be transformed.
  4993. * @return {string} Text with initial capitals.
  4994. */
  4995. mxVsdxUtils.toInitialCapital = function (text) {
  4996. var words = text.split(" ");
  4997. var ret = "";
  4998. for (var index150 = 0; index150 < words.length; index150++) {
  4999. var word = words[index150];
  5000. {
  5001. var begin = word.substring(0, 1);
  5002. word = word.substring(1);
  5003. begin = begin.toUpperCase();
  5004. ret += begin + word;
  5005. }
  5006. }
  5007. return ret.substring(0, ret.length);
  5008. };
  5009. /**
  5010. * Trnsforms each lower case letter in text to small capital.
  5011. * @param {string} text Text to be transformed.
  5012. * @param {string} size Size of the original text.
  5013. * @return {string} Text in small capitals.
  5014. */
  5015. mxVsdxUtils.toSmallCaps = function (text, size) {
  5016. var ret = "";
  5017. if (!(function (o1, o2) { if (o1 && o1.equals) {
  5018. return o1.equals(o2);
  5019. }
  5020. else {
  5021. return o1 === o2;
  5022. } })(size, ret)) {
  5023. var a = 'a';
  5024. var z = 'z';
  5025. var letters = (text).split('');
  5026. for (var index151 = 0; index151 < letters.length; index151++) {
  5027. var c = letters[index151];
  5028. {
  5029. if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) >= (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(a) && (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(c) <= (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(z)) {
  5030. var s = new String(c).toString();
  5031. s = s.toUpperCase();
  5032. ret += "<font style=\"font-size:" + parseFloat(size) / 1.28 + "px\">" + s + "</font>";
  5033. }
  5034. else {
  5035. ret += c;
  5036. }
  5037. }
  5038. }
  5039. }
  5040. else {
  5041. ret = text;
  5042. }
  5043. return ret;
  5044. };
  5045. /**
  5046. * Create a style map from a String with style definitions.
  5047. * @param {string} style Definition of the style.
  5048. * @param {string} asig Asignation simbol used in 'style'.
  5049. * @return {*} Map with the style properties.
  5050. */
  5051. mxVsdxUtils.getStyleMap = function (style, asig) {
  5052. var styleMap = ({});
  5053. var entries = style.split(";");
  5054. for (var index152 = 0; index152 < entries.length; index152++) {
  5055. var entry = entries[index152];
  5056. {
  5057. var index = entry.indexOf(asig);
  5058. var key = entry.substring(0, index);
  5059. var value = entry.substring(index + 1);
  5060. /* put */ (styleMap[key] = value);
  5061. }
  5062. }
  5063. return styleMap;
  5064. };
  5065. mxVsdxUtils.isInsideTriangle = function (x, y, ax, ay, bx, by, cx, cy) {
  5066. function sign (p1x, p1y, p2x, p2y, p3x, p3y)
  5067. {
  5068. return (p1x - p3x) * (p2y - p3y) - (p2x - p3x) * (p1y - p3y);
  5069. }
  5070. var d1 = sign(x, y, ax, ay, bx, by);
  5071. var d2 = sign(x, y, bx, by, cx, cy);
  5072. var d3 = sign(x, y, cx, cy, ax, ay);
  5073. var has_neg = (d1 < 0) || (d2 < 0) || (d3 < 0);
  5074. var has_pos = (d1 > 0) || (d2 > 0) || (d3 > 0);
  5075. return !(has_neg && has_pos);
  5076. };
  5077. return mxVsdxUtils;
  5078. }());
  5079. mxVsdxUtils.screenCoordinatesPerCm = 40;
  5080. mxVsdxUtils.CENTIMETERS_PER_INCHES = 2.54;
  5081. vsdx.mxVsdxUtils = mxVsdxUtils;
  5082. mxVsdxUtils["__class"] = "com.mxgraph.io.vsdx.mxVsdxUtils";
  5083. })(vsdx = io.vsdx || (io.vsdx = {}));
  5084. })(io = mxgraph.io || (mxgraph.io = {}));
  5085. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5086. })(com || (com = {}));
  5087. (function (com) {
  5088. var mxgraph;
  5089. (function (mxgraph) {
  5090. var io;
  5091. (function (io) {
  5092. var vsdx;
  5093. (function (vsdx) {
  5094. /**
  5095. * Represents a single formatted section of text
  5096. * @param {string} val
  5097. * @param {string} ch
  5098. * @param {string} pg
  5099. * @param {string} field
  5100. * @class
  5101. */
  5102. var Paragraph = (function () {
  5103. function Paragraph(val, ch, pg, field) {
  5104. this.values = null;
  5105. this.charIndices = null;
  5106. this.fields = null;
  5107. this.paraIndex = null;
  5108. this.values = ([]);
  5109. /* add */ (this.values.push(val));
  5110. this.charIndices = ([]);
  5111. /* add */ (this.charIndices.push(ch));
  5112. this.fields = ([]);
  5113. /* add */ (this.fields.push(field));
  5114. this.paraIndex = pg;
  5115. }
  5116. Paragraph.prototype.addText = function (val, ch, field) {
  5117. /* add */ (this.values.push(val));
  5118. /* add */ (this.charIndices.push(ch));
  5119. /* add */ (this.fields.push(field));
  5120. };
  5121. Paragraph.prototype.getParagraphIndex = function () {
  5122. return this.paraIndex;
  5123. };
  5124. Paragraph.prototype.getValue = function (index) {
  5125. return this.values[index];
  5126. };
  5127. Paragraph.prototype.numValues = function () {
  5128. return this.values.length;
  5129. };
  5130. Paragraph.prototype.getChar = function (index) {
  5131. return this.charIndices[index];
  5132. };
  5133. Paragraph.prototype.getField = function (index) {
  5134. return this.fields[index];
  5135. };
  5136. return Paragraph;
  5137. }());
  5138. vsdx.Paragraph = Paragraph;
  5139. Paragraph["__class"] = "com.mxgraph.io.vsdx.Paragraph";
  5140. })(vsdx = io.vsdx || (io.vsdx = {}));
  5141. })(io = mxgraph.io || (mxgraph.io = {}));
  5142. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5143. })(com || (com = {}));
  5144. (function (com) {
  5145. var mxgraph;
  5146. (function (mxgraph) {
  5147. var io;
  5148. (function (io) {
  5149. var vsdx;
  5150. (function (vsdx) {
  5151. /**
  5152. * Constructs a new Section
  5153. * @param {*} elem the Element to wrap
  5154. * @class
  5155. */
  5156. var Section = (function () {
  5157. function Section(elem) {
  5158. /**
  5159. * The section element
  5160. */
  5161. this.elem = null;
  5162. this.elem = elem;
  5163. }
  5164. /**
  5165. * Return the specified cell by key by row index, if it exists
  5166. * @param {string} index the row index to search
  5167. * @param {string} cellKey the name of the Cell to search for
  5168. * @return {*} the Element of the specified Cell, if null if it doesn't exist
  5169. */
  5170. Section.prototype.getIndexedCell = function (index, cellKey) {
  5171. var rows = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(this.elem, "Row");
  5172. for (var i = 0; i < rows.length; i++) {
  5173. var row = rows[i];
  5174. var n = row.getAttribute("IX");
  5175. if ((function (o1, o2) { if (o1 && o1.equals) {
  5176. return o1.equals(o2);
  5177. }
  5178. else {
  5179. return o1 === o2;
  5180. } })(n, index) || index == null) {
  5181. var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(row, "Cell");
  5182. for (var j = 0; j < cells.length; j++) {
  5183. var cell = cells[j];
  5184. n = cell.getAttribute("N");
  5185. if ((function (o1, o2) { if (o1 && o1.equals) {
  5186. return o1.equals(o2);
  5187. }
  5188. else {
  5189. return o1 === o2;
  5190. } })(n, cellKey)) {
  5191. return cell;
  5192. }
  5193. }
  5194. ;
  5195. }
  5196. }
  5197. ;
  5198. return null;
  5199. };
  5200. return Section;
  5201. }());
  5202. vsdx.Section = Section;
  5203. Section["__class"] = "com.mxgraph.io.vsdx.Section";
  5204. })(vsdx = io.vsdx || (io.vsdx = {}));
  5205. })(io = mxgraph.io || (mxgraph.io = {}));
  5206. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5207. })(com || (com = {}));
  5208. (function (com) {
  5209. var mxgraph;
  5210. (function (mxgraph) {
  5211. var io;
  5212. (function (io) {
  5213. var vsdx;
  5214. (function (vsdx) {
  5215. /**
  5216. * Wraps the page and shape ID within that page to create a unique ID
  5217. * @param {number} pageNumber
  5218. * @param {number} Id
  5219. * @class
  5220. */
  5221. var ShapePageId = (function () {
  5222. function ShapePageId(pageNumber, Id) {
  5223. this.pageNumber = 0;
  5224. this.Id = 0;
  5225. this.pageNumber = pageNumber;
  5226. this.Id = Id;
  5227. }
  5228. ShapePageId.prototype.getId = function () {
  5229. return this.Id;
  5230. };
  5231. ShapePageId.prototype.getPageNumber = function () {
  5232. return this.pageNumber;
  5233. };
  5234. /**
  5235. *
  5236. * @param {*} obj
  5237. * @return {boolean}
  5238. */
  5239. ShapePageId.prototype.equals = function (obj) {
  5240. if (obj == null || this.constructor !== obj.constructor) {
  5241. return false;
  5242. }
  5243. var other = obj;
  5244. if (this.pageNumber !== other.pageNumber || this.Id !== other.Id) {
  5245. return false;
  5246. }
  5247. return true;
  5248. };
  5249. /**
  5250. *
  5251. * @return {number}
  5252. */
  5253. ShapePageId.prototype.hashCode = function () {
  5254. return 100000 * this.pageNumber + this.Id;
  5255. };
  5256. return ShapePageId;
  5257. }());
  5258. vsdx.ShapePageId = ShapePageId;
  5259. ShapePageId["__class"] = "com.mxgraph.io.vsdx.ShapePageId";
  5260. })(vsdx = io.vsdx || (io.vsdx = {}));
  5261. })(io = mxgraph.io || (mxgraph.io = {}));
  5262. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5263. })(com || (com = {}));
  5264. (function (com) {
  5265. var mxgraph;
  5266. (function (mxgraph) {
  5267. var io;
  5268. (function (io) {
  5269. var vsdx;
  5270. (function (vsdx) {
  5271. var theme;
  5272. (function (theme) {
  5273. var Color = (function () {
  5274. function Color(red, green, blue) {
  5275. this.red = 0;
  5276. this.green = 0;
  5277. this.blue = 0;
  5278. this.gradientClr = null;
  5279. this.red = red;
  5280. this.green = green;
  5281. this.blue = blue;
  5282. }
  5283. Color.NONE_$LI$ = function () { if (Color.NONE == null)
  5284. Color.NONE = new Color(-1, -1, -1); return Color.NONE; };
  5285. ;
  5286. Color.prototype.getRed = function () {
  5287. return this.red;
  5288. };
  5289. Color.prototype.setRed = function (red) {
  5290. this.red = red;
  5291. };
  5292. Color.prototype.getGreen = function () {
  5293. return this.green;
  5294. };
  5295. Color.prototype.setGreen = function (green) {
  5296. this.green = green;
  5297. };
  5298. Color.prototype.getBlue = function () {
  5299. return this.blue;
  5300. };
  5301. Color.prototype.setBlue = function (blue) {
  5302. this.blue = blue;
  5303. };
  5304. Color.prototype.toHsl = function () {
  5305. var r = this.getRed() / 255.0;
  5306. var g = this.getGreen() / 255.0;
  5307. var b = this.getBlue() / 255.0;
  5308. var max = Math.max(r, Math.max(g, b));
  5309. var min = Math.min(r, Math.min(g, b));
  5310. var l = (max + min) / 2.0;
  5311. var h;
  5312. var s;
  5313. if (max === min) {
  5314. h = s = 0;
  5315. }
  5316. else {
  5317. var d = max - min;
  5318. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  5319. if (max === r) {
  5320. h = (g - b) / d + (g < b ? 6 : 0);
  5321. }
  5322. else if (max === g) {
  5323. h = (b - r) / d + 2;
  5324. }
  5325. else {
  5326. h = (r - g) / d + 4;
  5327. }
  5328. h /= 6;
  5329. }
  5330. return new com.mxgraph.io.vsdx.theme.HSLColor(h, s, l);
  5331. };
  5332. Color.prototype.toHsv = function () {
  5333. var r = this.getRed() / 255.0;
  5334. var g = this.getGreen() / 255.0;
  5335. var b = this.getBlue() / 255.0;
  5336. var max = Math.max(r, Math.max(g, b));
  5337. var min = Math.min(r, Math.min(g, b));
  5338. var h;
  5339. var s;
  5340. var v = max;
  5341. var d = max - min;
  5342. s = max === 0 ? 0 : d / max;
  5343. if (max === min) {
  5344. h = 0;
  5345. }
  5346. else {
  5347. if (max === r) {
  5348. h = (g - b) / d + (g < b ? 6 : 0);
  5349. }
  5350. else if (max === g) {
  5351. h = (b - r) / d + 2;
  5352. }
  5353. else {
  5354. h = (r - g) / d + 4;
  5355. }
  5356. h /= 6;
  5357. }
  5358. return new com.mxgraph.io.vsdx.theme.HSVColor(h, s, v);
  5359. };
  5360. Color.decodeColorHex = function (hex) {
  5361. var color = parseInt(hex, 16);
  5362. return new Color((color >> 16) & 255, (color >> 8) & 255, color & 255);
  5363. };
  5364. Color.prototype.toHexStr = function () {
  5365. var r = this.red.toString(16);
  5366. r = r.length == 1 ? '0' + r : r;
  5367. var g = this.green.toString(16);
  5368. g = g.length == 1 ? '0' + g : g;
  5369. var b = this.blue.toString(16);
  5370. b = b.length == 1 ? '0' + b : b;
  5371. return "#" + r + g + b;
  5372. };
  5373. Color.prototype.getGradientClr = function () {
  5374. return this.gradientClr;
  5375. };
  5376. Color.prototype.setGradientClr = function (gradientClr) {
  5377. this.gradientClr = gradientClr;
  5378. };
  5379. return Color;
  5380. }());
  5381. theme.Color = Color;
  5382. Color["__class"] = "com.mxgraph.io.vsdx.theme.Color";
  5383. })(theme = vsdx.theme || (vsdx.theme = {}));
  5384. })(vsdx = io.vsdx || (io.vsdx = {}));
  5385. })(io = mxgraph.io || (mxgraph.io = {}));
  5386. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5387. })(com || (com = {}));
  5388. (function (com) {
  5389. var mxgraph;
  5390. (function (mxgraph) {
  5391. var io;
  5392. (function (io) {
  5393. var vsdx;
  5394. (function (vsdx) {
  5395. var theme;
  5396. (function (theme) {
  5397. var FillStyleFactory = (function () {
  5398. function FillStyleFactory() {
  5399. }
  5400. FillStyleFactory.getFillStyle = function (fillStyle) {
  5401. var fillObj = null;
  5402. switch ((fillStyle.nodeName)) {
  5403. case "a:solidFill":
  5404. fillObj = new com.mxgraph.io.vsdx.theme.SolidFillStyle(com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(fillStyle)));
  5405. break;
  5406. case "a:noFill":
  5407. fillObj = new com.mxgraph.io.vsdx.theme.NoFillStyle();
  5408. break;
  5409. case "a:gradFill":
  5410. fillObj = new com.mxgraph.io.vsdx.theme.GradFill(fillStyle);
  5411. break;
  5412. case "a:blipFill":
  5413. break;
  5414. case "a:pattFill":
  5415. break;
  5416. case "a:grpFill":
  5417. break;
  5418. }
  5419. return fillObj;
  5420. };
  5421. return FillStyleFactory;
  5422. }());
  5423. theme.FillStyleFactory = FillStyleFactory;
  5424. FillStyleFactory["__class"] = "com.mxgraph.io.vsdx.theme.FillStyleFactory";
  5425. })(theme = vsdx.theme || (vsdx.theme = {}));
  5426. })(vsdx = io.vsdx || (io.vsdx = {}));
  5427. })(io = mxgraph.io || (mxgraph.io = {}));
  5428. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5429. })(com || (com = {}));
  5430. (function (com) {
  5431. var mxgraph;
  5432. (function (mxgraph) {
  5433. var io;
  5434. (function (io) {
  5435. var vsdx;
  5436. (function (vsdx) {
  5437. var theme;
  5438. (function (theme_2) {
  5439. var GradFill = (function () {
  5440. function GradFill(elem) {
  5441. /*private*/ this.color1 = null;
  5442. /*private*/ this.color2 = null;
  5443. var gsLst = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(elem, "a:gsLst");
  5444. if (gsLst.length > 0) {
  5445. var gs = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(/* get */ gsLst[0]);
  5446. if (gs.length >= 2) {
  5447. this.color2 = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(/* get */ gs[0]));
  5448. this.color1 = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(/* get */ gs[gs.length - 1]));
  5449. }
  5450. }
  5451. if (this.color1 == null) {
  5452. this.color1 = this.color2 = new com.mxgraph.io.vsdx.theme.SrgbClr("FFFFFF");
  5453. }
  5454. }
  5455. /**
  5456. *
  5457. * @param {number} styleValue
  5458. * @param {com.mxgraph.io.vsdx.mxVsdxTheme} theme
  5459. * @return {com.mxgraph.io.vsdx.theme.Color}
  5460. */
  5461. GradFill.prototype.applyStyle = function (styleValue, theme) {
  5462. var color = this.color1.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(styleValue, theme);
  5463. color.setGradientClr(this.color2.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(styleValue, theme));
  5464. return color;
  5465. };
  5466. return GradFill;
  5467. }());
  5468. theme_2.GradFill = GradFill;
  5469. GradFill["__class"] = "com.mxgraph.io.vsdx.theme.GradFill";
  5470. GradFill["__interfaces"] = ["com.mxgraph.io.vsdx.theme.FillStyle"];
  5471. })(theme = vsdx.theme || (vsdx.theme = {}));
  5472. })(vsdx = io.vsdx || (io.vsdx = {}));
  5473. })(io = mxgraph.io || (mxgraph.io = {}));
  5474. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5475. })(com || (com = {}));
  5476. (function (com) {
  5477. var mxgraph;
  5478. (function (mxgraph) {
  5479. var io;
  5480. (function (io) {
  5481. var vsdx;
  5482. (function (vsdx) {
  5483. var theme;
  5484. (function (theme) {
  5485. var HSLColor = (function () {
  5486. function HSLColor(hue, sat, lum) {
  5487. this.hue = 0;
  5488. this.sat = 0;
  5489. this.lum = 0;
  5490. this.hue = hue;
  5491. this.sat = sat;
  5492. this.lum = lum;
  5493. }
  5494. HSLColor.prototype.getHue = function () {
  5495. return this.hue;
  5496. };
  5497. HSLColor.prototype.setHue = function (hue) {
  5498. this.hue = hue;
  5499. };
  5500. HSLColor.prototype.getSat = function () {
  5501. return this.sat;
  5502. };
  5503. HSLColor.prototype.setSat = function (sat) {
  5504. this.sat = sat;
  5505. };
  5506. HSLColor.prototype.getLum = function () {
  5507. return this.lum;
  5508. };
  5509. HSLColor.prototype.setLum = function (lum) {
  5510. this.lum = lum;
  5511. };
  5512. /*private*/ HSLColor.prototype.hue2rgb = function (p, q, t) {
  5513. if (t < 0)
  5514. t += 1;
  5515. if (t > 1)
  5516. t -= 1;
  5517. if (t < 1 / 6.0)
  5518. return p + (q - p) * 6 * t;
  5519. if (t < 0.5)
  5520. return q;
  5521. if (t < 2 / 3.0)
  5522. return p + (q - p) * (2 / 3.0 - t) * 6;
  5523. return p;
  5524. };
  5525. HSLColor.prototype.toRgb = function () {
  5526. var r;
  5527. var g;
  5528. var b;
  5529. var h = this.hue;
  5530. var s = this.sat;
  5531. var l = this.lum;
  5532. if (s === 0) {
  5533. r = g = b = l;
  5534. }
  5535. else {
  5536. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  5537. var p = 2 * l - q;
  5538. r = this.hue2rgb(p, q, h + 1 / 3.0);
  5539. g = this.hue2rgb(p, q, h);
  5540. b = this.hue2rgb(p, q, h - 1 / 3.0);
  5541. }
  5542. return new com.mxgraph.io.vsdx.theme.Color(((r * 255) | 0), ((g * 255) | 0), ((b * 255) | 0));
  5543. };
  5544. /*private*/ HSLColor.prototype.clamp01 = function (val) {
  5545. return Math.min(1, Math.max(0, val));
  5546. };
  5547. HSLColor.prototype.tint = function (amount) {
  5548. this.lum *= (1 + (amount / 100.0));
  5549. this.lum = this.clamp01(this.lum);
  5550. return this;
  5551. };
  5552. HSLColor.prototype.shade = function (amount) {
  5553. this.lum *= amount / 100.0;
  5554. this.lum = this.clamp01(this.lum);
  5555. return this;
  5556. };
  5557. HSLColor.prototype.satMod = function (amount) {
  5558. this.sat *= amount / 100.0;
  5559. this.sat = this.clamp01(this.sat);
  5560. return this;
  5561. };
  5562. HSLColor.prototype.lumMod = function (amount) {
  5563. this.lum *= amount / 100.0;
  5564. this.lum = this.clamp01(this.lum);
  5565. return this;
  5566. };
  5567. return HSLColor;
  5568. }());
  5569. theme.HSLColor = HSLColor;
  5570. HSLColor["__class"] = "com.mxgraph.io.vsdx.theme.HSLColor";
  5571. })(theme = vsdx.theme || (vsdx.theme = {}));
  5572. })(vsdx = io.vsdx || (io.vsdx = {}));
  5573. })(io = mxgraph.io || (mxgraph.io = {}));
  5574. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5575. })(com || (com = {}));
  5576. (function (com) {
  5577. var mxgraph;
  5578. (function (mxgraph) {
  5579. var io;
  5580. (function (io) {
  5581. var vsdx;
  5582. (function (vsdx) {
  5583. var theme;
  5584. (function (theme) {
  5585. var HSVColor = (function () {
  5586. function HSVColor(h, s, v) {
  5587. this.h = 0;
  5588. this.s = 0;
  5589. this.v = 0;
  5590. this.h = h;
  5591. this.s = s;
  5592. this.v = v;
  5593. }
  5594. HSVColor.prototype.toRgb = function () {
  5595. var h = this.h * 6;
  5596. var s = this.s;
  5597. var l = this.v;
  5598. var i = Math.floor(h);
  5599. var f = h - i;
  5600. var p = this.v * (1 - s);
  5601. var q = this.v * (1 - f * s);
  5602. var t = this.v * (1 - (1 - f) * s);
  5603. var mod = (i | 0) % 6;
  5604. var rArr = [this.v, q, p, p, t, this.v];
  5605. var gArr = [t, this.v, this.v, q, p, p];
  5606. var bArr = [p, p, t, this.v, this.v, q];
  5607. var r = rArr[mod];
  5608. var g = gArr[mod];
  5609. var b = bArr[mod];
  5610. return new com.mxgraph.io.vsdx.theme.Color(((r * 255) | 0), ((g * 255) | 0), ((b * 255) | 0));
  5611. };
  5612. /*private*/ HSVColor.prototype.clamp01 = function (val) {
  5613. return Math.min(1, Math.max(0, val));
  5614. };
  5615. HSVColor.prototype.tint = function (amount) {
  5616. this.v *= (1 + (amount / 100.0));
  5617. this.v = this.clamp01(this.v);
  5618. return this;
  5619. };
  5620. HSVColor.prototype.shade = function (amount) {
  5621. this.v *= amount / 100.0;
  5622. this.v = this.clamp01(this.v);
  5623. return this;
  5624. };
  5625. HSVColor.prototype.satMod = function (amount) {
  5626. this.s *= amount / 100.0;
  5627. this.s = this.clamp01(this.s);
  5628. return this;
  5629. };
  5630. HSVColor.prototype.lumMod = function (amount) {
  5631. this.v *= amount / 100.0;
  5632. this.v = this.clamp01(this.v);
  5633. return this;
  5634. };
  5635. HSVColor.prototype.hueMod = function (amount) {
  5636. this.h *= amount / 100.0;
  5637. this.h = this.clamp01(this.h);
  5638. return this;
  5639. };
  5640. return HSVColor;
  5641. }());
  5642. theme.HSVColor = HSVColor;
  5643. HSVColor["__class"] = "com.mxgraph.io.vsdx.theme.HSVColor";
  5644. })(theme = vsdx.theme || (vsdx.theme = {}));
  5645. })(vsdx = io.vsdx || (io.vsdx = {}));
  5646. })(io = mxgraph.io || (mxgraph.io = {}));
  5647. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5648. })(com || (com = {}));
  5649. (function (com) {
  5650. var mxgraph;
  5651. (function (mxgraph) {
  5652. var io;
  5653. (function (io) {
  5654. var vsdx;
  5655. (function (vsdx) {
  5656. var theme;
  5657. (function (theme_3) {
  5658. var LineStyle = (function () {
  5659. function LineStyle(elem) {
  5660. var _this = this;
  5661. /*private*/ this.isLineDashed = false;
  5662. /*private*/ this.lineDashPattern = ([]);
  5663. /*private*/ this.isRoundJoin = false;
  5664. /*private*/ this.isBevelJoin = false;
  5665. /*private*/ this.isMiterJoin = false;
  5666. if (((elem != null && (elem.nodeType == 1)) || elem === null)) {
  5667. var __args = Array.prototype.slice.call(arguments);
  5668. this.lineWidth = 0;
  5669. this.lineCap = null;
  5670. this.lineComp = null;
  5671. this.fillStyle = null;
  5672. this.headEndType = null;
  5673. this.headEndWidth = 0;
  5674. this.headEndLen = 0;
  5675. this.tailEndType = null;
  5676. this.tailEndWidth = 0;
  5677. this.tailEndLen = 0;
  5678. this.isLineDashed = false;
  5679. this.lineDashPattern = ([]);
  5680. this.isRoundJoin = false;
  5681. this.isBevelJoin = false;
  5682. this.isMiterJoin = false;
  5683. this.lineWidth = 0;
  5684. this.lineCap = null;
  5685. this.lineComp = null;
  5686. this.fillStyle = null;
  5687. this.headEndType = null;
  5688. this.headEndWidth = 0;
  5689. this.headEndLen = 0;
  5690. this.tailEndType = null;
  5691. this.tailEndWidth = 0;
  5692. this.tailEndLen = 0;
  5693. (function () {
  5694. _this.lineWidth = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(elem, "w");
  5695. var lineCapAtt = elem.getAttribute("cap");
  5696. if (lineCapAtt != null) {
  5697. switch ((lineCapAtt)) {
  5698. case "rnd":
  5699. _this.lineCap = LineStyle.LineCapType.ROUND;
  5700. break;
  5701. case "sq":
  5702. _this.lineCap = LineStyle.LineCapType.SQUARE;
  5703. break;
  5704. case "flat":
  5705. _this.lineCap = LineStyle.LineCapType.FLAT;
  5706. break;
  5707. }
  5708. }
  5709. var lineCompAtt = elem.getAttribute("cmpd");
  5710. if (lineCompAtt != null) {
  5711. switch ((lineCompAtt)) {
  5712. case "sng":
  5713. _this.lineComp = LineStyle.CompoundLineType.SINGLE;
  5714. break;
  5715. case "dbl":
  5716. _this.lineComp = LineStyle.CompoundLineType.DOUBLE;
  5717. break;
  5718. case "thickThin":
  5719. _this.lineComp = LineStyle.CompoundLineType.THICK_THIN_DOUBLE;
  5720. break;
  5721. case "thinThick":
  5722. _this.lineComp = LineStyle.CompoundLineType.THIN_THICK_DOUBLE;
  5723. break;
  5724. case "tri":
  5725. _this.lineComp = LineStyle.CompoundLineType.THIN_THICK_THIN_TRIPLE;
  5726. break;
  5727. }
  5728. }
  5729. var subElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(elem);
  5730. for (var index153 = 0; index153 < subElems.length; index153++) {
  5731. var subElem = subElems[index153];
  5732. {
  5733. var name_8 = subElem.nodeName;
  5734. switch ((name_8)) {
  5735. case "a:noFill":
  5736. case "a:solidFill":
  5737. case "a:gradFill":
  5738. case "a:pattFill":
  5739. _this.fillStyle = com.mxgraph.io.vsdx.theme.FillStyleFactory.getFillStyle(subElem);
  5740. break;
  5741. case "a:prstDash":
  5742. var val = subElem.getAttribute("val");
  5743. _this.isLineDashed = true;
  5744. switch ((val)) {
  5745. case "solid":
  5746. _this.isLineDashed = false;
  5747. break;
  5748. case "sysDot":
  5749. case "dot":
  5750. /* add */ (_this.lineDashPattern.push(1.0));
  5751. /* add */ (_this.lineDashPattern.push(4.0));
  5752. break;
  5753. case "sysDash":
  5754. case "dash":
  5755. break;
  5756. case "lgDash":
  5757. /* add */ (_this.lineDashPattern.push(12.0));
  5758. /* add */ (_this.lineDashPattern.push(4.0));
  5759. break;
  5760. case "sysDashDot":
  5761. case "dashDot":
  5762. /* add */ (_this.lineDashPattern.push(8.0));
  5763. /* add */ (_this.lineDashPattern.push(4.0));
  5764. /* add */ (_this.lineDashPattern.push(1.0));
  5765. /* add */ (_this.lineDashPattern.push(4.0));
  5766. break;
  5767. case "lgDashDot":
  5768. /* add */ (_this.lineDashPattern.push(12.0));
  5769. /* add */ (_this.lineDashPattern.push(4.0));
  5770. /* add */ (_this.lineDashPattern.push(1.0));
  5771. /* add */ (_this.lineDashPattern.push(4.0));
  5772. break;
  5773. case "sysDashDotDot":
  5774. case "lgDashDotDot":
  5775. /* add */ (_this.lineDashPattern.push(12.0));
  5776. /* add */ (_this.lineDashPattern.push(4.0));
  5777. /* add */ (_this.lineDashPattern.push(1.0));
  5778. /* add */ (_this.lineDashPattern.push(4.0));
  5779. /* add */ (_this.lineDashPattern.push(1.0));
  5780. /* add */ (_this.lineDashPattern.push(4.0));
  5781. break;
  5782. }
  5783. break;
  5784. case "a:custDash":
  5785. _this.isLineDashed = true;
  5786. var dsElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(subElem, "a:ds");
  5787. for (var index154 = 0; index154 < dsElems.length; index154++) {
  5788. var dsElem = dsElems[index154];
  5789. {
  5790. var dashLen = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(dsElem, "d");
  5791. var spaceLen = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(dsElem, "sp");
  5792. /* add */ (_this.lineDashPattern.push(dashLen / 10000.0));
  5793. /* add */ (_this.lineDashPattern.push(spaceLen / 10000.0));
  5794. }
  5795. }
  5796. break;
  5797. case "a:round":
  5798. _this.isRoundJoin = true;
  5799. break;
  5800. case "a:bevel":
  5801. _this.isBevelJoin = true;
  5802. break;
  5803. case "a:miter":
  5804. var limit = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "lim");
  5805. _this.isMiterJoin = true;
  5806. break;
  5807. case "a:headEnd":
  5808. _this.headEndType = _this.getLineEndType(subElem);
  5809. _this.headEndWidth = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "w");
  5810. _this.headEndLen = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "len");
  5811. break;
  5812. case "a:tailEnd":
  5813. _this.tailEndType = _this.getLineEndType(subElem);
  5814. _this.tailEndWidth = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "w");
  5815. _this.tailEndLen = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "len");
  5816. break;
  5817. case "a:extLst":
  5818. break;
  5819. }
  5820. }
  5821. }
  5822. })();
  5823. }
  5824. else if (elem === undefined) {
  5825. var __args = Array.prototype.slice.call(arguments);
  5826. this.lineWidth = 0;
  5827. this.lineCap = null;
  5828. this.lineComp = null;
  5829. this.fillStyle = null;
  5830. this.headEndType = null;
  5831. this.headEndWidth = 0;
  5832. this.headEndLen = 0;
  5833. this.tailEndType = null;
  5834. this.tailEndWidth = 0;
  5835. this.tailEndLen = 0;
  5836. this.isLineDashed = false;
  5837. this.lineDashPattern = ([]);
  5838. this.isRoundJoin = false;
  5839. this.isBevelJoin = false;
  5840. this.isMiterJoin = false;
  5841. this.lineWidth = 0;
  5842. this.lineCap = null;
  5843. this.lineComp = null;
  5844. this.fillStyle = null;
  5845. this.headEndType = null;
  5846. this.headEndWidth = 0;
  5847. this.headEndLen = 0;
  5848. this.tailEndType = null;
  5849. this.tailEndWidth = 0;
  5850. this.tailEndLen = 0;
  5851. }
  5852. else
  5853. throw new Error('invalid overload');
  5854. }
  5855. LineStyle.prototype.getLineEndType = function (subElem) {
  5856. var type = subElem.getAttribute("type");
  5857. var endType = null;
  5858. switch ((type)) {
  5859. case "none":
  5860. endType = LineStyle.LineEndType.NONE;
  5861. break;
  5862. case "triangle":
  5863. endType = LineStyle.LineEndType.TRIANGLE;
  5864. break;
  5865. case "stealth":
  5866. endType = LineStyle.LineEndType.STEALTH;
  5867. break;
  5868. case "diamond":
  5869. endType = LineStyle.LineEndType.DIAMOND;
  5870. break;
  5871. case "oval":
  5872. endType = LineStyle.LineEndType.OVAL;
  5873. break;
  5874. case "arrow":
  5875. endType = LineStyle.LineEndType.ARROW;
  5876. break;
  5877. }
  5878. return endType;
  5879. };
  5880. LineStyle.prototype.getLineColor = function (lineColorStyle, theme) {
  5881. if (this.fillStyle != null)
  5882. return this.fillStyle.applyStyle(lineColorStyle, theme);
  5883. else
  5884. return theme.getDefaultLineClr();
  5885. };
  5886. LineStyle.prototype.isDashed = function () {
  5887. return this.isLineDashed;
  5888. };
  5889. LineStyle.prototype.getLineDashPattern = function () {
  5890. return this.lineDashPattern;
  5891. };
  5892. LineStyle.prototype.getStartSize = function () {
  5893. return 4;
  5894. };
  5895. LineStyle.prototype.getEndSize = function () {
  5896. return 4;
  5897. };
  5898. LineStyle.prototype.getStart = function () {
  5899. return 0;
  5900. };
  5901. LineStyle.prototype.getEnd = function () {
  5902. return 0;
  5903. };
  5904. LineStyle.prototype.getLineWidth = function () {
  5905. return this.lineWidth;
  5906. };
  5907. return LineStyle;
  5908. }());
  5909. theme_3.LineStyle = LineStyle;
  5910. LineStyle["__class"] = "com.mxgraph.io.vsdx.theme.LineStyle";
  5911. (function (LineStyle) {
  5912. var LineCapType;
  5913. (function (LineCapType) {
  5914. LineCapType[LineCapType["ROUND"] = 0] = "ROUND";
  5915. LineCapType[LineCapType["SQUARE"] = 1] = "SQUARE";
  5916. LineCapType[LineCapType["FLAT"] = 2] = "FLAT";
  5917. })(LineCapType = LineStyle.LineCapType || (LineStyle.LineCapType = {}));
  5918. var CompoundLineType;
  5919. (function (CompoundLineType) {
  5920. CompoundLineType[CompoundLineType["SINGLE"] = 0] = "SINGLE";
  5921. CompoundLineType[CompoundLineType["DOUBLE"] = 1] = "DOUBLE";
  5922. CompoundLineType[CompoundLineType["THICK_THIN_DOUBLE"] = 2] = "THICK_THIN_DOUBLE";
  5923. CompoundLineType[CompoundLineType["THIN_THICK_DOUBLE"] = 3] = "THIN_THICK_DOUBLE";
  5924. CompoundLineType[CompoundLineType["THIN_THICK_THIN_TRIPLE"] = 4] = "THIN_THICK_THIN_TRIPLE";
  5925. })(CompoundLineType = LineStyle.CompoundLineType || (LineStyle.CompoundLineType = {}));
  5926. var LineEndType;
  5927. (function (LineEndType) {
  5928. LineEndType[LineEndType["NONE"] = 0] = "NONE";
  5929. LineEndType[LineEndType["TRIANGLE"] = 1] = "TRIANGLE";
  5930. LineEndType[LineEndType["STEALTH"] = 2] = "STEALTH";
  5931. LineEndType[LineEndType["DIAMOND"] = 3] = "DIAMOND";
  5932. LineEndType[LineEndType["OVAL"] = 4] = "OVAL";
  5933. LineEndType[LineEndType["ARROW"] = 5] = "ARROW";
  5934. })(LineEndType = LineStyle.LineEndType || (LineStyle.LineEndType = {}));
  5935. })(LineStyle = theme_3.LineStyle || (theme_3.LineStyle = {}));
  5936. })(theme = vsdx.theme || (vsdx.theme = {}));
  5937. })(vsdx = io.vsdx || (io.vsdx = {}));
  5938. })(io = mxgraph.io || (mxgraph.io = {}));
  5939. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5940. })(com || (com = {}));
  5941. (function (com) {
  5942. var mxgraph;
  5943. (function (mxgraph) {
  5944. var io;
  5945. (function (io) {
  5946. var vsdx;
  5947. (function (vsdx) {
  5948. var theme;
  5949. (function (theme) {
  5950. var LineStyleExt = (function () {
  5951. function LineStyleExt(elem) {
  5952. /*private*/ this.rndg = 0;
  5953. /*private*/ this.start = 0;
  5954. /*private*/ this.startSize = 0;
  5955. /*private*/ this.end = 0;
  5956. /*private*/ this.endSize = 0;
  5957. /*private*/ this.pattern = 0;
  5958. this.lineDashPattern = null;
  5959. var lineEx = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(elem);
  5960. this.rndg = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "rndg");
  5961. this.start = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "start");
  5962. this.startSize = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "startSize");
  5963. this.end = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "end");
  5964. this.endSize = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "endSize");
  5965. this.pattern = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "pattern");
  5966. this.lineDashPattern = com.mxgraph.io.vsdx.Style.getLineDashPattern(this.pattern);
  5967. }
  5968. LineStyleExt.prototype.getRndg = function () {
  5969. return this.rndg;
  5970. };
  5971. LineStyleExt.prototype.getStart = function () {
  5972. return this.start;
  5973. };
  5974. LineStyleExt.prototype.getStartSize = function () {
  5975. return this.startSize;
  5976. };
  5977. LineStyleExt.prototype.getEnd = function () {
  5978. return this.end;
  5979. };
  5980. LineStyleExt.prototype.getEndSize = function () {
  5981. return this.endSize;
  5982. };
  5983. LineStyleExt.prototype.isDashed = function () {
  5984. return this.pattern > 1;
  5985. };
  5986. LineStyleExt.prototype.getLineDashPattern = function () {
  5987. return this.lineDashPattern;
  5988. };
  5989. return LineStyleExt;
  5990. }());
  5991. theme.LineStyleExt = LineStyleExt;
  5992. LineStyleExt["__class"] = "com.mxgraph.io.vsdx.theme.LineStyleExt";
  5993. })(theme = vsdx.theme || (vsdx.theme = {}));
  5994. })(vsdx = io.vsdx || (io.vsdx = {}));
  5995. })(io = mxgraph.io || (mxgraph.io = {}));
  5996. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  5997. })(com || (com = {}));
  5998. (function (com) {
  5999. var mxgraph;
  6000. (function (mxgraph) {
  6001. var io;
  6002. (function (io) {
  6003. var vsdx;
  6004. (function (vsdx) {
  6005. var theme;
  6006. (function (theme_4) {
  6007. var NoFillStyle = (function () {
  6008. function NoFillStyle() {
  6009. }
  6010. /**
  6011. *
  6012. * @param {number} styleValue
  6013. * @param {com.mxgraph.io.vsdx.mxVsdxTheme} theme
  6014. * @return {com.mxgraph.io.vsdx.theme.Color}
  6015. */
  6016. NoFillStyle.prototype.applyStyle = function (styleValue, theme) {
  6017. return com.mxgraph.io.vsdx.theme.Color.NONE_$LI$();
  6018. };
  6019. return NoFillStyle;
  6020. }());
  6021. theme_4.NoFillStyle = NoFillStyle;
  6022. NoFillStyle["__class"] = "com.mxgraph.io.vsdx.theme.NoFillStyle";
  6023. NoFillStyle["__interfaces"] = ["com.mxgraph.io.vsdx.theme.FillStyle"];
  6024. })(theme = vsdx.theme || (vsdx.theme = {}));
  6025. })(vsdx = io.vsdx || (io.vsdx = {}));
  6026. })(io = mxgraph.io || (mxgraph.io = {}));
  6027. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6028. })(com || (com = {}));
  6029. (function (com) {
  6030. var mxgraph;
  6031. (function (mxgraph) {
  6032. var io;
  6033. (function (io) {
  6034. var vsdx;
  6035. (function (vsdx) {
  6036. var theme;
  6037. (function (theme_5) {
  6038. var OoxmlColor = (function () {
  6039. function OoxmlColor() {
  6040. /*private*/ this.tint = 0;
  6041. /*private*/ this.shade = 0;
  6042. /*private*/ this.comp = 0;
  6043. /*private*/ this.inv = 0;
  6044. /*private*/ this.gray = 0;
  6045. /*private*/ this.alpha = 0;
  6046. /*private*/ this.alphaOff = 0;
  6047. /*private*/ this.alphaMod = 0;
  6048. /*private*/ this.hue = 0;
  6049. /*private*/ this.hueOff = 0;
  6050. /*private*/ this.hueMod = 0;
  6051. /*private*/ this.sat = 0;
  6052. /*private*/ this.satOff = 0;
  6053. /*private*/ this.satMod = 0;
  6054. /*private*/ this.lum = 0;
  6055. /*private*/ this.lumOff = 0;
  6056. /*private*/ this.lumMod = 0;
  6057. /*private*/ this.red = 0;
  6058. /*private*/ this.redOff = 0;
  6059. /*private*/ this.redMod = 0;
  6060. /*private*/ this.green = 0;
  6061. /*private*/ this.greenOff = 0;
  6062. /*private*/ this.greenMod = 0;
  6063. /*private*/ this.blue = 0;
  6064. /*private*/ this.blueOff = 0;
  6065. /*private*/ this.blueMod = 0;
  6066. /*private*/ this.gamma = 0;
  6067. /*private*/ this.invGamma = 0;
  6068. this.isDynamic = false;
  6069. this.isInitialized = false;
  6070. this.hasEffects = false;
  6071. this.color = null;
  6072. }
  6073. OoxmlColor.prototype.calcColor = function (styleColor, theme) {
  6074. if (this.hasEffects) {
  6075. var hsvColor = this.color.toHsv();
  6076. if (this.tint !== 0) {
  6077. hsvColor.tint(this.tint);
  6078. }
  6079. if (this.shade !== 0) {
  6080. hsvColor.shade(this.shade);
  6081. }
  6082. if (this.satMod !== 0) {
  6083. hsvColor.satMod(this.satMod);
  6084. }
  6085. if (this.lumMod !== 0) {
  6086. hsvColor.lumMod(this.lumMod);
  6087. }
  6088. if (this.hueMod !== 0) {
  6089. hsvColor.hueMod(this.hueMod);
  6090. }
  6091. this.color = hsvColor.toRgb();
  6092. }
  6093. };
  6094. OoxmlColor.prototype.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme = function (styleColor, theme) {
  6095. if (this.isDynamic || !this.isInitialized) {
  6096. this.calcColor(styleColor, theme);
  6097. this.isInitialized = true;
  6098. }
  6099. return this.color;
  6100. };
  6101. OoxmlColor.prototype.getColor = function (styleColor, theme) {
  6102. if (((typeof styleColor === 'number') || styleColor === null) && ((theme != null && theme instanceof com.mxgraph.io.vsdx.mxVsdxTheme) || theme === null)) {
  6103. return this.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(styleColor, theme);
  6104. }
  6105. else if (((styleColor != null && styleColor instanceof com.mxgraph.io.vsdx.mxVsdxTheme) || styleColor === null) && theme === undefined) {
  6106. return this.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(styleColor);
  6107. }
  6108. else
  6109. throw new Error('invalid overload');
  6110. };
  6111. OoxmlColor.prototype.getColor$com_mxgraph_io_vsdx_mxVsdxTheme = function (theme) {
  6112. return this.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(-1, theme);
  6113. };
  6114. OoxmlColor.prototype.setTint = function (tint) {
  6115. this.tint = tint;
  6116. this.hasEffects = true;
  6117. };
  6118. OoxmlColor.prototype.setShade = function (shade) {
  6119. this.shade = shade;
  6120. this.hasEffects = true;
  6121. };
  6122. OoxmlColor.prototype.setComp = function (comp) {
  6123. this.comp = comp;
  6124. this.hasEffects = true;
  6125. };
  6126. OoxmlColor.prototype.setInv = function (inv) {
  6127. this.inv = inv;
  6128. this.hasEffects = true;
  6129. };
  6130. OoxmlColor.prototype.setGray = function (gray) {
  6131. this.gray = gray;
  6132. this.hasEffects = true;
  6133. };
  6134. OoxmlColor.prototype.setAlpha = function (alpha) {
  6135. this.alpha = alpha;
  6136. this.hasEffects = true;
  6137. };
  6138. OoxmlColor.prototype.setAlphaOff = function (alphaOff) {
  6139. this.alphaOff = alphaOff;
  6140. this.hasEffects = true;
  6141. };
  6142. OoxmlColor.prototype.setAlphaMod = function (alphaMod) {
  6143. this.alphaMod = alphaMod;
  6144. this.hasEffects = true;
  6145. };
  6146. OoxmlColor.prototype.setHue = function (hue) {
  6147. this.hue = hue;
  6148. this.hasEffects = true;
  6149. };
  6150. OoxmlColor.prototype.setHueOff = function (hueOff) {
  6151. this.hueOff = hueOff;
  6152. this.hasEffects = true;
  6153. };
  6154. OoxmlColor.prototype.setHueMod = function (hueMod) {
  6155. this.hueMod = hueMod;
  6156. this.hasEffects = true;
  6157. };
  6158. OoxmlColor.prototype.setSat = function (sat) {
  6159. this.sat = sat;
  6160. this.hasEffects = true;
  6161. };
  6162. OoxmlColor.prototype.setSatOff = function (satOff) {
  6163. this.satOff = satOff;
  6164. this.hasEffects = true;
  6165. };
  6166. OoxmlColor.prototype.setSatMod = function (satMod) {
  6167. this.satMod = satMod;
  6168. this.hasEffects = true;
  6169. };
  6170. OoxmlColor.prototype.setLum = function (lum) {
  6171. this.lum = lum;
  6172. this.hasEffects = true;
  6173. };
  6174. OoxmlColor.prototype.setLumOff = function (lumOff) {
  6175. this.lumOff = lumOff;
  6176. this.hasEffects = true;
  6177. };
  6178. OoxmlColor.prototype.setLumMod = function (lumMod) {
  6179. this.lumMod = lumMod;
  6180. this.hasEffects = true;
  6181. };
  6182. OoxmlColor.prototype.setRed = function (red) {
  6183. this.red = red;
  6184. this.hasEffects = true;
  6185. };
  6186. OoxmlColor.prototype.setRedOff = function (redOff) {
  6187. this.redOff = redOff;
  6188. this.hasEffects = true;
  6189. };
  6190. OoxmlColor.prototype.setRedMod = function (redMod) {
  6191. this.redMod = redMod;
  6192. this.hasEffects = true;
  6193. };
  6194. OoxmlColor.prototype.setGreen = function (green) {
  6195. this.green = green;
  6196. this.hasEffects = true;
  6197. };
  6198. OoxmlColor.prototype.setGreenOff = function (greenOff) {
  6199. this.greenOff = greenOff;
  6200. this.hasEffects = true;
  6201. };
  6202. OoxmlColor.prototype.setGreenMod = function (greenMod) {
  6203. this.greenMod = greenMod;
  6204. this.hasEffects = true;
  6205. };
  6206. OoxmlColor.prototype.setBlue = function (blue) {
  6207. this.blue = blue;
  6208. this.hasEffects = true;
  6209. };
  6210. OoxmlColor.prototype.setBlueOff = function (blueOff) {
  6211. this.blueOff = blueOff;
  6212. this.hasEffects = true;
  6213. };
  6214. OoxmlColor.prototype.setBlueMod = function (blueMod) {
  6215. this.blueMod = blueMod;
  6216. this.hasEffects = true;
  6217. };
  6218. OoxmlColor.prototype.setGamma = function (gamma) {
  6219. this.gamma = gamma;
  6220. this.hasEffects = true;
  6221. };
  6222. OoxmlColor.prototype.setInvGamma = function (invGamma) {
  6223. this.invGamma = invGamma;
  6224. this.hasEffects = true;
  6225. };
  6226. return OoxmlColor;
  6227. }());
  6228. theme_5.OoxmlColor = OoxmlColor;
  6229. OoxmlColor["__class"] = "com.mxgraph.io.vsdx.theme.OoxmlColor";
  6230. })(theme = vsdx.theme || (vsdx.theme = {}));
  6231. })(vsdx = io.vsdx || (io.vsdx = {}));
  6232. })(io = mxgraph.io || (mxgraph.io = {}));
  6233. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6234. })(com || (com = {}));
  6235. (function (com) {
  6236. var mxgraph;
  6237. (function (mxgraph) {
  6238. var io;
  6239. (function (io) {
  6240. var vsdx;
  6241. (function (vsdx) {
  6242. var theme;
  6243. (function (theme) {
  6244. var OoxmlColorFactory = (function () {
  6245. function OoxmlColorFactory() {
  6246. }
  6247. OoxmlColorFactory.getOoxmlColor = function (element) {
  6248. var color = null;
  6249. var nodeName = element.nodeName;
  6250. switch ((nodeName)) {
  6251. case "a:scrgbClr":
  6252. color = new com.mxgraph.io.vsdx.theme.ScrgbClr(/* parseInt */ parseInt(element.getAttribute("r")), /* parseInt */ parseInt(element.getAttribute("g")), /* parseInt */ parseInt(element.getAttribute("b")));
  6253. break;
  6254. case "a:srgbClr":
  6255. color = new com.mxgraph.io.vsdx.theme.SrgbClr(element.getAttribute("val"));
  6256. break;
  6257. case "a:hslClr":
  6258. color = new com.mxgraph.io.vsdx.theme.HslClr(/* parseInt */ parseInt(element.getAttribute("hue")), /* parseInt */ parseInt(element.getAttribute("sat")), /* parseInt */ parseInt(element.getAttribute("lum")));
  6259. break;
  6260. case "a:sysClr":
  6261. color = new com.mxgraph.io.vsdx.theme.SysClr(element.getAttribute("val"), element.getAttribute("lastClr"));
  6262. break;
  6263. case "a:schemeClr":
  6264. color = new com.mxgraph.io.vsdx.theme.SchemeClr(element.getAttribute("val"));
  6265. break;
  6266. case "a:prstClr":
  6267. color = new com.mxgraph.io.vsdx.theme.SrgbClr(element.getAttribute("val"));
  6268. break;
  6269. }
  6270. var effects = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(element);
  6271. for (var index155 = 0; index155 < effects.length; index155++) {
  6272. var effect = effects[index155];
  6273. {
  6274. var effVal = (parseInt(effect.getAttribute("val")) / 1000 | 0);
  6275. var effName = effect.nodeName;
  6276. switch ((effName)) {
  6277. case "a:tint":
  6278. color.setTint(effVal);
  6279. break;
  6280. case "a:shade":
  6281. color.setShade(effVal);
  6282. break;
  6283. case "a:satMod":
  6284. color.setSatMod(effVal);
  6285. break;
  6286. case "a:lumMod":
  6287. color.setLumMod(effVal);
  6288. break;
  6289. case "a:hueMod":
  6290. color.setHueMod(effVal);
  6291. break;
  6292. }
  6293. }
  6294. }
  6295. return color;
  6296. };
  6297. return OoxmlColorFactory;
  6298. }());
  6299. theme.OoxmlColorFactory = OoxmlColorFactory;
  6300. OoxmlColorFactory["__class"] = "com.mxgraph.io.vsdx.theme.OoxmlColorFactory";
  6301. })(theme = vsdx.theme || (vsdx.theme = {}));
  6302. })(vsdx = io.vsdx || (io.vsdx = {}));
  6303. })(io = mxgraph.io || (mxgraph.io = {}));
  6304. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6305. })(com || (com = {}));
  6306. (function (com) {
  6307. var mxgraph;
  6308. (function (mxgraph) {
  6309. var io;
  6310. (function (io) {
  6311. var vsdx;
  6312. (function (vsdx) {
  6313. var theme;
  6314. (function (theme) {
  6315. var QuickStyleVals = (function () {
  6316. function QuickStyleVals(quickStyleEffectsMatrix, quickStyleFillColor, quickStyleFillMatrix, quickStyleFontColor, quickStyleFontMatrix, quickStyleLineColor, quickStyleLineMatrix, quickStyleShadowColor, quickStyleType, quickStyleVariation) {
  6317. this.quickStyleEffectsMatrix = 0;
  6318. this.quickStyleFillColor = 0;
  6319. this.quickStyleFillMatrix = 0;
  6320. this.quickStyleFontColor = 0;
  6321. this.quickStyleFontMatrix = 0;
  6322. this.quickStyleLineColor = 0;
  6323. this.quickStyleLineMatrix = 0;
  6324. this.quickStyleShadowColor = 0;
  6325. this.quickStyleType = 0;
  6326. this.quickStyleVariation = 0;
  6327. this.quickStyleEffectsMatrix = quickStyleEffectsMatrix;
  6328. this.quickStyleFillColor = quickStyleFillColor;
  6329. this.quickStyleFillMatrix = quickStyleFillMatrix;
  6330. this.quickStyleFontColor = quickStyleFontColor;
  6331. this.quickStyleFontMatrix = quickStyleFontMatrix;
  6332. this.quickStyleLineColor = quickStyleLineColor;
  6333. this.quickStyleLineMatrix = quickStyleLineMatrix;
  6334. this.quickStyleShadowColor = quickStyleShadowColor;
  6335. this.quickStyleType = quickStyleType;
  6336. this.quickStyleVariation = quickStyleVariation;
  6337. }
  6338. QuickStyleVals.prototype.getQuickStyleEffectsMatrix = function () {
  6339. return this.quickStyleEffectsMatrix;
  6340. };
  6341. QuickStyleVals.prototype.getQuickStyleFillColor = function () {
  6342. return this.quickStyleFillColor;
  6343. };
  6344. QuickStyleVals.prototype.getQuickStyleFillMatrix = function () {
  6345. return this.quickStyleFillMatrix;
  6346. };
  6347. QuickStyleVals.prototype.getQuickStyleFontColor = function () {
  6348. return this.quickStyleFontColor;
  6349. };
  6350. QuickStyleVals.prototype.getQuickStyleFontMatrix = function () {
  6351. return this.quickStyleFontMatrix;
  6352. };
  6353. QuickStyleVals.prototype.getQuickStyleLineColor = function () {
  6354. return this.quickStyleLineColor;
  6355. };
  6356. QuickStyleVals.prototype.getQuickStyleLineMatrix = function () {
  6357. return this.quickStyleLineMatrix;
  6358. };
  6359. QuickStyleVals.prototype.getQuickStyleShadowColor = function () {
  6360. return this.quickStyleShadowColor;
  6361. };
  6362. QuickStyleVals.prototype.getQuickStyleType = function () {
  6363. return this.quickStyleType;
  6364. };
  6365. QuickStyleVals.prototype.getQuickStyleVariation = function () {
  6366. return this.quickStyleVariation;
  6367. };
  6368. QuickStyleVals.prototype.setQuickStyleEffectsMatrix = function (quickStyleEffectsMatrix) {
  6369. this.quickStyleEffectsMatrix = quickStyleEffectsMatrix;
  6370. };
  6371. QuickStyleVals.prototype.setQuickStyleFillColor = function (quickStyleFillColor) {
  6372. this.quickStyleFillColor = quickStyleFillColor;
  6373. };
  6374. QuickStyleVals.prototype.setQuickStyleFillMatrix = function (quickStyleFillMatrix) {
  6375. this.quickStyleFillMatrix = quickStyleFillMatrix;
  6376. };
  6377. QuickStyleVals.prototype.setQuickStyleFontColor = function (quickStyleFontColor) {
  6378. this.quickStyleFontColor = quickStyleFontColor;
  6379. };
  6380. QuickStyleVals.prototype.setQuickStyleFontMatrix = function (quickStyleFontMatrix) {
  6381. this.quickStyleFontMatrix = quickStyleFontMatrix;
  6382. };
  6383. QuickStyleVals.prototype.setQuickStyleLineColor = function (quickStyleLineColor) {
  6384. this.quickStyleLineColor = quickStyleLineColor;
  6385. };
  6386. QuickStyleVals.prototype.setQuickStyleLineMatrix = function (quickStyleLineMatrix) {
  6387. this.quickStyleLineMatrix = quickStyleLineMatrix;
  6388. };
  6389. QuickStyleVals.prototype.setQuickStyleShadowColor = function (quickStyleShadowColor) {
  6390. this.quickStyleShadowColor = quickStyleShadowColor;
  6391. };
  6392. QuickStyleVals.prototype.setQuickStyleType = function (quickStyleType) {
  6393. this.quickStyleType = quickStyleType;
  6394. };
  6395. QuickStyleVals.prototype.setQuickStyleVariation = function (quickStyleVariation) {
  6396. this.quickStyleVariation = quickStyleVariation;
  6397. };
  6398. return QuickStyleVals;
  6399. }());
  6400. theme.QuickStyleVals = QuickStyleVals;
  6401. QuickStyleVals["__class"] = "com.mxgraph.io.vsdx.theme.QuickStyleVals";
  6402. })(theme = vsdx.theme || (vsdx.theme = {}));
  6403. })(vsdx = io.vsdx || (io.vsdx = {}));
  6404. })(io = mxgraph.io || (mxgraph.io = {}));
  6405. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6406. })(com || (com = {}));
  6407. (function (com) {
  6408. var mxgraph;
  6409. (function (mxgraph) {
  6410. var io;
  6411. (function (io) {
  6412. var vsdx;
  6413. (function (vsdx) {
  6414. var theme;
  6415. (function (theme_6) {
  6416. var SolidFillStyle = (function () {
  6417. function SolidFillStyle(color) {
  6418. this.color = null;
  6419. this.color = color;
  6420. }
  6421. /**
  6422. *
  6423. * @param {number} styleValue
  6424. * @param {com.mxgraph.io.vsdx.mxVsdxTheme} theme
  6425. * @return {com.mxgraph.io.vsdx.theme.Color}
  6426. */
  6427. SolidFillStyle.prototype.applyStyle = function (styleValue, theme) {
  6428. return this.color.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(styleValue, theme);
  6429. };
  6430. return SolidFillStyle;
  6431. }());
  6432. theme_6.SolidFillStyle = SolidFillStyle;
  6433. SolidFillStyle["__class"] = "com.mxgraph.io.vsdx.theme.SolidFillStyle";
  6434. SolidFillStyle["__interfaces"] = ["com.mxgraph.io.vsdx.theme.FillStyle"];
  6435. })(theme = vsdx.theme || (vsdx.theme = {}));
  6436. })(vsdx = io.vsdx || (io.vsdx = {}));
  6437. })(io = mxgraph.io || (mxgraph.io = {}));
  6438. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6439. })(com || (com = {}));
  6440. (function (com) {
  6441. var mxgraph;
  6442. (function (mxgraph) {
  6443. var online;
  6444. (function (online) {
  6445. var Constants = (function () {
  6446. function Constants() {
  6447. }
  6448. Constants.MAX_AREA_$LI$ = function () { if (Constants.MAX_AREA == null)
  6449. Constants.MAX_AREA = 10000 * 10000; return Constants.MAX_AREA; };
  6450. ;
  6451. return Constants;
  6452. }());
  6453. /**
  6454. * Maximum size (in bytes) for request payloads. Default is 52428800 (50MB).
  6455. */
  6456. Constants.MAX_REQUEST_SIZE = 52428800;
  6457. /**
  6458. * The domain where legacy images are stored.
  6459. */
  6460. Constants.IMAGE_DOMAIN = "http://img.diagramly.com/";
  6461. online.Constants = Constants;
  6462. Constants["__class"] = "com.mxgraph.online.Constants";
  6463. })(online = mxgraph.online || (mxgraph.online = {}));
  6464. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6465. })(com || (com = {}));
  6466. (function (com) {
  6467. var mxgraph;
  6468. (function (mxgraph) {
  6469. var online;
  6470. (function (online) {
  6471. /**
  6472. *
  6473. * String/byte array encoding/manipulation utilities
  6474. * @class
  6475. */
  6476. var Utils = (function () {
  6477. function Utils() {
  6478. }
  6479. /**
  6480. * Rotates the given point by the given cos and sin.
  6481. * @param {mxPoint} pt
  6482. * @param {number} cos
  6483. * @param {number} sin
  6484. * @param {mxPoint} c
  6485. * @return {mxPoint}
  6486. */
  6487. Utils.getRotatedPoint = function (pt, cos, sin, c) {
  6488. var x = pt.x - c.x;
  6489. var y = pt.y - c.y;
  6490. var x1 = x * cos - y * sin;
  6491. var y1 = y * cos + x * sin;
  6492. return new mxPoint(x1 + c.x, y1 + c.y);
  6493. };
  6494. /**
  6495. * Rotates the given geometry (in place) by the given rotation (in degrees).
  6496. * @param {mxGeometry} geo
  6497. * @param {number} rotation
  6498. * @param {number} cx
  6499. * @param {number} cy
  6500. */
  6501. Utils.rotatedGeometry = function (geo, rotation, cx, cy) {
  6502. rotation = (function (x) { return x * Math.PI / 180; })(rotation);
  6503. var cos = Math.cos(rotation);
  6504. var sin = Math.sin(rotation);
  6505. var x = geo.getCenterX() - cx;
  6506. var y = geo.getCenterY() - cy;
  6507. var x1 = x * cos - y * sin;
  6508. var y1 = y * cos + x * sin;
  6509. geo.x = (Math.round(x1 + cx - geo.width / 2));
  6510. geo.y = (Math.round(y1 + cy - geo.height / 2));
  6511. };
  6512. return Utils;
  6513. }());
  6514. /**
  6515. *
  6516. */
  6517. Utils.CHARSET_FOR_URL_ENCODING = "ISO-8859-1";
  6518. online.Utils = Utils;
  6519. Utils["__class"] = "com.mxgraph.online.Utils";
  6520. })(online = mxgraph.online || (mxgraph.online = {}));
  6521. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6522. })(com || (com = {}));
  6523. (function (com) {
  6524. var mxgraph;
  6525. (function (mxgraph) {
  6526. var io;
  6527. (function (io) {
  6528. var vsdx;
  6529. (function (vsdx) {
  6530. var geometry;
  6531. (function (geometry) {
  6532. var ArcTo = (function (_super) {
  6533. __extends(ArcTo, _super);
  6534. function ArcTo(index, x, y, a) {
  6535. var _this = _super.call(this, index, x, y) || this;
  6536. _this.a = a;
  6537. return _this;
  6538. }
  6539. /**
  6540. *
  6541. * @param {mxPoint} p
  6542. * @param {com.mxgraph.io.vsdx.Shape} shape
  6543. * @return {string}
  6544. */
  6545. ArcTo.prototype.handle = function (p, shape) {
  6546. if (this.x != null && this.y != null && this.a != null) {
  6547. var h = shape.getHeight();
  6548. var w = shape.getWidth();
  6549. var x0 = Math.floor(Math.round(shape.getLastX() * w) / 100);
  6550. var y0 = Math.floor(Math.round(shape.getLastY() * h) / 100);
  6551. var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6552. var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6553. y = h - y;
  6554. var a = this.a * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6555. var dx = Math.abs(x - x0);
  6556. var dy = Math.abs(y - y0);
  6557. var rx = (a * 0.5) + (dx * dx + dy * dy) / (8.0 * a);
  6558. var ry = rx;
  6559. var r0 = Math.abs(rx);
  6560. rx = rx * 100 / w;
  6561. ry = ry * 100 / h;
  6562. x = x * 100 / w;
  6563. y = y * 100 / h;
  6564. rx = Math.round(rx * 100.0) / 100.0;
  6565. ry = Math.round(ry * 100.0) / 100.0;
  6566. x = Math.round(x * 100.0) / 100.0;
  6567. y = Math.round(y * 100.0) / 100.0;
  6568. a = Math.round(a * 100.0) / 100.0;
  6569. rx = Math.abs(rx);
  6570. ry = Math.abs(ry);
  6571. var sf = (a < 0) ? "1" : "0";
  6572. var laf = (r0 < Math.abs(a)) ? "1" : "0";
  6573. shape.setLastX(x);
  6574. shape.setLastY(y);
  6575. return "<arc rx=\"" + new String(rx).toString() + "\" ry=\"" + new String(ry).toString() + "\" x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\" x-axis-rotation=\"0\" large-arc-flag=\"" + laf + "\" sweep-flag=\"" + sf + "\"/>";
  6576. }
  6577. return "";
  6578. };
  6579. return ArcTo;
  6580. }(com.mxgraph.io.vsdx.geometry.Row));
  6581. geometry.ArcTo = ArcTo;
  6582. ArcTo["__class"] = "com.mxgraph.io.vsdx.geometry.ArcTo";
  6583. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  6584. })(vsdx = io.vsdx || (io.vsdx = {}));
  6585. })(io = mxgraph.io || (mxgraph.io = {}));
  6586. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6587. })(com || (com = {}));
  6588. (function (com) {
  6589. var mxgraph;
  6590. (function (mxgraph) {
  6591. var io;
  6592. (function (io) {
  6593. var vsdx;
  6594. (function (vsdx) {
  6595. var geometry;
  6596. (function (geometry) {
  6597. var DelRow = (function (_super) {
  6598. __extends(DelRow, _super);
  6599. function DelRow(index) {
  6600. return _super.call(this, index, null, null) || this;
  6601. }
  6602. /**
  6603. *
  6604. * @param {mxPoint} p
  6605. * @param {com.mxgraph.io.vsdx.Shape} shape
  6606. * @return {string}
  6607. */
  6608. DelRow.prototype.handle = function (p, shape) {
  6609. return "";
  6610. };
  6611. return DelRow;
  6612. }(com.mxgraph.io.vsdx.geometry.Row));
  6613. geometry.DelRow = DelRow;
  6614. DelRow["__class"] = "com.mxgraph.io.vsdx.geometry.DelRow";
  6615. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  6616. })(vsdx = io.vsdx || (io.vsdx = {}));
  6617. })(io = mxgraph.io || (mxgraph.io = {}));
  6618. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6619. })(com || (com = {}));
  6620. (function (com) {
  6621. var mxgraph;
  6622. (function (mxgraph) {
  6623. var io;
  6624. (function (io) {
  6625. var vsdx;
  6626. (function (vsdx) {
  6627. var geometry;
  6628. (function (geometry) {
  6629. var Ellipse = (function (_super) {
  6630. __extends(Ellipse, _super);
  6631. function Ellipse(index, x, y, a, b, c, d) {
  6632. var _this = _super.call(this, index, x, y) || this;
  6633. _this.a = a;
  6634. _this.b = b;
  6635. _this.c = c;
  6636. _this.d = d;
  6637. return _this;
  6638. }
  6639. /**
  6640. *
  6641. * @param {mxPoint} p
  6642. * @param {com.mxgraph.io.vsdx.Shape} shape
  6643. * @return {string}
  6644. */
  6645. Ellipse.prototype.handle = function (p, shape) {
  6646. if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) {
  6647. var h = shape.getHeight();
  6648. var w = shape.getWidth();
  6649. var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6650. var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6651. y = h - y;
  6652. var a = this.a * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6653. var b = this.b * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6654. b = h - b;
  6655. var c = this.c * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6656. var d = this.d * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6657. d = h - d;
  6658. var dx1 = Math.abs(a - x);
  6659. var dy1 = Math.abs(b - y);
  6660. var r1 = Math.sqrt(dx1 * dx1 + dy1 * dy1);
  6661. var dx2 = Math.abs(c - x);
  6662. var dy2 = Math.abs(d - y);
  6663. var r2 = Math.sqrt(dx2 * dx2 + dy2 * dy2);
  6664. var newX = x * 100 / w;
  6665. var newY = y * 100 / h;
  6666. var newW = (r1 * 100 / w) / 2;
  6667. var newH = (r2 * 100 / h) / 2;
  6668. newH = Math.round(newH * 100.0) / 100.0;
  6669. newW = Math.round(newW * 100.0) / 100.0;
  6670. var newX1 = Math.round((newX - 2 * newW) * 100.0) / 100.0;
  6671. var newX2 = Math.round((newX + 2 * newW) * 100.0) / 100.0;
  6672. newY = Math.round(newY * 100.0) / 100.0;
  6673. return "<move x=\"" + new String(newX1).toString() + "\" y=\"" + new String(newY).toString() + "\"/><arc rx=\"" + new String(newW).toString() + "\" ry=\"" + new String(newH).toString() + "\" x=\"" + new String(newX2).toString() + "\" y=\"" + new String(newY).toString() + "\" x-axis-rotation=\"0\" large-arc-flag=\"1\" sweep-flag=\"0\"/><arc rx=\"" + new String(newW).toString() + "\" ry=\"" + new String(newH).toString() + "\" x=\"" + new String(newX1).toString() + "\" y=\"" + new String(newY).toString() + "\" x-axis-rotation=\"0\" large-arc-flag=\"1\" sweep-flag=\"0\"/>";
  6674. }
  6675. return "";
  6676. };
  6677. return Ellipse;
  6678. }(com.mxgraph.io.vsdx.geometry.Row));
  6679. geometry.Ellipse = Ellipse;
  6680. Ellipse["__class"] = "com.mxgraph.io.vsdx.geometry.Ellipse";
  6681. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  6682. })(vsdx = io.vsdx || (io.vsdx = {}));
  6683. })(io = mxgraph.io || (mxgraph.io = {}));
  6684. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6685. })(com || (com = {}));
  6686. (function (com) {
  6687. var mxgraph;
  6688. (function (mxgraph) {
  6689. var io;
  6690. (function (io) {
  6691. var vsdx;
  6692. (function (vsdx) {
  6693. var geometry;
  6694. (function (geometry) {
  6695. var EllipticalArcTo = (function (_super) {
  6696. __extends(EllipticalArcTo, _super);
  6697. function EllipticalArcTo(index, x, y, a, b, c, d) {
  6698. var _this = _super.call(this, index, x, y) || this;
  6699. _this.a = a;
  6700. _this.b = b;
  6701. _this.c = c;
  6702. _this.d = d;
  6703. return _this;
  6704. }
  6705. /**
  6706. *
  6707. * @param {mxPoint} p
  6708. * @param {com.mxgraph.io.vsdx.Shape} shape
  6709. * @return {string}
  6710. */
  6711. EllipticalArcTo.prototype.handle = function (p, shape) {
  6712. if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) {
  6713. var h = shape.getHeight();
  6714. var w = shape.getWidth();
  6715. var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6716. var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6717. y = h - y;
  6718. var a = this.a * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6719. var b = this.b * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6720. var c = this.c;
  6721. var d = this.d;
  6722. x = x * 100.0 / w;
  6723. y = y * 100.0 / h;
  6724. var x1 = shape.getLastX() * w / 100.0;
  6725. var y1 = shape.getLastY() * h / 100.0;
  6726. var x2 = x * w / 100.0;
  6727. var y2 = y * h / 100.0;
  6728. var x3 = a;
  6729. var y3 = h - b;
  6730. var ang = -c;
  6731. var p1x = Math.sqrt(x1 * x1 + y1 * y1) * Math.cos(Math.atan2(y1, x1) - ang);
  6732. var p1y = Math.sqrt(x1 * x1 + y1 * y1) * Math.sin(Math.atan2(y1, x1) - ang);
  6733. var p2x = Math.sqrt(x2 * x2 + y2 * y2) * Math.cos(Math.atan2(y2, x2) - ang);
  6734. var p2y = Math.sqrt(x2 * x2 + y2 * y2) * Math.sin(Math.atan2(y2, x2) - ang);
  6735. var p3x = Math.sqrt(x3 * x3 + y3 * y3) * Math.cos(Math.atan2(y3, x3) - ang);
  6736. var p3y = Math.sqrt(x3 * x3 + y3 * y3) * Math.sin(Math.atan2(y3, x3) - ang);
  6737. var p0x = ((p1x - p2x) * (p1x + p2x) * (p2y - p3y) - (p2x - p3x) * (p2x + p3x) * (p1y - p2y) + d * d * (p1y - p2y) * (p2y - p3y) * (p1y - p3y)) / (2 * ((p1x - p2x) * (p2y - p3y) - (p2x - p3x) * (p1y - p2y)));
  6738. var p0y = ((p1x - p2x) * (p2x - p3x) * (p1x - p3x) / (d * d) + (p2x - p3x) * (p1y - p2y) * (p1y + p2y) - (p1x - p2x) * (p2y - p3y) * (p2y + p3y)) / (2 * ((p2x - p3x) * (p1y - p2y) - (p1x - p2x) * (p2y - p3y)));
  6739. var newX = Math.sqrt(p0x * p0x + p0y * p0y) * Math.cos(Math.atan2(p0y, p0x) + ang);
  6740. var newY = Math.sqrt(p0x * p0x + p0y * p0y) * Math.sin(Math.atan2(p0y, p0x) + ang);
  6741. newX = newX * w / 100.0;
  6742. newY = newY * h / 100.0;
  6743. var dx = p1x - p0x;
  6744. var dy = p1y - p0y;
  6745. var rx = Math.sqrt(dx * dx + dy * dy * d * d);
  6746. var ry = rx / d;
  6747. var rot = (function (x) { return x * 180 / Math.PI; })(ang);
  6748. rx = rx * 100.0 / w;
  6749. ry = ry * 100.0 / h;
  6750. x = Math.round(x * 100.0) / 100.0;
  6751. y = Math.round(y * 100.0) / 100.0;
  6752. rx = Math.round(rx * 100.0) / 100.0;
  6753. ry = Math.round(ry * 100.0) / 100.0;
  6754. rot = Math.round(rot * 100.0) / 100.0;
  6755. var sweep = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1);
  6756. var sf = (sweep > 0) ? "0" : "1";
  6757. var laf = "0";
  6758. if (com.mxgraph.io.vsdx.mxVsdxUtils.isInsideTriangle(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y)) // && this.isReflexAngle(p0x, p0y, p1x, p1y, p2x, p2y, p3x, p3y)) { //Inside triangle works alone in all test cases so far
  6759. {
  6760. laf = "1";
  6761. }
  6762. shape.setLastX(x);
  6763. shape.setLastY(y);
  6764. return "<arc rx=\"" + new String(rx).toString() + "\" ry=\"" + new String(ry).toString() + "\" x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\" x-axis-rotation=\"" + new String(rot).toString() + "\" large-arc-flag=\"" + laf + "\" sweep-flag=\"" + sf + "\"/>";
  6765. }
  6766. return "";
  6767. };
  6768. /**
  6769. * @param {number} x0 y0 center point of ellipse containing the arc
  6770. * @param {number} x1 y1 starting point of the arc
  6771. * @param {number} x2 y2 endpoint of the arc
  6772. * @param {number} x3 y3 control point
  6773. * @return {boolean} true if the start to end angle that contains the control point is a reflex angle
  6774. * @param {number} y0
  6775. * @param {number} y1
  6776. * @param {number} y2
  6777. * @param {number} y3
  6778. */
  6779. EllipticalArcTo.prototype.isReflexAngle = function (x0, y0, x1, y1, x2, y2, x3, y3) {
  6780. x1 = x1 - x0;
  6781. y1 = y1 - y0;
  6782. x2 = x2 - x0;
  6783. y2 = y2 - y0;
  6784. x2 = x3 - x0;
  6785. y3 = y3 - y0;
  6786. x0 = 0;
  6787. y0 = 0;
  6788. var aStart = (function (x) { return x * 180 / Math.PI; })(Math.atan2(y1, x1) - Math.atan2(y0, x0));
  6789. var aEnd = (function (x) { return x * 180 / Math.PI; })(Math.atan2(y2, x2) - Math.atan2(y0, x0));
  6790. var aCP = (function (x) { return x * 180 / Math.PI; })(Math.atan2(y3, x3) - Math.atan2(y0, x0));
  6791. aStart = (aStart - aCP) % 360;
  6792. aEnd = (aEnd - aCP) % 360;
  6793. if (aStart > 180) {
  6794. aStart = aStart - 360;
  6795. }
  6796. else if (aStart < -180) {
  6797. aStart = aStart + 360;
  6798. }
  6799. if (aEnd > 180) {
  6800. aEnd = aEnd - 360;
  6801. }
  6802. else if (aEnd < -180) {
  6803. aEnd = aEnd + 360;
  6804. }
  6805. if ((aStart > 0 && aEnd < 0) || (aStart < 0 && aEnd > 0)) {
  6806. if (Math.abs(aStart - aEnd) > 180) {
  6807. return true;
  6808. }
  6809. }
  6810. return false;
  6811. };
  6812. return EllipticalArcTo;
  6813. }(com.mxgraph.io.vsdx.geometry.Row));
  6814. geometry.EllipticalArcTo = EllipticalArcTo;
  6815. EllipticalArcTo["__class"] = "com.mxgraph.io.vsdx.geometry.EllipticalArcTo";
  6816. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  6817. })(vsdx = io.vsdx || (io.vsdx = {}));
  6818. })(io = mxgraph.io || (mxgraph.io = {}));
  6819. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6820. })(com || (com = {}));
  6821. (function (com) {
  6822. var mxgraph;
  6823. (function (mxgraph) {
  6824. var io;
  6825. (function (io) {
  6826. var vsdx;
  6827. (function (vsdx) {
  6828. var geometry;
  6829. (function (geometry) {
  6830. var InfiniteLine = (function (_super) {
  6831. __extends(InfiniteLine, _super);
  6832. function InfiniteLine(index, x, y, a, b) {
  6833. var _this = _super.call(this, index, x, y) || this;
  6834. _this.a = a;
  6835. _this.b = b;
  6836. return _this;
  6837. }
  6838. /**
  6839. *
  6840. * @param {mxPoint} p
  6841. * @param {com.mxgraph.io.vsdx.Shape} shape
  6842. * @return {string}
  6843. */
  6844. InfiniteLine.prototype.handle = function (p, shape) {
  6845. return "";
  6846. };
  6847. return InfiniteLine;
  6848. }(com.mxgraph.io.vsdx.geometry.Row));
  6849. geometry.InfiniteLine = InfiniteLine;
  6850. InfiniteLine["__class"] = "com.mxgraph.io.vsdx.geometry.InfiniteLine";
  6851. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  6852. })(vsdx = io.vsdx || (io.vsdx = {}));
  6853. })(io = mxgraph.io || (mxgraph.io = {}));
  6854. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6855. })(com || (com = {}));
  6856. (function (com) {
  6857. var mxgraph;
  6858. (function (mxgraph) {
  6859. var io;
  6860. (function (io) {
  6861. var vsdx;
  6862. (function (vsdx) {
  6863. var geometry;
  6864. (function (geometry) {
  6865. var LineTo = (function (_super) {
  6866. __extends(LineTo, _super);
  6867. function LineTo(index, x, y) {
  6868. return _super.call(this, index, x, y) || this;
  6869. }
  6870. /**
  6871. *
  6872. * @param {mxPoint} p
  6873. * @param {com.mxgraph.io.vsdx.Shape} shape
  6874. * @return {string}
  6875. */
  6876. LineTo.prototype.handle = function (p, shape) {
  6877. var x = p.x;
  6878. var y = p.y;
  6879. var h = shape.getHeight();
  6880. var w = shape.getWidth();
  6881. if (this.x != null && this.y != null) {
  6882. x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6883. y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6884. }
  6885. x = x * 100.0 / w;
  6886. y = y * 100.0 / h;
  6887. y = 100 - y;
  6888. x = Math.round(x * 100.0) / 100.0;
  6889. y = Math.round(y * 100.0) / 100.0;
  6890. p.x = (x);
  6891. p.y = (y);
  6892. shape.setLastX(x);
  6893. shape.setLastY(y);
  6894. return "<line x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>";
  6895. };
  6896. return LineTo;
  6897. }(com.mxgraph.io.vsdx.geometry.Row));
  6898. geometry.LineTo = LineTo;
  6899. LineTo["__class"] = "com.mxgraph.io.vsdx.geometry.LineTo";
  6900. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  6901. })(vsdx = io.vsdx || (io.vsdx = {}));
  6902. })(io = mxgraph.io || (mxgraph.io = {}));
  6903. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6904. })(com || (com = {}));
  6905. (function (com) {
  6906. var mxgraph;
  6907. (function (mxgraph) {
  6908. var io;
  6909. (function (io) {
  6910. var vsdx;
  6911. (function (vsdx) {
  6912. var geometry;
  6913. (function (geometry) {
  6914. var MoveTo = (function (_super) {
  6915. __extends(MoveTo, _super);
  6916. function MoveTo(index, x, y) {
  6917. return _super.call(this, index, x, y) || this;
  6918. }
  6919. /**
  6920. *
  6921. * @param {mxPoint} p
  6922. * @param {com.mxgraph.io.vsdx.Shape} shape
  6923. * @return {string}
  6924. */
  6925. MoveTo.prototype.handle = function (p, shape) {
  6926. var x = p.x;
  6927. var y = p.y;
  6928. var h = shape.getHeight();
  6929. var w = shape.getWidth();
  6930. if (this.x != null && this.y != null) {
  6931. x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6932. y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6933. }
  6934. x = x * 100.0 / w;
  6935. y = y * 100.0 / h;
  6936. y = 100 - y;
  6937. x = Math.round(x * 100.0) / 100.0;
  6938. y = Math.round(y * 100.0) / 100.0;
  6939. p.x = (x);
  6940. p.y = (y);
  6941. shape.setLastX(x);
  6942. shape.setLastY(y);
  6943. shape.setLastMoveX(x);
  6944. shape.setLastMoveY(y);
  6945. return "<move x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>";
  6946. };
  6947. return MoveTo;
  6948. }(com.mxgraph.io.vsdx.geometry.Row));
  6949. geometry.MoveTo = MoveTo;
  6950. MoveTo["__class"] = "com.mxgraph.io.vsdx.geometry.MoveTo";
  6951. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  6952. })(vsdx = io.vsdx || (io.vsdx = {}));
  6953. })(io = mxgraph.io || (mxgraph.io = {}));
  6954. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  6955. })(com || (com = {}));
  6956. (function (com) {
  6957. var mxgraph;
  6958. (function (mxgraph) {
  6959. var io;
  6960. (function (io) {
  6961. var vsdx;
  6962. (function (vsdx) {
  6963. var geometry;
  6964. (function (geometry) {
  6965. var NURBSTo = (function (_super) {
  6966. __extends(NURBSTo, _super);
  6967. function NURBSTo(index, x, y, a, b, c, d, e) {
  6968. var _this = _super.call(this, index, x, y) || this;
  6969. _this.a = a;
  6970. _this.b = b;
  6971. _this.c = c;
  6972. _this.d = d;
  6973. _this.formulaE = e;
  6974. return _this;
  6975. }
  6976. /**
  6977. * Helper class for geometry
  6978. * @param {mxPoint} p
  6979. * @param {com.mxgraph.io.vsdx.Shape} shape
  6980. * @return {string}
  6981. */
  6982. NURBSTo.prototype.handle = function (p, shape) {
  6983. if (this.x != null && this.y != null && this.formulaE != null) {
  6984. var h = shape.getHeight();
  6985. var w = shape.getWidth();
  6986. var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6987. var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  6988. var eValue = this.formulaE.split("NURBS(").join("");
  6989. eValue = eValue.split(")").join("");
  6990. var nurbs = new NURBSTo.Nurbs(this, eValue, w, h);
  6991. if (nurbs.getSize() >= 2) {
  6992. var x1 = nurbs.getX(0);
  6993. var y1 = nurbs.getY(0);
  6994. var x2 = nurbs.getX(1);
  6995. var y2 = nurbs.getY(1);
  6996. y = y * 100.0 / h;
  6997. x = x * 100.0 / w;
  6998. y = 100 - y;
  6999. x = Math.round(x * 100.0) / 100.0;
  7000. y = Math.round(y * 100.0) / 100.0;
  7001. x1 = Math.round(x1 * 100.0) / 100.0;
  7002. y1 = Math.round(y1 * 100.0) / 100.0;
  7003. x2 = Math.round(x2 * 100.0) / 100.0;
  7004. y2 = Math.round(y2 * 100.0) / 100.0;
  7005. shape.setLastX(x);
  7006. shape.setLastY(y);
  7007. if (nurbs.getDegree() === 3 && nurbs.isOrderedByThree(this.getA())) {
  7008. var cp1 = ([]);
  7009. var cp2 = ([]);
  7010. var nut = ([]);
  7011. var nurbsize = nurbs.getSize();
  7012. for (var i = 0; i < nurbsize - 1; i = i + 3) {
  7013. /* add */ (cp1.push(new mxPoint(nurbs.getX(i), nurbs.getY(i))));
  7014. /* add */ (cp2.push(new mxPoint(nurbs.getX(i + 1), nurbs.getY(i + 1))));
  7015. if (i < nurbsize - 2) {
  7016. /* add */ (nut.push(new mxPoint(nurbs.getX(i + 2), nurbs.getY(i + 2))));
  7017. }
  7018. else {
  7019. /* add */ (nut.push(new mxPoint(x, y)));
  7020. }
  7021. }
  7022. ;
  7023. var result = "";
  7024. for (var i = 0; i < cp1.length; i++) {
  7025. result += "<curve x1=\"" + cp1[i].x + "\" y1=\"" + cp1[i].y + "\" x2=\"" + cp2[i].x + "\" y2=\"" + cp2[i].y + "\" x3=\"" + nut[i].x + "\" y3=\"" + nut[i].y + "\"/>\n";
  7026. }
  7027. ;
  7028. return result;
  7029. }
  7030. else {
  7031. return "<curve x1=\"" + new String(x1).toString() + "\" y1=\"" + new String(y1).toString() + "\" x2=\"" + new String(x2).toString() + "\" y2=\"" + new String(y2).toString() + "\" x3=\"" + new String(x).toString() + "\" y3=\"" + new String(y).toString() + "\"/>";
  7032. }
  7033. }
  7034. }
  7035. return "";
  7036. };
  7037. return NURBSTo;
  7038. }(com.mxgraph.io.vsdx.geometry.Row));
  7039. geometry.NURBSTo = NURBSTo;
  7040. NURBSTo["__class"] = "com.mxgraph.io.vsdx.geometry.NURBSTo";
  7041. (function (NURBSTo) {
  7042. /**
  7043. * Holds the NURBS array that is part of the VSDX NURBSTo element, together with some helper functions
  7044. * @param {string} s
  7045. * @param {number} w
  7046. * @param {number} h
  7047. * @class
  7048. */
  7049. var Nurbs = (function () {
  7050. function Nurbs(__parent, s, w, h) {
  7051. this.__parent = __parent;
  7052. this.nurbsValues = ([]);
  7053. var n = s.split(/\s*,\s*/).slice(0);
  7054. for (var i = 0; i < n.length; i++) {
  7055. if ((i > 3) && (i % 4 === 0)) {
  7056. /* add */ (this.nurbsValues.push(/* parseDouble */ parseFloat(/* get */ n[i]) * 100.0));
  7057. }
  7058. else if ((i > 3) && (i % 4 === 1)) {
  7059. /* add */ (this.nurbsValues.push(100 - parseFloat(/* get */ n[i]) * 100.0));
  7060. }
  7061. else {
  7062. /* add */ (this.nurbsValues.push(/* parseDouble */ parseFloat(/* get */ n[i])));
  7063. }
  7064. }
  7065. ;
  7066. }
  7067. /**
  7068. * @param {number} lastKnot the last knot outside of the nurbs string. Obtain it with this.getA()
  7069. * @return {boolean} true if knots are ordered by sets of 3
  7070. */
  7071. Nurbs.prototype.isOrderedByThree = function (lastKnot) {
  7072. for (var i = 0; i + 2 < (this.getSize()); i = i + 3) {
  7073. var k_1 = Math.round(this.getKnot((i)) * 100.0) / 100.0;
  7074. var k1_1 = Math.round(this.getKnot((i + 1)) * 100.0) / 100.0;
  7075. var k2 = Math.round(this.getKnot((i + 2)) * 100.0) / 100.0;
  7076. if (k_1 !== k1_1 || k_1 !== k2 || k1_1 !== k2) {
  7077. return false;
  7078. }
  7079. }
  7080. ;
  7081. var k = Math.round(this.getKnot((this.getSize() - 2)) * 10.0) / 10.0;
  7082. var k1 = Math.round(this.getKnot((this.getSize() - 1)) * 10.0) / 10.0;
  7083. var lk = Math.round(lastKnot * 10.0) / 10.0;
  7084. if (k !== k1 || k !== lk || k1 !== lk) {
  7085. return false;
  7086. }
  7087. return true;
  7088. };
  7089. /**
  7090. * @return {number} number of points, not including the last one (which is outside of the nurbs string)
  7091. */
  7092. Nurbs.prototype.getSize = function () {
  7093. return (((this.nurbsValues.length / 4 | 0)) - 1);
  7094. };
  7095. /**
  7096. * @return {number} last knot (element knotLast)
  7097. */
  7098. Nurbs.prototype.getKnotLast = function () {
  7099. return this.nurbsValues[0];
  7100. };
  7101. /**
  7102. * @return {number} degree of the NURBS (element degree)
  7103. */
  7104. Nurbs.prototype.getDegree = function () {
  7105. return this.nurbsValues[1];
  7106. };
  7107. /**
  7108. * @return {number} 0 if X is relative, otherwise X is in the coordinate system of the shape (element xType)
  7109. */
  7110. Nurbs.prototype.getXType = function () {
  7111. return this.nurbsValues[2];
  7112. };
  7113. /**
  7114. * @return {number} 0 if Y is relative, otherwise Y is in the coordinate system of the shape (element yType)
  7115. */
  7116. Nurbs.prototype.getYType = function () {
  7117. return this.nurbsValues[3];
  7118. };
  7119. /**
  7120. * @return {number} the i-th X coordinate
  7121. * @param {number} i
  7122. */
  7123. Nurbs.prototype.getX = function (i) {
  7124. return this.nurbsValues[(i + 1) * 4];
  7125. };
  7126. /**
  7127. * @return {number} the i-th Y coordinate
  7128. * @param {number} i
  7129. */
  7130. Nurbs.prototype.getY = function (i) {
  7131. return this.nurbsValues[(i + 1) * 4 + 1];
  7132. };
  7133. /**
  7134. * @return {number} the i-th knot
  7135. * @param {number} i
  7136. */
  7137. Nurbs.prototype.getKnot = function (i) {
  7138. return this.nurbsValues[(i + 1) * 4 + 2];
  7139. };
  7140. /**
  7141. * @return {number} the i-th weight
  7142. * @param {number} i
  7143. */
  7144. Nurbs.prototype.getWeight = function (i) {
  7145. return this.nurbsValues[(i + 1) * 4 + 3];
  7146. };
  7147. return Nurbs;
  7148. }());
  7149. NURBSTo.Nurbs = Nurbs;
  7150. Nurbs["__class"] = "com.mxgraph.io.vsdx.geometry.NURBSTo.Nurbs";
  7151. })(NURBSTo = geometry.NURBSTo || (geometry.NURBSTo = {}));
  7152. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  7153. })(vsdx = io.vsdx || (io.vsdx = {}));
  7154. })(io = mxgraph.io || (mxgraph.io = {}));
  7155. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  7156. })(com || (com = {}));
  7157. (function (com) {
  7158. var mxgraph;
  7159. (function (mxgraph) {
  7160. var io;
  7161. (function (io) {
  7162. var vsdx;
  7163. (function (vsdx) {
  7164. var geometry;
  7165. (function (geometry) {
  7166. var PolylineTo = (function (_super) {
  7167. __extends(PolylineTo, _super);
  7168. function PolylineTo(index, x, y, a) {
  7169. var _this = _super.call(this, index, x, y) || this;
  7170. _this.formulaA = a;
  7171. return _this;
  7172. }
  7173. /**
  7174. *
  7175. * @param {mxPoint} p
  7176. * @param {com.mxgraph.io.vsdx.Shape} shape
  7177. * @return {string}
  7178. */
  7179. PolylineTo.prototype.handle = function (p, shape) {
  7180. var result = "";
  7181. if (this.x != null && this.y != null && this.formulaA != null) {
  7182. var h = shape.getHeight();
  7183. var w = shape.getWidth();
  7184. var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7185. var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7186. x = x * 100.0 / w;
  7187. y = y * 100.0 / h;
  7188. y = 100 - y;
  7189. x = Math.round(x * 100.0) / 100.0;
  7190. y = Math.round(y * 100.0) / 100.0;
  7191. var aValue = this.formulaA.replace(new RegExp("\\s", 'g'), "").toLowerCase().replace(new RegExp("polyline\\(", 'g'), "").replace(new RegExp("\\)", 'g'), "");
  7192. if ((function (o1, o2) { if (o1 && o1.equals) {
  7193. return o1.equals(o2);
  7194. }
  7195. else {
  7196. return o1 === o2;
  7197. } })(aValue, "inh")) {
  7198. throw Object.defineProperty(new Error(), '__classes', { configurable: true, value: ['java.lang.Throwable', 'java.lang.Object', 'java.lang.RuntimeException', 'java.lang.IllegalArgumentException', 'java.lang.Exception'] });
  7199. }
  7200. var polyEntriesList = (aValue.split(",").slice(0).slice(0));
  7201. var xRel = parseFloat(/* remove */ polyEntriesList.splice(0, 1));
  7202. var yRel = parseFloat(/* remove */ polyEntriesList.splice(0, 1));
  7203. var currX = 0;
  7204. var currY = 0;
  7205. while ((polyEntriesList.length > 0)) {
  7206. currX = parseFloat(/* remove */ polyEntriesList.splice(0, 1)) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7207. currY = parseFloat(/* remove */ polyEntriesList.splice(0, 1)) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7208. if (xRel === 1) {
  7209. currX = currX * 100.0 / w;
  7210. }
  7211. if (xRel === 1) {
  7212. currY = currY * 100.0 / h;
  7213. }
  7214. currY = 100 - currY;
  7215. currX = Math.round(currX * 100.0) / 100.0;
  7216. currY = Math.round(currY * 100.0) / 100.0;
  7217. shape.setLastX(currX);
  7218. shape.setLastY(currY);
  7219. result += "<line x=\"" + new String(currX).toString() + "\" y=\"" + new String(currY).toString() + "\"/>";
  7220. }
  7221. ;
  7222. result += "<line x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>";
  7223. if (shape.getLastMoveX() === x && shape.getLastMoveY() === y) {
  7224. result += "<close/>";
  7225. }
  7226. }
  7227. return result;
  7228. };
  7229. return PolylineTo;
  7230. }(com.mxgraph.io.vsdx.geometry.Row));
  7231. geometry.PolylineTo = PolylineTo;
  7232. PolylineTo["__class"] = "com.mxgraph.io.vsdx.geometry.PolylineTo";
  7233. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  7234. })(vsdx = io.vsdx || (io.vsdx = {}));
  7235. })(io = mxgraph.io || (mxgraph.io = {}));
  7236. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  7237. })(com || (com = {}));
  7238. (function (com) {
  7239. var mxgraph;
  7240. (function (mxgraph) {
  7241. var io;
  7242. (function (io) {
  7243. var vsdx;
  7244. (function (vsdx) {
  7245. var geometry;
  7246. (function (geometry) {
  7247. var RelCubBezTo = (function (_super) {
  7248. __extends(RelCubBezTo, _super);
  7249. function RelCubBezTo(index, x, y, a, b, c, d) {
  7250. var _this = _super.call(this, index, x, y) || this;
  7251. _this.a = a;
  7252. _this.b = b;
  7253. _this.c = c;
  7254. _this.d = d;
  7255. return _this;
  7256. }
  7257. /**
  7258. *
  7259. * @param {mxPoint} p
  7260. * @param {com.mxgraph.io.vsdx.Shape} shape
  7261. * @return {string}
  7262. */
  7263. RelCubBezTo.prototype.handle = function (p, shape) {
  7264. if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) {
  7265. var x = this.x * 100;
  7266. var y = 100 - this.y * 100;
  7267. var x1 = this.a * 100.0;
  7268. var y1 = 100 - this.b * 100.0;
  7269. var x2 = this.c * 100.0;
  7270. var y2 = 100 - this.d * 100.0;
  7271. x = Math.round(x * 100.0) / 100.0;
  7272. y = Math.round(y * 100.0) / 100.0;
  7273. x1 = Math.round(x1 * 100.0) / 100.0;
  7274. y1 = Math.round(y1 * 100.0) / 100.0;
  7275. x2 = Math.round(x2 * 100.0) / 100.0;
  7276. y2 = Math.round(y2 * 100.0) / 100.0;
  7277. shape.setLastX(x);
  7278. shape.setLastY(y);
  7279. return "<curve x1=\"" + new String(x1).toString() + "\" y1=\"" + new String(y1).toString() + "\" x2=\"" + new String(x2).toString() + "\" y2=\"" + new String(y2).toString() + "\" x3=\"" + new String(x).toString() + "\" y3=\"" + new String(y).toString() + "\"/>";
  7280. }
  7281. return "";
  7282. };
  7283. return RelCubBezTo;
  7284. }(com.mxgraph.io.vsdx.geometry.Row));
  7285. geometry.RelCubBezTo = RelCubBezTo;
  7286. RelCubBezTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelCubBezTo";
  7287. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  7288. })(vsdx = io.vsdx || (io.vsdx = {}));
  7289. })(io = mxgraph.io || (mxgraph.io = {}));
  7290. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  7291. })(com || (com = {}));
  7292. (function (com) {
  7293. var mxgraph;
  7294. (function (mxgraph) {
  7295. var io;
  7296. (function (io) {
  7297. var vsdx;
  7298. (function (vsdx) {
  7299. var geometry;
  7300. (function (geometry) {
  7301. var RelLineTo = (function (_super) {
  7302. __extends(RelLineTo, _super);
  7303. function RelLineTo(index, x, y) {
  7304. return _super.call(this, index, x, y) || this;
  7305. }
  7306. /**
  7307. *
  7308. * @param {mxPoint} p
  7309. * @param {com.mxgraph.io.vsdx.Shape} shape
  7310. * @return {string}
  7311. */
  7312. RelLineTo.prototype.handle = function (p, shape) {
  7313. var x = p.x;
  7314. var y = p.y;
  7315. if (this.x != null && this.y != null) {
  7316. x = this.x * 100;
  7317. y = 100 - this.y * 100;
  7318. }
  7319. x = Math.round(x * 100.0) / 100.0;
  7320. y = Math.round(y * 100.0) / 100.0;
  7321. p.x = (x);
  7322. p.y = (y);
  7323. shape.setLastX(x);
  7324. shape.setLastY(y);
  7325. return "<line x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>";
  7326. };
  7327. return RelLineTo;
  7328. }(com.mxgraph.io.vsdx.geometry.Row));
  7329. geometry.RelLineTo = RelLineTo;
  7330. RelLineTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelLineTo";
  7331. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  7332. })(vsdx = io.vsdx || (io.vsdx = {}));
  7333. })(io = mxgraph.io || (mxgraph.io = {}));
  7334. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  7335. })(com || (com = {}));
  7336. (function (com) {
  7337. var mxgraph;
  7338. (function (mxgraph) {
  7339. var io;
  7340. (function (io) {
  7341. var vsdx;
  7342. (function (vsdx) {
  7343. var geometry;
  7344. (function (geometry) {
  7345. var RelMoveTo = (function (_super) {
  7346. __extends(RelMoveTo, _super);
  7347. function RelMoveTo(index, x, y) {
  7348. return _super.call(this, index, x, y) || this;
  7349. }
  7350. /**
  7351. *
  7352. * @param {mxPoint} p
  7353. * @param {com.mxgraph.io.vsdx.Shape} shape
  7354. * @return {string}
  7355. */
  7356. RelMoveTo.prototype.handle = function (p, shape) {
  7357. var x = p.x;
  7358. var y = p.y;
  7359. if (this.x != null && this.y != null) {
  7360. x = this.x * 100;
  7361. y = 100 - this.y * 100;
  7362. }
  7363. x = Math.round(x * 100.0) / 100.0;
  7364. y = Math.round(y * 100.0) / 100.0;
  7365. p.x = (x);
  7366. p.y = (y);
  7367. shape.setLastX(x);
  7368. shape.setLastY(y);
  7369. shape.setLastMoveX(x);
  7370. shape.setLastMoveY(y);
  7371. return "<move x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>";
  7372. };
  7373. return RelMoveTo;
  7374. }(com.mxgraph.io.vsdx.geometry.Row));
  7375. geometry.RelMoveTo = RelMoveTo;
  7376. RelMoveTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelMoveTo";
  7377. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  7378. })(vsdx = io.vsdx || (io.vsdx = {}));
  7379. })(io = mxgraph.io || (mxgraph.io = {}));
  7380. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  7381. })(com || (com = {}));
  7382. (function (com) {
  7383. var mxgraph;
  7384. (function (mxgraph) {
  7385. var io;
  7386. (function (io) {
  7387. var vsdx;
  7388. (function (vsdx) {
  7389. var geometry;
  7390. (function (geometry) {
  7391. var RelQuadBezTo = (function (_super) {
  7392. __extends(RelQuadBezTo, _super);
  7393. function RelQuadBezTo(index, x, y, a, b) {
  7394. var _this = _super.call(this, index, x, y) || this;
  7395. _this.a = a;
  7396. _this.b = b;
  7397. return _this;
  7398. }
  7399. /**
  7400. *
  7401. * @param {mxPoint} p
  7402. * @param {com.mxgraph.io.vsdx.Shape} shape
  7403. * @return {string}
  7404. */
  7405. RelQuadBezTo.prototype.handle = function (p, shape) {
  7406. if (this.x != null && this.y != null && this.a != null && this.b != null) {
  7407. var x = this.x * 100;
  7408. var y = 100 - this.y * 100;
  7409. var x1 = this.a * 100.0;
  7410. var y1 = 100 - this.b * 100.0;
  7411. x = Math.round(x * 100.0) / 100.0;
  7412. y = Math.round(y * 100.0) / 100.0;
  7413. x1 = Math.round(x1 * 100.0) / 100.0;
  7414. y1 = Math.round(y1 * 100.0) / 100.0;
  7415. shape.setLastX(x);
  7416. shape.setLastY(y);
  7417. return "<quad x1=\"" + new String(x1).toString() + "\" y1=\"" + new String(y1).toString() + "\" x2=\"" + new String(x).toString() + "\" y2=\"" + new String(y).toString() + "\"/>";
  7418. }
  7419. return "";
  7420. };
  7421. return RelQuadBezTo;
  7422. }(com.mxgraph.io.vsdx.geometry.Row));
  7423. geometry.RelQuadBezTo = RelQuadBezTo;
  7424. RelQuadBezTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelQuadBezTo";
  7425. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  7426. })(vsdx = io.vsdx || (io.vsdx = {}));
  7427. })(io = mxgraph.io || (mxgraph.io = {}));
  7428. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  7429. })(com || (com = {}));
  7430. (function (com) {
  7431. var mxgraph;
  7432. (function (mxgraph) {
  7433. var io;
  7434. (function (io) {
  7435. var vsdx;
  7436. (function (vsdx) {
  7437. var geometry;
  7438. (function (geometry) {
  7439. var SplineKnot = (function (_super) {
  7440. __extends(SplineKnot, _super);
  7441. function SplineKnot(index, x, y, a) {
  7442. var _this = _super.call(this, index, x, y) || this;
  7443. _this.a = a;
  7444. return _this;
  7445. }
  7446. /**
  7447. *
  7448. * @param {mxPoint} p
  7449. * @param {com.mxgraph.io.vsdx.Shape} shape
  7450. * @return {string}
  7451. */
  7452. SplineKnot.prototype.handle = function (p, shape) {
  7453. if (this.x != null && this.y != null && this.a != null) {
  7454. var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7455. var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7456. var a = this.a;
  7457. var knot = a;
  7458. y = 100 - y;
  7459. x = Math.round(x * 100.0) / 100.0;
  7460. y = Math.round(y * 100.0) / 100.0;
  7461. knot = Math.round(knot * 100.0) / 100.0;
  7462. shape.setLastX(x);
  7463. shape.setLastY(y);
  7464. }
  7465. return "";
  7466. };
  7467. return SplineKnot;
  7468. }(com.mxgraph.io.vsdx.geometry.Row));
  7469. geometry.SplineKnot = SplineKnot;
  7470. SplineKnot["__class"] = "com.mxgraph.io.vsdx.geometry.SplineKnot";
  7471. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  7472. })(vsdx = io.vsdx || (io.vsdx = {}));
  7473. })(io = mxgraph.io || (mxgraph.io = {}));
  7474. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  7475. })(com || (com = {}));
  7476. (function (com) {
  7477. var mxgraph;
  7478. (function (mxgraph) {
  7479. var io;
  7480. (function (io) {
  7481. var vsdx;
  7482. (function (vsdx) {
  7483. var geometry;
  7484. (function (geometry) {
  7485. var SplineStart = (function (_super) {
  7486. __extends(SplineStart, _super);
  7487. function SplineStart(index, x, y, a, b, c, d) {
  7488. var _this = _super.call(this, index, x, y) || this;
  7489. _this.a = a;
  7490. _this.b = b;
  7491. _this.c = c;
  7492. _this.d = d;
  7493. return _this;
  7494. }
  7495. /**
  7496. *
  7497. * @param {mxPoint} p
  7498. * @param {com.mxgraph.io.vsdx.Shape} shape
  7499. * @return {string}
  7500. */
  7501. SplineStart.prototype.handle = function (p, shape) {
  7502. if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) {
  7503. var h = shape.getHeight();
  7504. var w = shape.getWidth();
  7505. var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7506. var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7507. var c = this.c;
  7508. var d = (this.d | 0);
  7509. var lastKnot = c;
  7510. shape.setLastKnot(lastKnot);
  7511. var degree = d;
  7512. y = 100 - y;
  7513. x = Math.round(x * 100.0) / 100.0;
  7514. y = Math.round(y * 100.0) / 100.0;
  7515. lastKnot = Math.round(lastKnot * 100.0) / 100.0;
  7516. var x0 = shape.getLastX() * w / 100.0;
  7517. var y0 = shape.getLastY() * h / 100.0;
  7518. shape.setLastX(x);
  7519. shape.setLastY(y);
  7520. return "<curve ";
  7521. }
  7522. return "";
  7523. };
  7524. return SplineStart;
  7525. }(com.mxgraph.io.vsdx.geometry.Row));
  7526. geometry.SplineStart = SplineStart;
  7527. SplineStart["__class"] = "com.mxgraph.io.vsdx.geometry.SplineStart";
  7528. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  7529. })(vsdx = io.vsdx || (io.vsdx = {}));
  7530. })(io = mxgraph.io || (mxgraph.io = {}));
  7531. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  7532. })(com || (com = {}));
  7533. (function (com) {
  7534. var mxgraph;
  7535. (function (mxgraph) {
  7536. var io;
  7537. (function (io) {
  7538. var vsdx;
  7539. (function (vsdx) {
  7540. /**
  7541. * Create a new instance of mxGeneralShape
  7542. * @param {*} shape Shape Element to be wrapped.
  7543. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  7544. * @class
  7545. */
  7546. var Style = (function () {
  7547. function Style(shape, model) {
  7548. this.cellElements = ({});
  7549. this.sections = ({});
  7550. /**
  7551. * Mapping of line,text and fill styles to the style parents
  7552. */
  7553. this.styleParents = ({});
  7554. this.shape = null;
  7555. this.Id = null;
  7556. this.pm = null;
  7557. this.style = null;
  7558. this.shape = shape;
  7559. this.pm = model.getPropertiesManager();
  7560. var Id = shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID);
  7561. try {
  7562. this.Id = (Id != null && !(Id.length === 0)) ? parseFloat(Id) : -1;
  7563. }
  7564. catch (e) {
  7565. this.Id = -1;
  7566. }
  7567. ;
  7568. this.cacheCells(model);
  7569. this.stylesheetRefs(model);
  7570. }
  7571. Style.__static_initialize = function () { if (!Style.__static_initialized) {
  7572. Style.__static_initialized = true;
  7573. Style.__static_initializer_0();
  7574. Style.__static_initializer_1();
  7575. } };
  7576. Style.styleTypes_$LI$ = function () { Style.__static_initialize(); if (Style.styleTypes == null)
  7577. Style.styleTypes = ({}); return Style.styleTypes; };
  7578. ;
  7579. Style.__static_initializer_0 = function () {
  7580. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7581. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_BKGND] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7582. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_BKGND_TRANS] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7583. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_FOREGND] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7584. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_FOREGND_TRANS] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7585. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_PATTERN] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7586. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.SHDW_PATTERN] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7587. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7588. /* put */ (Style.styleTypes_$LI$()["QuickStyleFillColor"] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7589. /* put */ (Style.styleTypes_$LI$()["QuickStyleFillMatrix"] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE);
  7590. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7591. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7592. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7593. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7594. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR_TRANS] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7595. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_WEIGHT] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7596. /* put */ (Style.styleTypes_$LI$()["QuickStyleLineColor"] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7597. /* put */ (Style.styleTypes_$LI$()["QuickStyleLineMatrix"] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7598. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW_SIZE] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7599. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW_SIZE] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE);
  7600. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_BKGND] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE);
  7601. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.BOTTOM_MARGIN] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE);
  7602. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LEFT_MARGIN] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE);
  7603. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.RIGHT_MARGIN] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE);
  7604. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.TOP_MARGIN] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE);
  7605. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE);
  7606. /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE);
  7607. /* put */ (Style.styleTypes_$LI$()["QuickStyleFontColor"] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE);
  7608. /* put */ (Style.styleTypes_$LI$()["QuickStyleFontMatrix"] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE);
  7609. };
  7610. Style.prototype.getTheme = function () {
  7611. return null;
  7612. };
  7613. Style.prototype.getQuickStyleVals = function () {
  7614. return null;
  7615. };
  7616. Style.prototype.isVertex = function () {
  7617. return false;
  7618. };
  7619. Style.prototype.styleDebug = function (debug) {
  7620. if (Style.vsdxStyleDebug) {
  7621. console.info(debug);
  7622. }
  7623. };
  7624. Style.prototype.stylesheetRefs = function (model) {
  7625. /* put */ (this.styleParents[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE] = model.getStylesheet(this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE)));
  7626. /* put */ (this.styleParents[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE] = model.getStylesheet(this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE)));
  7627. /* put */ (this.styleParents[com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE] = model.getStylesheet(this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE)));
  7628. var style = model.getStylesheet("0");
  7629. this.style = style;
  7630. };
  7631. /**
  7632. * Checks if the shape Element has a children with tag name = 'tag'.
  7633. * @param tag Name of the Element to be found.
  7634. * @return {void} Returns <code>true</code> if the shape Element has a children with tag name = 'tag'
  7635. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  7636. */
  7637. Style.prototype.cacheCells = function (model) {
  7638. if (this.shape != null) {
  7639. var children = this.shape.childNodes;
  7640. if (children != null) {
  7641. var childNode = children.item(0);
  7642. while ((childNode != null)) {
  7643. if (childNode != null && (childNode.nodeType == 1)) {
  7644. this.parseShapeElem(childNode, model);
  7645. }
  7646. childNode = childNode.nextSibling;
  7647. }
  7648. ;
  7649. }
  7650. }
  7651. };
  7652. /**
  7653. * Caches the specified element
  7654. * @param {*} elem the element to cache
  7655. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  7656. */
  7657. Style.prototype.parseShapeElem = function (elem, model) {
  7658. var childName = elem.nodeName;
  7659. if ((function (o1, o2) { if (o1 && o1.equals) {
  7660. return o1.equals(o2);
  7661. }
  7662. else {
  7663. return o1 === o2;
  7664. } })(childName, "Cell")) {
  7665. /* put */ (this.cellElements[elem.getAttribute("N")] = elem);
  7666. }
  7667. else if ((function (o1, o2) { if (o1 && o1.equals) {
  7668. return o1.equals(o2);
  7669. }
  7670. else {
  7671. return o1 === o2;
  7672. } })(childName, "Section")) {
  7673. this.parseSection(elem);
  7674. }
  7675. };
  7676. /**
  7677. * Caches the specific section element
  7678. * @param {*} elem the element to cache
  7679. */
  7680. Style.prototype.parseSection = function (elem) {
  7681. var sect = new com.mxgraph.io.vsdx.Section(elem);
  7682. /* put */ (this.sections[elem.getAttribute("N")] = sect);
  7683. };
  7684. /**
  7685. * Checks if the 'primary' Element has a child with tag name = 'tag'.
  7686. * @param {string} tag Name of the Element to be found.
  7687. * @return {boolean} Returns <code>true</code> if the 'primary' Element has a child with tag name = 'tag'.
  7688. * @param {string} nodeName
  7689. */
  7690. Style.prototype.hasProperty = function (nodeName, tag) {
  7691. return this.cellElements.hasOwnProperty(tag);
  7692. };
  7693. /**
  7694. * Returns the value of the element
  7695. * @param {*} elem The element whose value is to be found
  7696. * @param {string} defaultValue the value to return if there is no value attribute
  7697. * @return {string} String value of the element, or the default value if no value found
  7698. */
  7699. Style.prototype.getValue = function (elem, defaultValue) {
  7700. if (elem != null) {
  7701. return elem.getAttribute("V") || "";
  7702. }
  7703. return defaultValue;
  7704. };
  7705. /**
  7706. * Returns the value of the element as a double
  7707. * @param elem The element whose value is to be found
  7708. * @param {number} defaultValue the value to return if there is no value attribute
  7709. * @return {number} double value of the element, or the default value if no value found
  7710. * @param {*} cell
  7711. */
  7712. Style.prototype.getValueAsDouble = function (cell, defaultValue) {
  7713. if (cell != null) {
  7714. var value = cell.getAttribute("V");
  7715. if (value != null) {
  7716. if ((function (o1, o2) { if (o1 && o1.equals) {
  7717. return o1.equals(o2);
  7718. }
  7719. else {
  7720. return o1 === o2;
  7721. } })(value, "Themed")) {
  7722. return 0;
  7723. }
  7724. try {
  7725. var parsedValue = parseFloat(value);
  7726. var units = cell.getAttribute("U");
  7727. if ((function (o1, o2) { if (o1 && o1.equals) {
  7728. return o1.equals(o2);
  7729. }
  7730. else {
  7731. return o1 === o2;
  7732. } })(units, "PT")) {
  7733. parsedValue = parsedValue * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7734. }
  7735. return Math.round(parsedValue * 100.0) / 100.0;
  7736. }
  7737. catch (e) {
  7738. //console.error(e.message, e);
  7739. }
  7740. ;
  7741. }
  7742. }
  7743. return defaultValue;
  7744. };
  7745. Style.prototype.getScreenNumericalValue$org_w3c_dom_Element$double = function (cell, defaultValue) {
  7746. if (cell != null) {
  7747. var value = cell.getAttribute("V");
  7748. if (value != null) {
  7749. try {
  7750. var parsedValue = parseFloat(value);
  7751. return this.getScreenNumericalValue$double(parsedValue);
  7752. }
  7753. catch (e) {
  7754. //console.error(e.message, e);
  7755. }
  7756. ;
  7757. }
  7758. }
  7759. return defaultValue;
  7760. };
  7761. /**
  7762. * Returns the value of the element as a double
  7763. * @param elem The element whose value is to be found
  7764. * @param {number} defaultValue the value to return if there is no value attribute
  7765. * @return {number} double value of the element, or the default value if no value found
  7766. * @param {*} cell
  7767. */
  7768. Style.prototype.getScreenNumericalValue = function (cell, defaultValue) {
  7769. if (((cell != null && (cell.nodeType == 1)) || cell === null) && ((typeof defaultValue === 'number') || defaultValue === null)) {
  7770. return this.getScreenNumericalValue$org_w3c_dom_Element$double(cell, defaultValue);
  7771. }
  7772. else if (((typeof cell === 'number') || cell === null) && defaultValue === undefined) {
  7773. return this.getScreenNumericalValue$double(cell);
  7774. }
  7775. else
  7776. throw new Error('invalid overload');
  7777. };
  7778. Style.prototype.getScreenNumericalValue$double = function (val) {
  7779. var conVal = val * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  7780. return conVal;
  7781. };
  7782. /**
  7783. * Returns the value of the attribute of the element with tag name = 'tag' in the children
  7784. * of the shape element<br/>
  7785. * @param {string} tag Name of the Element to be found.
  7786. * @return {string} Numerical value of the element.
  7787. * @param {string} attribute
  7788. * @param {string} defaultValue
  7789. */
  7790. Style.prototype.getAttribute = function (tag, attribute, defaultValue) {
  7791. var result = defaultValue;
  7792. var cell = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, tag);
  7793. if (cell != null) {
  7794. result = cell.getAttribute(attribute) || "";
  7795. }
  7796. return result;
  7797. };
  7798. Style.prototype.getChildValues = function (parent, requiredValues) {
  7799. var result = ({});
  7800. var child = parent.firstChild;
  7801. while ((child != null)) {
  7802. if (child != null && (child.nodeType == 1)) {
  7803. var childElem = child;
  7804. var childName = childElem.nodeName;
  7805. var name_9 = null;
  7806. var nodeValue = null;
  7807. if ((function (o1, o2) { if (o1 && o1.equals) {
  7808. return o1.equals(o2);
  7809. }
  7810. else {
  7811. return o1 === o2;
  7812. } })(childName, "Cell")) {
  7813. name_9 = childElem.getAttribute("N") || "";
  7814. nodeValue = childElem.getAttribute("V") || "";
  7815. }
  7816. else {
  7817. name_9 = childElem.nodeName;
  7818. nodeValue = childElem.textContent;
  7819. }
  7820. if (requiredValues != null) {
  7821. var nodeOverride = (function (m, k) { return m[k] ? m[k] : null; })(requiredValues, name_9);
  7822. if (nodeOverride != null) {
  7823. nodeValue = childElem.getAttribute(nodeOverride) || "";
  7824. }
  7825. }
  7826. /* put */ (result[name_9] = nodeValue);
  7827. }
  7828. child = child.nextSibling;
  7829. }
  7830. ;
  7831. return result;
  7832. };
  7833. Style.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String = function (cellKey, index, sectKey) {
  7834. var sect = (function (m, k) { return m[k] ? m[k] : null; })(this.sections, sectKey);
  7835. var elem = null;
  7836. var inherit = false;
  7837. if (sect != null) {
  7838. elem = sect.getIndexedCell(index, cellKey);
  7839. }
  7840. if (elem != null) {
  7841. var form = elem.getAttribute("F");
  7842. var value = elem.getAttribute("V");
  7843. if (form != null && value != null) {
  7844. if ((function (o1, o2) { if (o1 && o1.equals) {
  7845. return o1.equals(o2);
  7846. }
  7847. else {
  7848. return o1 === o2;
  7849. } })(form, "Inh") && (function (o1, o2) { if (o1 && o1.equals) {
  7850. return o1.equals(o2);
  7851. }
  7852. else {
  7853. return o1 === o2;
  7854. } })(value, "Themed")) {
  7855. inherit = true;
  7856. }
  7857. else if ((function (o1, o2) { if (o1 && o1.equals) {
  7858. return o1.equals(o2);
  7859. }
  7860. else {
  7861. return o1 === o2;
  7862. } })(form, "THEMEVAL()") && (function (o1, o2) { if (o1 && o1.equals) {
  7863. return o1.equals(o2);
  7864. }
  7865. else {
  7866. return o1 === o2;
  7867. } })(value, "Themed") && this.style != null) {
  7868. if ((function (o1, o2) { if (o1 && o1.equals) {
  7869. return o1.equals(o2);
  7870. }
  7871. else {
  7872. return o1 === o2;
  7873. } })(com.mxgraph.io.vsdx.mxVsdxConstants.COLOR, cellKey))
  7874. return elem;
  7875. var themeElem = this.style.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey);
  7876. if (themeElem != null) {
  7877. return themeElem;
  7878. }
  7879. }
  7880. }
  7881. }
  7882. if (elem == null || inherit) {
  7883. var styleType = (function (m, k) { return m[k] ? m[k] : null; })(Style.styleTypes_$LI$(), sectKey);
  7884. var parentStyle = (function (m, k) { return m[k] ? m[k] : null; })(this.styleParents, styleType);
  7885. if (parentStyle != null) {
  7886. var parentElem = parentStyle.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey);
  7887. if (parentElem != null) {
  7888. return parentElem;
  7889. }
  7890. }
  7891. }
  7892. return elem;
  7893. };
  7894. Style.prototype.getCellElement = function (cellKey, index, sectKey) {
  7895. if (((typeof cellKey === 'string') || cellKey === null) && ((typeof index === 'string') || index === null) && ((typeof sectKey === 'string') || sectKey === null)) {
  7896. return this.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey);
  7897. }
  7898. else if (((typeof cellKey === 'string') || cellKey === null) && index === undefined && sectKey === undefined) {
  7899. return this.getCellElement$java_lang_String(cellKey);
  7900. }
  7901. else
  7902. throw new Error('invalid overload');
  7903. };
  7904. Style.prototype.getCellElement$java_lang_String = function (key) {
  7905. var elem = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, key);
  7906. var inherit = false;
  7907. if (elem != null) {
  7908. var form = elem.getAttribute("F");
  7909. var value = elem.getAttribute("V");
  7910. if (form != null && value != null) {
  7911. if ((function (o1, o2) { if (o1 && o1.equals) {
  7912. return o1.equals(o2);
  7913. }
  7914. else {
  7915. return o1 === o2;
  7916. } })(form, "Inh") && (function (o1, o2) { if (o1 && o1.equals) {
  7917. return o1.equals(o2);
  7918. }
  7919. else {
  7920. return o1 === o2;
  7921. } })(value, "Themed")) {
  7922. inherit = true;
  7923. }
  7924. else if (form.indexOf("THEMEVAL()") != -1 && (function (o1, o2) { if (o1 && o1.equals) {
  7925. return o1.equals(o2);
  7926. }
  7927. else {
  7928. return o1 === o2;
  7929. } })(value, "Themed") && this.style != null) {
  7930. if ((function (o1, o2) { if (o1 && o1.equals) {
  7931. return o1.equals(o2);
  7932. }
  7933. else {
  7934. return o1 === o2;
  7935. } })("FillForegnd", key) || (function (o1, o2) { if (o1 && o1.equals) {
  7936. return o1.equals(o2);
  7937. }
  7938. else {
  7939. return o1 === o2;
  7940. } })(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR, key) || (function (o1, o2) { if (o1 && o1.equals) {
  7941. return o1.equals(o2);
  7942. }
  7943. else {
  7944. return o1 === o2;
  7945. } })(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN, key) || (function (o1, o2) { if (o1 && o1.equals) {
  7946. return o1.equals(o2);
  7947. }
  7948. else {
  7949. return o1 === o2;
  7950. } })(com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW_SIZE, key) || (function (o1, o2) { if (o1 && o1.equals) {
  7951. return o1.equals(o2);
  7952. }
  7953. else {
  7954. return o1 === o2;
  7955. } })(com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW_SIZE, key) || (function (o1, o2) { if (o1 && o1.equals) {
  7956. return o1.equals(o2);
  7957. }
  7958. else {
  7959. return o1 === o2;
  7960. } })(com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW, key) || (function (o1, o2) { if (o1 && o1.equals) {
  7961. return o1.equals(o2);
  7962. }
  7963. else {
  7964. return o1 === o2;
  7965. } })(com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW, key) || (function (o1, o2) { if (o1 && o1.equals) {
  7966. return o1.equals(o2);
  7967. }
  7968. else {
  7969. return o1 === o2;
  7970. } })(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_WEIGHT, key))
  7971. return elem;
  7972. var themeElem = this.style.getCellElement$java_lang_String(key);
  7973. if (themeElem != null) {
  7974. return themeElem;
  7975. }
  7976. }
  7977. }
  7978. }
  7979. if (elem == null || inherit) {
  7980. var styleType = (function (m, k) { return m[k] ? m[k] : null; })(Style.styleTypes_$LI$(), key);
  7981. var parentStyle = (function (m, k) { return m[k] ? m[k] : null; })(this.styleParents, styleType);
  7982. if (parentStyle != null) {
  7983. var parentElem = parentStyle.getCellElement$java_lang_String(key);
  7984. if (parentElem != null) {
  7985. return parentElem;
  7986. }
  7987. }
  7988. }
  7989. return elem;
  7990. };
  7991. /**
  7992. * Returns the line color.<br/>
  7993. * The property may to be defined in master shape or line stylesheet.<br/>
  7994. * @return {string} hexadecimal representation of the color.
  7995. */
  7996. Style.prototype.getStrokeColor = function () {
  7997. var color = "";
  7998. if ((function (o1, o2) { if (o1 && o1.equals) {
  7999. return o1.equals(o2);
  8000. }
  8001. else {
  8002. return o1 === o2;
  8003. } })(this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN), "1"), "0")) {
  8004. color = "none";
  8005. }
  8006. else {
  8007. color = this.getColor(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR));
  8008. if ((function (o1, o2) { if (o1 && o1.equals) {
  8009. return o1.equals(o2);
  8010. }
  8011. else {
  8012. return o1 === o2;
  8013. } })("Themed", color)) {
  8014. var theme_7 = this.getTheme();
  8015. if (theme_7 != null) {
  8016. var colorObj = this.isVertex() ? theme_7.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_7.getConnLineColor(this.getQuickStyleVals());
  8017. color = colorObj.toHexStr();
  8018. }
  8019. else {
  8020. color = "";
  8021. }
  8022. }
  8023. }
  8024. return color;
  8025. };
  8026. /**
  8027. * Returns the shape's color.
  8028. * The property may to be defined in master shape or fill stylesheet.
  8029. * If the color is the background or the fore color, it depends on the pattern.
  8030. * For simple gradients and solid, returns the fore color, else return the
  8031. * background color.
  8032. * @return {string} hexadecimal representation of the color.
  8033. */
  8034. Style.prototype.getFillColor = function () {
  8035. var fillGradientEnabled = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_GRADIENT_ENABLED), "0");
  8036. if ((function (o1, o2) { if (o1 && o1.equals) {
  8037. return o1.equals(o2);
  8038. }
  8039. else {
  8040. return o1 === o2;
  8041. } })("1", fillGradientEnabled)) {
  8042. var fillGradient = (function (m, k) { return m[k] ? m[k] : null; })(this.sections, "FillGradient");
  8043. if (fillGradient != null) {
  8044. var color = this.getColor(fillGradient.getIndexedCell("0", "GradientStopColor"));
  8045. if (color != null && !(color.length === 0))
  8046. return color;
  8047. }
  8048. }
  8049. var fillForeColor = this.getColor(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_FOREGND));
  8050. if ((function (o1, o2) { if (o1 && o1.equals) {
  8051. return o1.equals(o2);
  8052. }
  8053. else {
  8054. return o1 === o2;
  8055. } })("Themed", fillForeColor)) {
  8056. var theme_8 = this.getTheme();
  8057. if (theme_8 != null) {
  8058. var color = theme_8.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals());
  8059. fillForeColor = color.toHexStr();
  8060. }
  8061. else {
  8062. fillForeColor = "#FFFFFF";
  8063. }
  8064. }
  8065. var fillPattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_PATTERN), "0");
  8066. if (fillPattern != null && (function (o1, o2) { if (o1 && o1.equals) {
  8067. return o1.equals(o2);
  8068. }
  8069. else {
  8070. return o1 === o2;
  8071. } })(fillPattern, "0")) {
  8072. return "none";
  8073. }
  8074. else {
  8075. return fillForeColor;
  8076. }
  8077. };
  8078. Style.prototype.getColor = function (elem) {
  8079. var color = this.getValue(elem, "");
  8080. if (!(function (o1, o2) { if (o1 && o1.equals) {
  8081. return o1.equals(o2);
  8082. }
  8083. else {
  8084. return o1 === o2;
  8085. } })("Themed", color) && !(function (str, searchString, position) {
  8086. if (position === void 0) { position = 0; }
  8087. return str.substr(position, searchString.length) === searchString;
  8088. })(color, "#")) {
  8089. color = this.pm.getColor(color);
  8090. }
  8091. return color;
  8092. };
  8093. /**
  8094. * The TextBkgnd cell can have any value from 0 through 24, or 255. The values 0 and 255 (visTxtBlklOpaque) both indicate a transparent text background.
  8095. * To enter a custom color, use the RGB or HSL function plus one—for example, RGB(255,127,255)+1. The value of a custom color is its RGB color, and RGB(r, g, b)+1,
  8096. * rather than a number, will be shown in the ShapeSheet window. When used in numeric operations, custom colors have values of 25 and above.
  8097. * You can set the transparency of the text background color in the TextBkgndTrans cell.
  8098. * @param {*} elem
  8099. * @return {string}
  8100. */
  8101. Style.prototype.getTextBkgndColor = function (elem) {
  8102. var color = this.getValue(elem, "");
  8103. if (!(function (str, searchString, position) {
  8104. if (position === void 0) { position = 0; }
  8105. return str.substr(position, searchString.length) === searchString;
  8106. })(color, "#")) {
  8107. if ((function (o1, o2) { if (o1 && o1.equals) {
  8108. return o1.equals(o2);
  8109. }
  8110. else {
  8111. return o1 === o2;
  8112. } })(color, "0") || (function (o1, o2) { if (o1 && o1.equals) {
  8113. return o1.equals(o2);
  8114. }
  8115. else {
  8116. return o1 === o2;
  8117. } })(color, "255") || (color.length === 0)) {
  8118. return "none";
  8119. }
  8120. return this.pm.getColor(/* valueOf */ new String(/* parseInt */ parseInt(color) - 1).toString());
  8121. }
  8122. return color;
  8123. };
  8124. /**
  8125. * Returns the line weight of the shape in pixels
  8126. * @return {number} Numerical value of the LineWeight element.
  8127. */
  8128. Style.prototype.getLineWeight = function () {
  8129. return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_WEIGHT), 0);
  8130. };
  8131. /**
  8132. * Returns the level of transparency of the Shape.
  8133. * @return {number} double in range (opaque = 0)..(100 = transparent)
  8134. */
  8135. Style.prototype.getStrokeTransparency = function () {
  8136. return this.getValueAsDouble(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR_TRANS), 0);
  8137. };
  8138. /**
  8139. * Returns the NameU attribute.
  8140. * @return {string} Value of the NameU attribute.
  8141. */
  8142. Style.prototype.getNameU = function () {
  8143. return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U) || "";
  8144. };
  8145. /**
  8146. * Returns the Name attribute.
  8147. * @return {string} Value of the Name attribute (Human readable name).
  8148. */
  8149. Style.prototype.getName = function () {
  8150. return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME) || "";
  8151. };
  8152. /**
  8153. * Returns the UniqueID attribute.
  8154. * @return {string} Value of the UniqueID attribute.
  8155. */
  8156. Style.prototype.getUniqueID = function () {
  8157. return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.UNIQUE_ID) || "";
  8158. };
  8159. /**
  8160. * Returns the value of the Id attribute.
  8161. * @return {number} Value of the Id attribute.
  8162. */
  8163. Style.prototype.getId = function () {
  8164. return this.Id;
  8165. };
  8166. /**
  8167. * Returns the color of one text fragment
  8168. * @param charIX IX attribute of Char element
  8169. * @return {string} Text color in hexadecimal representation.
  8170. * @param {string} index
  8171. */
  8172. Style.prototype.getTextColor = function (index) {
  8173. var colorElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.COLOR, index, com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER);
  8174. var color = this.getValue(colorElem, "#000000");
  8175. if ((function (o1, o2) { if (o1 && o1.equals) {
  8176. return o1.equals(o2);
  8177. }
  8178. else {
  8179. return o1 === o2;
  8180. } })("Themed", color)) {
  8181. var theme_9 = this.getTheme();
  8182. if (theme_9 != null) {
  8183. var colorObj = this.isVertex() ? theme_9.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_9.getConnFontColor(this.getQuickStyleVals());
  8184. color = colorObj.toHexStr();
  8185. }
  8186. else {
  8187. color = "#000000";
  8188. }
  8189. }
  8190. else if (!(function (str, searchString, position) {
  8191. if (position === void 0) { position = 0; }
  8192. return str.substr(position, searchString.length) === searchString;
  8193. })(color, "#")) {
  8194. color = this.pm.getColor(color);
  8195. }
  8196. return color;
  8197. };
  8198. /**
  8199. * Returns the top margin of text in pixels.
  8200. * @return {number} Numerical value of the TopMargin element
  8201. */
  8202. Style.prototype.getTextTopMargin = function () {
  8203. return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.TOP_MARGIN), 0);
  8204. };
  8205. /**
  8206. * Returns the bottom margin of text in pixels.
  8207. * @return {number} Numerical value of the BottomMargin element.
  8208. */
  8209. Style.prototype.getTextBottomMargin = function () {
  8210. return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.BOTTOM_MARGIN), 0);
  8211. };
  8212. /**
  8213. * Returns the left margin of text in pixels.
  8214. * @return {number} Numerical value of the LeftMargin element.
  8215. */
  8216. Style.prototype.getTextLeftMargin = function () {
  8217. return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LEFT_MARGIN), 0);
  8218. };
  8219. /**
  8220. * Returns the right margin of text in pixels.
  8221. * @return {number} Numerical value of the RightMargin element.
  8222. */
  8223. Style.prototype.getTextRightMargin = function () {
  8224. return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.RIGHT_MARGIN), 0);
  8225. };
  8226. /**
  8227. * Returns the style of one text fragment.
  8228. * @param charIX IX attribute of Char element
  8229. * @return {string} String value of the Style element.
  8230. * @param {string} index
  8231. */
  8232. Style.prototype.getTextStyle = function (index) {
  8233. var styleElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.STYLE, index, com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER);
  8234. return this.getValue(styleElem, "");
  8235. };
  8236. /**
  8237. * Returns the font of one text fragment
  8238. * @param charIX IX attribute of Char element
  8239. * @return {string} Name of the font.
  8240. * @param {string} index
  8241. */
  8242. Style.prototype.getTextFont = function (index) {
  8243. var fontElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FONT, index, com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER);
  8244. return this.getValue(fontElem, "");
  8245. };
  8246. /**
  8247. * Returns the position of one text fragment
  8248. * @param charIX IX attribute of Char element
  8249. * @return {string} Integer value of the Pos element.
  8250. * @param {string} index
  8251. */
  8252. Style.prototype.getTextPos = function (index) {
  8253. var posElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.POS, index, com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER);
  8254. return this.getValue(posElem, "");
  8255. };
  8256. /**
  8257. * Checks if one text fragment is Strikethru
  8258. * @param charIX IX attribute of Char element
  8259. * @return {boolean} Returns <code>true</code> if one text fragment is Strikethru
  8260. * @param {string} index
  8261. */
  8262. Style.prototype.getTextStrike = function (index) {
  8263. var strikeElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.STRIKETHRU, index, com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER);
  8264. return (function (o1, o2) { if (o1 && o1.equals) {
  8265. return o1.equals(o2);
  8266. }
  8267. else {
  8268. return o1 === o2;
  8269. } })(this.getValue(strikeElem, ""), "1");
  8270. };
  8271. /**
  8272. * Returns the case property of one text fragment
  8273. * @param charIX IX attribute of Char element
  8274. * @return {string} Integer value of the Case element
  8275. * @param {string} index
  8276. */
  8277. Style.prototype.getTextCase = function (index) {
  8278. var caseElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.CASE, index, com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER);
  8279. return this.getValue(caseElem, "");
  8280. };
  8281. /**
  8282. * Returns the horizontal align property of a paragraph
  8283. * @param {string} index IX attribute of Para element
  8284. * @param {boolean} html whether to return the html values or mxGraph values
  8285. * @return {string} String value of the HorizontalAlign element.
  8286. */
  8287. Style.prototype.getHorizontalAlign = function (index, html) {
  8288. var ret = "center";
  8289. var horAlign = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.HORIZONTAL_ALIGN, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8290. var align = this.getValue(horAlign, "");
  8291. switch ((align)) {
  8292. case "0":
  8293. ret = html ? "left" : mxConstants.ALIGN_LEFT;
  8294. break;
  8295. case "2":
  8296. ret = html ? "right" : mxConstants.ALIGN_RIGHT;
  8297. break;
  8298. case "3":
  8299. case "4":
  8300. ret = html ? "justify" : mxConstants.ALIGN_CENTER;
  8301. break;
  8302. default:
  8303. ret = html ? "center" : mxConstants.ALIGN_CENTER;
  8304. }
  8305. return ret;
  8306. };
  8307. /**
  8308. * Returns the first indent of one paragraph in pixels.
  8309. * @param paraIX IX attribute of Para element
  8310. * @return {string} String representation of the numerical value of the IndentFirst element.
  8311. * @param {string} index
  8312. */
  8313. Style.prototype.getIndentFirst = function (index) {
  8314. var indentFirstElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.INDENT_FIRST, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8315. return new String(this.getScreenNumericalValue$org_w3c_dom_Element$double(indentFirstElem, 0)).toString();
  8316. };
  8317. /**
  8318. * Returns the indent to left of one paragraph
  8319. * @param paraIX IX attribute of Para element
  8320. * @return {string} String representation of the numerical value of the IndentLeft element.
  8321. * @param {string} index
  8322. */
  8323. Style.prototype.getIndentLeft = function (index) {
  8324. var indentLeftElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.INDENT_LEFT, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8325. return new String((Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(indentLeftElem, 0)) | 0)).toString();
  8326. };
  8327. /**
  8328. * Returns the indent to right of one paragraph
  8329. * @param paraIX IX attribute of Para element
  8330. * @return {string} String representation of the numerical value of the IndentRight element.
  8331. * @param {string} index
  8332. */
  8333. Style.prototype.getIndentRight = function (index) {
  8334. var indentRightElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.INDENT_RIGHT, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8335. return new String((Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(indentRightElem, 0)) | 0)).toString();
  8336. };
  8337. /**
  8338. * Returns the space before one paragraph.
  8339. * @param paraIX IX attribute of Para element
  8340. * @return {string} String representation of the numerical value of the SpBefore element.
  8341. * @param {string} index
  8342. */
  8343. Style.prototype.getSpBefore = function (index) {
  8344. var spBeforeElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.SPACE_BEFORE, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8345. return new String((Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(spBeforeElem, 0)) | 0)).toString();
  8346. };
  8347. /**
  8348. * Returns the space after one paragraph
  8349. * @param paraIX IX attribute of Para element
  8350. * @return {string} String representation of the numerical value of the SpAfter element.
  8351. * @param {string} index
  8352. */
  8353. Style.prototype.getSpAfter = function (index) {
  8354. var spAfterElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.SPACE_AFTER, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8355. return new String((Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(spAfterElem, 0)) | 0)).toString();
  8356. };
  8357. /**
  8358. * Returns the space between lines in one paragraph.
  8359. * @param paraIX IX attribute of Para element.
  8360. * @return {number} Double representation of the value of the SpLine element.
  8361. * @param {string} index
  8362. */
  8363. Style.prototype.getSpLine = function (index) {
  8364. var spLineElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.SPACE_LINE, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8365. var val = this.getValue(spLineElem, "");
  8366. if (!(function (o1, o2) { if (o1 && o1.equals) {
  8367. return o1.equals(o2);
  8368. }
  8369. else {
  8370. return o1 === o2;
  8371. } })(val, "")) {
  8372. return parseFloat(val);
  8373. }
  8374. return 0;
  8375. };
  8376. /**
  8377. * Returns the flags of one paragraph.
  8378. * @param paraIX IX attribute of Para element.
  8379. * @return {string} String value of the Flags element.
  8380. * @param {string} index
  8381. */
  8382. Style.prototype.getFlags = function (index) {
  8383. var flagsElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FLAGS, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8384. return this.getValue(flagsElem, "0");
  8385. };
  8386. /**
  8387. * Returns the space between characters in one text fragment.
  8388. * @param paraIX IX attribute of Para element.
  8389. * @return {string} String representation of the numerical value of the Letterspace element.
  8390. * @param {string} index
  8391. */
  8392. Style.prototype.getLetterSpace = function (index) {
  8393. var letterSpaceElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LETTER_SPACE, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8394. return new String(this.getScreenNumericalValue$org_w3c_dom_Element$double(letterSpaceElem, 0)).toString();
  8395. };
  8396. /**
  8397. * Returns the bullet element value.
  8398. * @param paraIX IX attribute of Para element.
  8399. * @return {string} String value of the Bullet element.
  8400. * @param {string} index
  8401. */
  8402. Style.prototype.getBullet = function (index) {
  8403. var bulletElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.BULLET, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  8404. return this.getValue(bulletElem, "0");
  8405. };
  8406. Style.prototype.getShape = function () {
  8407. return this.shape;
  8408. };
  8409. Style.prototype.setShape = function (shape) {
  8410. this.shape = shape;
  8411. };
  8412. Style.lineDashPatterns_$LI$ = function () { Style.__static_initialize(); if (Style.lineDashPatterns == null)
  8413. Style.lineDashPatterns = ([]); return Style.lineDashPatterns; };
  8414. ;
  8415. Style.__static_initializer_1 = function () {
  8416. /* add */ (Style.lineDashPatterns_$LI$().push([]));
  8417. /* add */ (Style.lineDashPatterns_$LI$().push([]));
  8418. /* add */ (Style.lineDashPatterns_$LI$().push([]));
  8419. var lineDashPattern = ([]);
  8420. /* add */ (lineDashPattern.push(Style.DOT));
  8421. /* add */ (lineDashPattern.push(Style.SPACE));
  8422. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8423. lineDashPattern = ([]);
  8424. /* add */ (lineDashPattern.push(Style.DASH));
  8425. /* add */ (lineDashPattern.push(Style.SPACE));
  8426. /* add */ (lineDashPattern.push(Style.DOT));
  8427. /* add */ (lineDashPattern.push(Style.SPACE));
  8428. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8429. lineDashPattern = ([]);
  8430. /* add */ (lineDashPattern.push(Style.DASH));
  8431. /* add */ (lineDashPattern.push(Style.SPACE));
  8432. /* add */ (lineDashPattern.push(Style.DOT));
  8433. /* add */ (lineDashPattern.push(Style.SPACE));
  8434. /* add */ (lineDashPattern.push(Style.DOT));
  8435. /* add */ (lineDashPattern.push(Style.SPACE));
  8436. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8437. lineDashPattern = ([]);
  8438. /* add */ (lineDashPattern.push(Style.DASH));
  8439. /* add */ (lineDashPattern.push(Style.SPACE));
  8440. /* add */ (lineDashPattern.push(Style.DASH));
  8441. /* add */ (lineDashPattern.push(Style.SPACE));
  8442. /* add */ (lineDashPattern.push(Style.DOT));
  8443. /* add */ (lineDashPattern.push(Style.SPACE));
  8444. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8445. lineDashPattern = ([]);
  8446. /* add */ (lineDashPattern.push(Style.LONG_DASH));
  8447. /* add */ (lineDashPattern.push(Style.SPACE));
  8448. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8449. /* add */ (lineDashPattern.push(Style.SPACE));
  8450. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8451. lineDashPattern = ([]);
  8452. /* add */ (lineDashPattern.push(Style.LONG_DASH));
  8453. /* add */ (lineDashPattern.push(Style.SPACE));
  8454. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8455. /* add */ (lineDashPattern.push(Style.SPACE));
  8456. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8457. /* add */ (lineDashPattern.push(Style.SPACE));
  8458. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8459. lineDashPattern = ([]);
  8460. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8461. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8462. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8463. lineDashPattern = ([]);
  8464. /* add */ (lineDashPattern.push(Style.DOT));
  8465. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8466. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8467. lineDashPattern = ([]);
  8468. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8469. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8470. /* add */ (lineDashPattern.push(Style.DOT));
  8471. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8472. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8473. lineDashPattern = ([]);
  8474. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8475. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8476. /* add */ (lineDashPattern.push(Style.DOT));
  8477. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8478. /* add */ (lineDashPattern.push(Style.DOT));
  8479. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8480. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8481. lineDashPattern = ([]);
  8482. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8483. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8484. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8485. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8486. /* add */ (lineDashPattern.push(Style.DOT));
  8487. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8488. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8489. lineDashPattern = ([]);
  8490. /* add */ (lineDashPattern.push(Style.DASH));
  8491. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8492. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8493. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8494. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8495. lineDashPattern = ([]);
  8496. /* add */ (lineDashPattern.push(Style.DASH));
  8497. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8498. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8499. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8500. /* add */ (lineDashPattern.push(Style.SHORT_DASH));
  8501. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8502. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8503. lineDashPattern = ([]);
  8504. /* add */ (lineDashPattern.push(Style.LONG_DASH));
  8505. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8506. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8507. lineDashPattern = ([]);
  8508. /* add */ (lineDashPattern.push(Style.DOT));
  8509. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8510. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8511. lineDashPattern = ([]);
  8512. /* add */ (lineDashPattern.push(Style.LONG_DASH));
  8513. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8514. /* add */ (lineDashPattern.push(Style.DOT));
  8515. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8516. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8517. lineDashPattern = ([]);
  8518. /* add */ (lineDashPattern.push(Style.LONG_DASH));
  8519. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8520. /* add */ (lineDashPattern.push(Style.DOT));
  8521. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8522. /* add */ (lineDashPattern.push(Style.DOT));
  8523. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8524. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8525. lineDashPattern = ([]);
  8526. /* add */ (lineDashPattern.push(Style.LONG_DASH));
  8527. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8528. /* add */ (lineDashPattern.push(Style.LONG_DASH));
  8529. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8530. /* add */ (lineDashPattern.push(Style.DOT));
  8531. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8532. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8533. lineDashPattern = ([]);
  8534. /* add */ (lineDashPattern.push(Style.XLONG_DASH));
  8535. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8536. /* add */ (lineDashPattern.push(Style.DASH));
  8537. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8538. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8539. lineDashPattern = ([]);
  8540. /* add */ (lineDashPattern.push(Style.XLONG_DASH));
  8541. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8542. /* add */ (lineDashPattern.push(Style.DASH));
  8543. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8544. /* add */ (lineDashPattern.push(Style.DASH));
  8545. /* add */ (lineDashPattern.push(Style.LONG_SPACE));
  8546. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8547. lineDashPattern = ([]);
  8548. /* add */ (lineDashPattern.push(Style.XSHORT_DASH));
  8549. /* add */ (lineDashPattern.push(Style.SHORT_SPACE));
  8550. /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern));
  8551. };
  8552. Style.getLineDashPattern = function (pattern) {
  8553. if (pattern >= 0 && pattern <= 23)
  8554. return Style.lineDashPatterns_$LI$()[pattern];
  8555. else
  8556. return Style.lineDashPatterns_$LI$()[0];
  8557. };
  8558. return Style;
  8559. }());
  8560. Style.__static_initialized = false;
  8561. Style.vsdxStyleDebug = false;
  8562. Style.SPACE = 4.0;
  8563. Style.SHORT_SPACE = 2.0;
  8564. Style.LONG_SPACE = 6.0;
  8565. Style.DOT = 1.0;
  8566. Style.DASH = 8.0;
  8567. Style.LONG_DASH = 12.0;
  8568. Style.SHORT_DASH = 4.0;
  8569. Style.XLONG_DASH = 20.0;
  8570. Style.XSHORT_DASH = 2.0;
  8571. vsdx.Style = Style;
  8572. Style["__class"] = "com.mxgraph.io.vsdx.Style";
  8573. })(vsdx = io.vsdx || (io.vsdx = {}));
  8574. })(io = mxgraph.io || (mxgraph.io = {}));
  8575. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  8576. })(com || (com = {}));
  8577. (function (com) {
  8578. var mxgraph;
  8579. (function (mxgraph) {
  8580. var io;
  8581. (function (io) {
  8582. var vsdx;
  8583. (function (vsdx) {
  8584. var theme;
  8585. (function (theme) {
  8586. var HslClr = (function (_super) {
  8587. __extends(HslClr, _super);
  8588. function HslClr(hue, sat, lum) {
  8589. var _this = _super.call(this) || this;
  8590. _this.__com_mxgraph_io_vsdx_theme_HslClr_hue = 0;
  8591. _this.__com_mxgraph_io_vsdx_theme_HslClr_sat = 0;
  8592. _this.__com_mxgraph_io_vsdx_theme_HslClr_lum = 0;
  8593. _this.__com_mxgraph_io_vsdx_theme_HslClr_hue = hue / 360.0;
  8594. _this.__com_mxgraph_io_vsdx_theme_HslClr_sat = sat / 100.0;
  8595. _this.__com_mxgraph_io_vsdx_theme_HslClr_lum = lum / 100.0;
  8596. _this.color = new com.mxgraph.io.vsdx.theme.HSLColor(hue, sat, lum).toRgb();
  8597. return _this;
  8598. }
  8599. return HslClr;
  8600. }(com.mxgraph.io.vsdx.theme.OoxmlColor));
  8601. theme.HslClr = HslClr;
  8602. HslClr["__class"] = "com.mxgraph.io.vsdx.theme.HslClr";
  8603. })(theme = vsdx.theme || (vsdx.theme = {}));
  8604. })(vsdx = io.vsdx || (io.vsdx = {}));
  8605. })(io = mxgraph.io || (mxgraph.io = {}));
  8606. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  8607. })(com || (com = {}));
  8608. (function (com) {
  8609. var mxgraph;
  8610. (function (mxgraph) {
  8611. var io;
  8612. (function (io) {
  8613. var vsdx;
  8614. (function (vsdx) {
  8615. var theme;
  8616. (function (theme) {
  8617. var PrstClr = (function (_super) {
  8618. __extends(PrstClr, _super);
  8619. function PrstClr(val) {
  8620. var _this = _super.call(this) || this;
  8621. _this.val = null;
  8622. _this.val = val;
  8623. _this.color = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255);
  8624. return _this;
  8625. }
  8626. return PrstClr;
  8627. }(com.mxgraph.io.vsdx.theme.OoxmlColor));
  8628. theme.PrstClr = PrstClr;
  8629. PrstClr["__class"] = "com.mxgraph.io.vsdx.theme.PrstClr";
  8630. })(theme = vsdx.theme || (vsdx.theme = {}));
  8631. })(vsdx = io.vsdx || (io.vsdx = {}));
  8632. })(io = mxgraph.io || (mxgraph.io = {}));
  8633. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  8634. })(com || (com = {}));
  8635. (function (com) {
  8636. var mxgraph;
  8637. (function (mxgraph) {
  8638. var io;
  8639. (function (io) {
  8640. var vsdx;
  8641. (function (vsdx) {
  8642. var theme;
  8643. (function (theme_10) {
  8644. var SchemeClr = (function (_super) {
  8645. __extends(SchemeClr, _super);
  8646. function SchemeClr(val) {
  8647. var _this = _super.call(this) || this;
  8648. _this.val = null;
  8649. _this.isDynamic = true;
  8650. _this.val = val;
  8651. return _this;
  8652. }
  8653. SchemeClr.prototype.calcColor = function (styleColor, theme) {
  8654. if (!(function (o1, o2) { if (o1 && o1.equals) {
  8655. return o1.equals(o2);
  8656. }
  8657. else {
  8658. return o1 === o2;
  8659. } })("phClr", this.val)) {
  8660. this.color = theme.getSchemeColor(this.val);
  8661. this.isDynamic = false;
  8662. }
  8663. else {
  8664. this.color = theme.getStyleColor(styleColor);
  8665. }
  8666. _super.prototype.calcColor.call(this, styleColor, theme);
  8667. };
  8668. return SchemeClr;
  8669. }(com.mxgraph.io.vsdx.theme.OoxmlColor));
  8670. theme_10.SchemeClr = SchemeClr;
  8671. SchemeClr["__class"] = "com.mxgraph.io.vsdx.theme.SchemeClr";
  8672. })(theme = vsdx.theme || (vsdx.theme = {}));
  8673. })(vsdx = io.vsdx || (io.vsdx = {}));
  8674. })(io = mxgraph.io || (mxgraph.io = {}));
  8675. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  8676. })(com || (com = {}));
  8677. (function (com) {
  8678. var mxgraph;
  8679. (function (mxgraph) {
  8680. var io;
  8681. (function (io) {
  8682. var vsdx;
  8683. (function (vsdx) {
  8684. var theme;
  8685. (function (theme) {
  8686. var ScrgbClr = (function (_super) {
  8687. __extends(ScrgbClr, _super);
  8688. function ScrgbClr(r, g, b) {
  8689. var _this = _super.call(this) || this;
  8690. _this.r = 0;
  8691. _this.g = 0;
  8692. _this.b = 0;
  8693. _this.r = r;
  8694. _this.g = g;
  8695. _this.b = b;
  8696. _this.color = new com.mxgraph.io.vsdx.theme.Color(r, g, b);
  8697. return _this;
  8698. }
  8699. return ScrgbClr;
  8700. }(com.mxgraph.io.vsdx.theme.OoxmlColor));
  8701. theme.ScrgbClr = ScrgbClr;
  8702. ScrgbClr["__class"] = "com.mxgraph.io.vsdx.theme.ScrgbClr";
  8703. })(theme = vsdx.theme || (vsdx.theme = {}));
  8704. })(vsdx = io.vsdx || (io.vsdx = {}));
  8705. })(io = mxgraph.io || (mxgraph.io = {}));
  8706. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  8707. })(com || (com = {}));
  8708. (function (com) {
  8709. var mxgraph;
  8710. (function (mxgraph) {
  8711. var io;
  8712. (function (io) {
  8713. var vsdx;
  8714. (function (vsdx) {
  8715. var theme;
  8716. (function (theme) {
  8717. var SrgbClr = (function (_super) {
  8718. __extends(SrgbClr, _super);
  8719. function SrgbClr(hexVal) {
  8720. var _this = _super.call(this) || this;
  8721. _this.hexVal = null;
  8722. _this.hexVal = hexVal;
  8723. _this.color = com.mxgraph.io.vsdx.theme.Color.decodeColorHex(hexVal);
  8724. return _this;
  8725. }
  8726. return SrgbClr;
  8727. }(com.mxgraph.io.vsdx.theme.OoxmlColor));
  8728. theme.SrgbClr = SrgbClr;
  8729. SrgbClr["__class"] = "com.mxgraph.io.vsdx.theme.SrgbClr";
  8730. })(theme = vsdx.theme || (vsdx.theme = {}));
  8731. })(vsdx = io.vsdx || (io.vsdx = {}));
  8732. })(io = mxgraph.io || (mxgraph.io = {}));
  8733. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  8734. })(com || (com = {}));
  8735. (function (com) {
  8736. var mxgraph;
  8737. (function (mxgraph) {
  8738. var io;
  8739. (function (io) {
  8740. var vsdx;
  8741. (function (vsdx) {
  8742. var theme;
  8743. (function (theme) {
  8744. var SysClr = (function (_super) {
  8745. __extends(SysClr, _super);
  8746. function SysClr(val, lastClr) {
  8747. var _this = _super.call(this) || this;
  8748. _this.val = null;
  8749. _this.lastClr = null;
  8750. _this.val = val;
  8751. _this.lastClr = lastClr;
  8752. var hexVal = lastClr;
  8753. if (hexVal == null) {
  8754. switch ((val)) {
  8755. case "windowText":
  8756. hexVal = "000000";
  8757. break;
  8758. case "window":
  8759. hexVal = "FFFFFF";
  8760. break;
  8761. default:
  8762. hexVal = "FFFFFF";
  8763. }
  8764. }
  8765. _this.color = com.mxgraph.io.vsdx.theme.Color.decodeColorHex(hexVal);
  8766. return _this;
  8767. }
  8768. return SysClr;
  8769. }(com.mxgraph.io.vsdx.theme.OoxmlColor));
  8770. theme.SysClr = SysClr;
  8771. SysClr["__class"] = "com.mxgraph.io.vsdx.theme.SysClr";
  8772. })(theme = vsdx.theme || (vsdx.theme = {}));
  8773. })(vsdx = io.vsdx || (io.vsdx = {}));
  8774. })(io = mxgraph.io || (mxgraph.io = {}));
  8775. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  8776. })(com || (com = {}));
  8777. (function (com) {
  8778. var mxgraph;
  8779. (function (mxgraph) {
  8780. var io;
  8781. (function (io) {
  8782. var vsdx;
  8783. (function (vsdx) {
  8784. var geometry;
  8785. (function (geometry) {
  8786. var RelEllipticalArcTo = (function (_super) {
  8787. __extends(RelEllipticalArcTo, _super);
  8788. function RelEllipticalArcTo(index, x, y, a, b, c, d) {
  8789. return _super.call(this, index, x, y, a, b, c, d) || this;
  8790. }
  8791. /**
  8792. *
  8793. * @param {mxPoint} p
  8794. * @param {com.mxgraph.io.vsdx.Shape} shape
  8795. * @return {string}
  8796. */
  8797. RelEllipticalArcTo.prototype.handle = function (p, shape) {
  8798. if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) {
  8799. var h = shape.getHeight() / com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  8800. var w = shape.getWidth() / com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  8801. this.x *= w;
  8802. this.y *= h;
  8803. this.a *= w;
  8804. this.b *= h;
  8805. }
  8806. return _super.prototype.handle.call(this, p, shape);
  8807. };
  8808. return RelEllipticalArcTo;
  8809. }(com.mxgraph.io.vsdx.geometry.EllipticalArcTo));
  8810. geometry.RelEllipticalArcTo = RelEllipticalArcTo;
  8811. RelEllipticalArcTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelEllipticalArcTo";
  8812. })(geometry = vsdx.geometry || (vsdx.geometry = {}));
  8813. })(vsdx = io.vsdx || (io.vsdx = {}));
  8814. })(io = mxgraph.io || (mxgraph.io = {}));
  8815. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  8816. })(com || (com = {}));
  8817. (function (com) {
  8818. var mxgraph;
  8819. (function (mxgraph) {
  8820. var io;
  8821. (function (io) {
  8822. var vsdx;
  8823. (function (vsdx) {
  8824. var Shape = (function (_super) {
  8825. __extends(Shape, _super);
  8826. function Shape(shape, model) {
  8827. //BUG in JSweet, fields default values and explicit assignments are not the same (defaults are before super() and assignments are after)!
  8828. var _this = this;
  8829. _this.text = null;
  8830. _this.fields = null;
  8831. _this.geom = null;
  8832. _this.imageData = null;
  8833. _this.theme = null;
  8834. _this.quickStyleVals = null;
  8835. _this = _super.call(this, shape, model) || this;
  8836. /**
  8837. * List of paragraphs in this shape
  8838. */
  8839. _this.paragraphs = null;
  8840. /**
  8841. * mxGraph cell style map
  8842. */
  8843. _this.styleMap = ({});
  8844. /**
  8845. * Width of shape
  8846. */
  8847. _this.width = 0;
  8848. /**
  8849. * Height of shape
  8850. */
  8851. _this.height = 0;
  8852. /**
  8853. * Cumulative rotation of shape, including parents
  8854. */
  8855. _this.rotation = 0;
  8856. _this.lastX = 0;
  8857. _this.lastY = 0;
  8858. _this.lastMoveX = 0;
  8859. _this.lastMoveY = 0;
  8860. _this.lastKnot = -1;
  8861. _this.geomList = null;
  8862. _this.geomListProcessed = false;
  8863. _this.themeVariant = 0;
  8864. /**
  8865. * Last cp IX referenced in the Text Element.
  8866. */
  8867. _this.cp = "0";
  8868. /**
  8869. * Last pp IX referenced in the Text Element.
  8870. */
  8871. _this.pp = "0";
  8872. /**
  8873. * Last tp IX referenced in the Text Element.
  8874. */
  8875. _this.tp = "0";
  8876. /**
  8877. * Last fld IX referenced in the Text Element.
  8878. */
  8879. _this.fld = "0";
  8880. _this.width = _this.getScreenNumericalValue$org_w3c_dom_Element$double(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(_this.cellElements, com.mxgraph.io.vsdx.mxVsdxConstants.WIDTH), 0);
  8881. _this.height = _this.getScreenNumericalValue$org_w3c_dom_Element$double(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(_this.cellElements, com.mxgraph.io.vsdx.mxVsdxConstants.HEIGHT), 0);
  8882. return _this;
  8883. }
  8884. Shape.UNICODE_LINE_SEP_$LI$ = function ()
  8885. {
  8886. if (Shape.UNICODE_LINE_SEP == null)
  8887. {
  8888. Shape.ERROR_IMAGE = "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+DQo8IS0tIENyZWF0ZWQgd2l0aCBJbmtzY2FwZSAoaHR0cDovL3d3dy5pbmtzY2FwZS5vcmcvKSAtLT4NCjxzdmcNCiAgIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyINCiAgIHhtbG5zOmNjPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyMiDQogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiDQogICB4bWxuczpzdmc9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIg0KICAgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIg0KICAgeG1sbnM6c29kaXBvZGk9Imh0dHA6Ly9zb2RpcG9kaS5zb3VyY2Vmb3JnZS5uZXQvRFREL3NvZGlwb2RpLTAuZHRkIg0KICAgeG1sbnM6aW5rc2NhcGU9Imh0dHA6Ly93d3cuaW5rc2NhcGUub3JnL25hbWVzcGFjZXMvaW5rc2NhcGUiDQogICB3aWR0aD0iMjUwIg0KICAgaGVpZ2h0PSIyNTAiDQogICBpZD0ic3ZnMzMxOSINCiAgIHNvZGlwb2RpOnZlcnNpb249IjAuMzIiDQogICBpbmtzY2FwZTp2ZXJzaW9uPSIwLjQ2Ig0KICAgdmVyc2lvbj0iMS4wIg0KICAgc29kaXBvZGk6ZG9jbmFtZT0ibm9waG90b19pLnN2ZyINCiAgIGlua3NjYXBlOm91dHB1dF9leHRlbnNpb249Im9yZy5pbmtzY2FwZS5vdXRwdXQuc3ZnLmlua3NjYXBlIj4NCiAgPGRlZnMNCiAgICAgaWQ9ImRlZnMzMzIxIj4NCiAgICA8aW5rc2NhcGU6cGVyc3BlY3RpdmUNCiAgICAgICBzb2RpcG9kaTp0eXBlPSJpbmtzY2FwZTpwZXJzcDNkIg0KICAgICAgIGlua3NjYXBlOnZwX3g9IjAgOiA1MjYuMTgxMDkgOiAxIg0KICAgICAgIGlua3NjYXBlOnZwX3k9IjAgOiAxMDAwIDogMCINCiAgICAgICBpbmtzY2FwZTp2cF96PSI3NDQuMDk0NDggOiA1MjYuMTgxMDkgOiAxIg0KICAgICAgIGlua3NjYXBlOnBlcnNwM2Qtb3JpZ2luPSIzNzIuMDQ3MjQgOiAzNTAuNzg3MzkgOiAxIg0KICAgICAgIGlkPSJwZXJzcGVjdGl2ZTMzMjciIC8+DQogICAgPGlua3NjYXBlOnBlcnNwZWN0aXZlDQogICAgICAgaWQ9InBlcnNwZWN0aXZlMzM0MiINCiAgICAgICBpbmtzY2FwZTpwZXJzcDNkLW9yaWdpbj0iMzcyLjA0NzI0IDogMzUwLjc4NzM5IDogMSINCiAgICAgICBpbmtzY2FwZTp2cF96PSI3NDQuMDk0NDggOiA1MjYuMTgxMDkgOiAxIg0KICAgICAgIGlua3NjYXBlOnZwX3k9IjAgOiAxMDAwIDogMCINCiAgICAgICBpbmtzY2FwZTp2cF94PSIwIDogNTI2LjE4MTA5IDogMSINCiAgICAgICBzb2RpcG9kaTp0eXBlPSJpbmtzY2FwZTpwZXJzcDNkIiAvPg0KICA8L2RlZnM+DQogIDxzb2RpcG9kaTpuYW1lZHZpZXcNCiAgICAgaWQ9ImJhc2UiDQogICAgIHBhZ2Vjb2xvcj0iI2ZmZmZmZiINCiAgICAgYm9yZGVyY29sb3I9IiM2NjY2NjYiDQogICAgIGJvcmRlcm9wYWNpdHk9IjEuMCINCiAgICAgaW5rc2NhcGU6cGFnZW9wYWNpdHk9IjAuMCINCiAgICAgaW5rc2NhcGU6cGFnZXNoYWRvdz0iMiINCiAgICAgaW5rc2NhcGU6em9vbT0iMi4yNDI5NDI3Ig0KICAgICBpbmtzY2FwZTpjeD0iMTIxLjk3NjQ4Ig0KICAgICBpbmtzY2FwZTpjeT0iMTIyLjQ0MTk4Ig0KICAgICBpbmtzY2FwZTpkb2N1bWVudC11bml0cz0icHgiDQogICAgIGlua3NjYXBlOmN1cnJlbnQtbGF5ZXI9ImxheWVyMSINCiAgICAgc2hvd2dyaWQ9ImZhbHNlIg0KICAgICBpbmtzY2FwZTp3aW5kb3ctd2lkdGg9IjE2NjQiDQogICAgIGlua3NjYXBlOndpbmRvdy1oZWlnaHQ9Ijg0NCINCiAgICAgaW5rc2NhcGU6d2luZG93LXg9Ii0zIg0KICAgICBpbmtzY2FwZTp3aW5kb3cteT0iLTE4IiAvPg0KICA8bWV0YWRhdGENCiAgICAgaWQ9Im1ldGFkYXRhMzMyNCI+DQogICAgPHJkZjpSREY+DQogICAgICA8Y2M6V29yaw0KICAgICAgICAgcmRmOmFib3V0PSIiPg0KICAgICAgICA8ZGM6Zm9ybWF0PmltYWdlL3N2Zyt4bWw8L2RjOmZvcm1hdD4NCiAgICAgICAgPGRjOnR5cGUNCiAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vcHVybC5vcmcvZGMvZGNtaXR5cGUvU3RpbGxJbWFnZSIgLz4NCiAgICAgICAgPGRjOnRpdGxlPkZvdG9ncmFmaWVydmVyYm90PC9kYzp0aXRsZT4NCiAgICAgICAgPGRjOmRhdGU+MjAwOC0wNi0yOTwvZGM6ZGF0ZT4NCiAgICAgICAgPGRjOmNyZWF0b3I+DQogICAgICAgICAgPGNjOkFnZW50Pg0KICAgICAgICAgICAgPGRjOnRpdGxlPlRvcnJzdGVuIFNrb21wPC9kYzp0aXRsZT4NCiAgICAgICAgICA8L2NjOkFnZW50Pg0KICAgICAgICA8L2RjOmNyZWF0b3I+DQogICAgICAgIDxkYzpyaWdodHM+DQogICAgICAgICAgPGNjOkFnZW50Pg0KICAgICAgICAgICAgPGRjOnRpdGxlPlRvcnN0ZW4gU2tvbXA8L2RjOnRpdGxlPg0KICAgICAgICAgIDwvY2M6QWdlbnQ+DQogICAgICAgIDwvZGM6cmlnaHRzPg0KICAgICAgICA8ZGM6cHVibGlzaGVyPg0KICAgICAgICAgIDxjYzpBZ2VudD4NCiAgICAgICAgICAgIDxkYzp0aXRsZT5Ub3JzdGVuIFNrb21wPC9kYzp0aXRsZT4NCiAgICAgICAgICA8L2NjOkFnZW50Pg0KICAgICAgICA8L2RjOnB1Ymxpc2hlcj4NCiAgICAgICAgPGRjOmxhbmd1YWdlPmRlX0RFPC9kYzpsYW5ndWFnZT4NCiAgICAgICAgPGRjOnN1YmplY3Q+DQogICAgICAgICAgPHJkZjpCYWc+DQogICAgICAgICAgICA8cmRmOmxpPlBpa3RvZ3JhbW07IEZvdG9ncmFmaWVydmVyYm90PC9yZGY6bGk+DQogICAgICAgICAgPC9yZGY6QmFnPg0KICAgICAgICA8L2RjOnN1YmplY3Q+DQogICAgICAgIDxkYzpkZXNjcmlwdGlvbj5Gb3RvZ3JhZmllcnZlcmJvdCBhbHMgUGlrdG9ncmFtbSA8L2RjOmRlc2NyaXB0aW9uPg0KICAgICAgICA8Y2M6bGljZW5zZQ0KICAgICAgICAgICByZGY6cmVzb3VyY2U9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL2xpY2Vuc2VzL3B1YmxpY2RvbWFpbi8iIC8+DQogICAgICA8L2NjOldvcms+DQogICAgICA8Y2M6TGljZW5zZQ0KICAgICAgICAgcmRmOmFib3V0PSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9saWNlbnNlcy9wdWJsaWNkb21haW4vIj4NCiAgICAgICAgPGNjOnBlcm1pdHMNCiAgICAgICAgICAgcmRmOnJlc291cmNlPSJodHRwOi8vY3JlYXRpdmVjb21tb25zLm9yZy9ucyNSZXByb2R1Y3Rpb24iIC8+DQogICAgICAgIDxjYzpwZXJtaXRzDQogICAgICAgICAgIHJkZjpyZXNvdXJjZT0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjRGlzdHJpYnV0aW9uIiAvPg0KICAgICAgICA8Y2M6cGVybWl0cw0KICAgICAgICAgICByZGY6cmVzb3VyY2U9Imh0dHA6Ly9jcmVhdGl2ZWNvbW1vbnMub3JnL25zI0Rlcml2YXRpdmVXb3JrcyIgLz4NCiAgICAgIDwvY2M6TGljZW5zZT4NCiAgICA8L3JkZjpSREY+DQogIDwvbWV0YWRhdGE+DQogIDxnDQogICAgIGlua3NjYXBlOmxhYmVsPSJFYmVuZSAxIg0KICAgICBpbmtzY2FwZTpncm91cG1vZGU9ImxheWVyIg0KICAgICBpZD0ibGF5ZXIxIj4NCiAgICA8cGF0aA0KICAgICAgIHN0eWxlPSJmaWxsOiMwMDAwMDA7ZmlsbC1vcGFjaXR5OjEiDQogICAgICAgZD0iTSAxNjQuNTMxMjUgNjIuNjg3NSBDIDE2Mi43OTExNSA2Mi42ODc1MDEgMTYxLjM3NSA2NC4wNzI0MTYgMTYxLjM3NSA2NS44MTI1IEwgMTYxLjM3NSA2OC43NSBMIDM4LjM3NSA2OC43NSBDIDM1LjA5MjI5OCA2OC43NDk5OTkgMzIuNDY4NzUgNzEuMzczNTQ4IDMyLjQ2ODc1IDc0LjY1NjI1IEwgMzIuNDY4NzUgMTgxLjM3NSBDIDMyLjQ2ODc1IDE4NC42NTc3IDM1LjA5MjMwNyAxODcuMzEyNTEgMzguMzc1IDE4Ny4zMTI1IEwgMjExLjYyNSAxODcuMzEyNSBDIDIxNC45MDc2OSAxODcuMzEyNSAyMTcuNTMxMjcgMTg0LjY1NzcgMjE3LjUzMTI1IDE4MS4zNzUgTCAyMTcuNTMxMjUgNzQuNjU2MjUgQyAyMTcuNTMxMjUgNzEuMzczNTUxIDIxNC45MDc2OCA2OC43NSAyMTEuNjI1IDY4Ljc1IEwgMjAyLjA2MjUgNjguNzUgTCAyMDIuMDYyNSA2NS44MTI1IEMgMjAyLjA2MjUgNjQuMDcyNDEgMjAwLjY0NjM1IDYyLjY4NzUgMTk4LjkwNjI1IDYyLjY4NzUgTCAxNjQuNTMxMjUgNjIuNjg3NSB6IE0gNDYuODEyNSA3OCBMIDg4LjY1NjI1IDc4IEMgOTAuMzk2MzQyIDc4IDkxLjgxMjUgNzkuMzg0OTA3IDkxLjgxMjUgODEuMTI1IEwgOTEuODEyNSA5Ni4zMTI1IEMgOTEuODEyNSA5OC4wNTI1OTIgOTAuMzk2MzQzIDk5LjQzNzUgODguNjU2MjUgOTkuNDM3NSBMIDQ2LjgxMjUgOTkuNDM3NSBDIDQ1LjA3MjQwOCA5OS40Mzc1IDQzLjY4NzUgOTguMDUyNTkzIDQzLjY4NzUgOTYuMzEyNSBMIDQzLjY4NzUgODEuMTI1IEMgNDMuNjg3NSA3OS4zODQ5MDggNDUuMDcyNDA3IDc4IDQ2LjgxMjUgNzggeiBNIDE0NiA4OC4yMTg3NSBDIDE2Ny43MzQ3NSA4OC4yMTg3NTMgMTg1LjM3NSAxMDYuMTUwNzEgMTg1LjM3NSAxMjguMjUgQyAxODUuMzc0OTkgMTUwLjM0OTI4IDE2Ny43MzQ3NCAxNjguMjgxMjUgMTQ2IDE2OC4yODEyNSBDIDEyNC4yNjUyNyAxNjguMjgxMjYgMTA2LjYyNSAxNTAuMzQ5MjkgMTA2LjYyNSAxMjguMjUgQyAxMDYuNjI1IDEwNi4xNTA3MSAxMjQuMjY1MjYgODguMjE4NzUgMTQ2IDg4LjIxODc1IHogTSAxNDYgOTEuNzE4NzUgQyAxMjYuMTY1NTcgOTEuNzE4NzUgMTEwLjA2MjUgMTA4LjA4Mjg5IDExMC4wNjI1IDEyOC4yNSBDIDExMC4wNjI1IDE0OC40MTcxMSAxMjYuMTY1NTcgMTY0Ljc4MTI2IDE0NiAxNjQuNzgxMjUgQyAxNjUuODM0NDMgMTY0Ljc4MTI1IDE4MS45Mzc1IDE0OC40MTcxIDE4MS45Mzc1IDEyOC4yNSBDIDE4MS45Mzc1IDEwOC4wODI4OSAxNjUuODM0NDMgOTEuNzE4NzUgMTQ2IDkxLjcxODc1IHogTSAxNDYgOTYuNTkzNzUgQyAxNjMuMTc3NjggOTYuNTkzNzUyIDE3Ny4xMjUgMTEwLjc4NDIgMTc3LjEyNSAxMjguMjUgQyAxNzcuMTI0OTkgMTQ1LjcxNTggMTYzLjE3NzY5IDE1OS44NzUgMTQ2IDE1OS44NzUgQyAxMjguODIyMzEgMTU5Ljg3NSAxMTQuODc1IDE0NS43MTU4IDExNC44NzUgMTI4LjI1IEMgMTE0Ljg3NSAxMTAuNzg0MTkgMTI4LjgyMjMxIDk2LjU5Mzc1IDE0NiA5Ni41OTM3NSB6IE0gMTc2LjUgMTcyLjcxODc1IEwgMjA2LjE4NzUgMTcyLjcxODc1IEMgMjA3LjQyMTM4IDE3Mi43MTg3NSAyMDguNDA2MjUgMTczLjEyNzgzIDIwOC40MDYyNSAxNzMuNjI1IEwgMjA4LjQwNjI1IDE3Ny45Njg3NSBDIDIwOC40MDYyNSAxNzguNDY1OTIgMjA3LjQyMTM4IDE3OC44NDM3NSAyMDYuMTg3NSAxNzguODQzNzUgTCAxNzYuNSAxNzguODQzNzUgQyAxNzUuMjY2MTEgMTc4Ljg0Mzc1IDE3NC4yODEyNSAxNzguNDY1OTIgMTc0LjI4MTI1IDE3Ny45Njg3NSBMIDE3NC4yODEyNSAxNzMuNjI1IEMgMTc0LjI4MTI1IDE3My4xMjc4MyAxNzUuMjY2MTIgMTcyLjcxODc1IDE3Ni41IDE3Mi43MTg3NSB6ICINCiAgICAgICBpZD0icmVjdDMyMDkiIC8+DQogICAgPHBhdGgNCiAgICAgICBzdHlsZT0iZmlsbDojYzQyNjFkO2ZpbGwtb3BhY2l0eToxIg0KICAgICAgIGQ9Ik0gMjAgMCBDIDE4LjU1OTkzOCAwIDE3LjE2NDc0NyAwLjE1MDk4NjY2IDE1LjgxMjUgMC40Mzc1IEMgMTUuMjEwMjkxIDAuNTY1MTk1NzggMTQuNjExOTEzIDAuNzI2MjExMjYgMTQuMDMxMjUgMC45MDYyNSBDIDEzLjU1NDc3MyAxLjA1Mzk4NTIgMTMuMDg1MzQ5IDEuMjI0ODUzNiAxMi42MjUgMS40MDYyNSBDIDEyLjMyODc2NiAxLjUyMzA3MzkgMTIuMDM5MDMzIDEuNjUwOTE4MiAxMS43NSAxLjc4MTI1IEMgMTEuMzQ3Mjc4IDEuOTYyMzU5OCAxMC45NTA0MDYgMi4xMzc0MTY1IDEwLjU2MjUgMi4zNDM3NSBDIDEwLjUyMTU1NSAyLjM2NTU2ODggMTAuNDc4MjczIDIuMzg0MTU1NSAxMC40Mzc1IDIuNDA2MjUgQyAxMC40MTY5MzQgMi40MTczNzU0IDEwLjM5NTUyMiAyLjQyNjMwNDkgMTAuMzc1IDIuNDM3NSBDIDkuODMyNjg2MSAyLjczMzM0NDYgOS4zMjI2NDQ4IDMuMDYzMjQ1MiA4LjgxMjUgMy40MDYyNSBDIDguMjgzMTIyMSAzLjc2MjE4NjUgNy43NzI3NzI4IDQuMTU4OTIwOSA3LjI4MTI1IDQuNTYyNSBDIDcuMjc1MDU1IDQuNTY3NTg2NiA3LjI1NjE4ODggNC41NTc0MDYxIDcuMjUgNC41NjI1IEMgNy4yMzg1NDc5IDQuNTcxOTQzNCA3LjIzMDE4MDYgNC41ODQyODE2IDcuMjE4NzUgNC41OTM3NSBDIDcuMTA0NzM1MiA0LjY4ODAxNTkgNi45ODY4NTA3IDQuNzc4MjY4NyA2Ljg3NSA0Ljg3NSBDIDYuNTE1NzAyMSA1LjE4NjQyNjQgNi4xNzk3OTA5IDUuNTA3NzA5MSA1Ljg0Mzc1IDUuODQzNzUgQyA1LjQwNDQwMjUgNi4yODE4MDc4IDQuOTkwNzQ0OSA2Ljc0MTM1NTQgNC41OTM3NSA3LjIxODc1IEMgNC41NzkwMDg2IDcuMjM2NTQ2MiA0LjU3NzE4MDYgNy4yNjM0MDE1IDQuNTYyNSA3LjI4MTI1IEMgMy43Njc0ODk4IDguMjQzOTE4MSAzLjA0MjI3MjEgOS4yNzE4NzA1IDIuNDM3NSAxMC4zNzUgQyAyLjQyNjIyMzIgMTAuMzk1NjM1IDIuNDE3NDU2MSAxMC40MTY4MiAyLjQwNjI1IDEwLjQzNzUgQyAyLjEwODM5MDggMTAuOTg1MzQ4IDEuODQwMjIzMyAxMS41NDcyMTQgMS41OTM3NSAxMi4xMjUgQyAxLjU3NTU4NjUgMTIuMTY3NjY1IDEuNTQ5MTI1NSAxMi4yMDcxODIgMS41MzEyNSAxMi4yNSBDIDEuMjg3NzEzMSAxMi44MzI0MzMgMS4wOTQ2NzU0IDEzLjQyMTgyMiAwLjkwNjI1IDE0LjAzMTI1IEMgMC43Mjk2MzAxNCAxNC42MDI0OTUgMC41NjMwOTYzNCAxNS4xODg4MjggMC40Mzc1IDE1Ljc4MTI1IEMgMC4xNDY5MTQwNCAxNy4xNDI1NzggLTQuMzkwNjEzM2UtMTggMTguNTQ5NDY2IDAgMjAgTCAwIDIzMCBDIDAgMjQxLjA4IDguOTIgMjUwIDIwIDI1MCBMIDIzMCAyNTAgQyAyMzEuNDQwMDYgMjUwIDIzMi44MzUyNSAyNDkuODQ5MDEgMjM0LjE4NzUgMjQ5LjU2MjUgQyAyMzQuNzg5MDMgMjQ5LjQzNDk3IDIzNS4zODg2NiAyNDkuMjczODEgMjM1Ljk2ODc1IDI0OS4wOTM3NSBDIDIzNi40NDQ3NiAyNDguOTQ2IDIzNi45MTUwNSAyNDguNzc1MjYgMjM3LjM3NSAyNDguNTkzNzUgQyAyMzcuNjcxMjMgMjQ4LjQ3NjkzIDIzNy45NjA5NyAyNDguMzQ5MDggMjM4LjI1IDI0OC4yMTg3NSBDIDIzOC4yNzk4MSAyNDguMjA1MzEgMjM4LjMxNDAyIDI0OC4yMDEwOSAyMzguMzQzNzUgMjQ4LjE4NzUgQyAyMzguNzU4MzYgMjQ3Ljk5ODMgMjM5LjE2Mzc0IDI0Ny44MDk4MSAyMzkuNTYyNSAyNDcuNTkzNzUgQyAyMzkuNTgzMTggMjQ3LjU4MjU0IDIzOS42MDQzNiAyNDcuNTczNzggMjM5LjYyNSAyNDcuNTYyNSBDIDI0MC4xNjkyNSAyNDcuMjY1MTIgMjQwLjY3NTU4IDI0Ni45Mzg3MyAyNDEuMTg3NSAyNDYuNTkzNzUgQyAyNDEuNjY4NzggMjQ2LjI2OTQxIDI0Mi4xNDM1OSAyNDUuOTI2MzkgMjQyLjU5Mzc1IDI0NS41NjI1IEMgMjQyLjY0NDc0IDI0NS41MjEyOCAyNDIuNjk5NDMgMjQ1LjQ3OTIxIDI0Mi43NSAyNDUuNDM3NSBDIDI0Mi44NzY1MSAyNDUuMzMzMTggMjQzLjAwMTE1IDI0NS4yMzIzNSAyNDMuMTI1IDI0NS4xMjUgQyAyNDMuNDgyNjUgMjQ0LjgxNTM4IDI0My44MjE1NSAyNDQuNDkwMTkgMjQ0LjE1NjI1IDI0NC4xNTYyNSBDIDI0NC40OTIyOSAyNDMuODIwMjEgMjQ0LjgxMzU3IDI0My40ODQzIDI0NS4xMjUgMjQzLjEyNSBDIDI0NS4yMzE2NyAyNDMuMDAyMzQgMjQ1LjMzMzgxIDI0Mi44NzUyNyAyNDUuNDM3NSAyNDIuNzUgQyAyNDUuNDQyNzYgMjQyLjc0MzYyIDI0NS40MzIyNSAyNDIuNzI1MTMgMjQ1LjQzNzUgMjQyLjcxODc1IEMgMjQ1Ljg0MjQ5IDI0Mi4yMjgzIDI0Ni4yMzY0IDI0MS43MTU3NiAyNDYuNTkzNzUgMjQxLjE4NzUgQyAyNDYuOTM4MTIgMjQwLjY3ODQzIDI0Ny4yNjUzNiAyNDAuMTY2MjIgMjQ3LjU2MjUgMjM5LjYyNSBDIDI0Ny41NzM2MyAyMzkuNjA0NzIgMjQ3LjU4MjY4IDIzOS41ODI4MiAyNDcuNTkzNzUgMjM5LjU2MjUgQyAyNDcuODkxOTcgMjM5LjAxNDggMjQ4LjE1OTMxIDIzOC40NTIzOSAyNDguNDA2MjUgMjM3Ljg3NSBDIDI0OC40MTU1NCAyMzcuODUzMjggMjQ4LjQyODI5IDIzNy44MzQyNiAyNDguNDM3NSAyMzcuODEyNSBDIDI0OC40NDY0NCAyMzcuNzkxMjkgMjQ4LjQ1OTg4IDIzNy43NzEyNSAyNDguNDY4NzUgMjM3Ljc1IEMgMjQ4LjcwOTkyIDIzNy4xNzQ3NiAyNDguOTA2MjggMjM2LjU3MDA4IDI0OS4wOTM3NSAyMzUuOTY4NzUgQyAyNDkuMjczNzUgMjM1LjM5MTM3IDI0OS40MzQ2OCAyMzQuODE3NTQgMjQ5LjU2MjUgMjM0LjIxODc1IEMgMjQ5Ljg1MzA5IDIzMi44NTc0MiAyNTAgMjMxLjQ1MDUzIDI1MCAyMzAgTCAyNTAgMjAgQyAyNTAgOC45MiAyNDEuMDggLTMuMzUzNzk4N2UtMTcgMjMwIDAgTCAyMCAwIHogTSAzNC43ODEyNSAxOS40MDYyNSBMIDIyNS40Njg3NSAxOS40MDYyNSBDIDIyOC4zMDk0NiAxOS40MDYyNSAyMzAuNTkzNzUgMjEuNjkwNTQ0IDIzMC41OTM3NSAyNC41MzEyNSBMIDIzMC41OTM3NSAyMTUuMjUgTCAzNC43ODEyNSAxOS40MDYyNSB6IE0gMTkuNDA2MjUgMzQuNzUgTCAyMTUuMjE4NzUgMjMwLjU5Mzc1IEwgMjQuNTMxMjUgMjMwLjU5Mzc1IEMgMjEuNjkwNTQ0IDIzMC41OTM3NiAxOS40MDYyNSAyMjguMzA5NDYgMTkuNDA2MjUgMjI1LjQ2ODc1IEwgMTkuNDA2MjUgMzQuNzUgeiAiDQogICAgICAgaWQ9InBhdGgzMTk2IiAvPg0KICA8L2c+DQo8L3N2Zz4NCg==";
  8889. Shape.UNICODE_LINE_SEP = String.fromCharCode(8232);//[String.fromCharCode(226), String.fromCharCode(128), String.fromCharCode(168)].join('');
  8890. }
  8891. return Shape.UNICODE_LINE_SEP;
  8892. };
  8893. ;
  8894. Shape.prototype.setThemeAndVariant = function (theme, themeVariant) {
  8895. this.theme = theme;
  8896. this.themeVariant = themeVariant;
  8897. };
  8898. Shape.prototype.getTheme = function () {
  8899. if (this.theme != null) {
  8900. this.theme.setVariant(this.themeVariant);
  8901. }
  8902. return this.theme;
  8903. };
  8904. Shape.prototype.getQuickStyleVals = function () {
  8905. return this.quickStyleVals;
  8906. };
  8907. Shape.prototype.processGeomList = function (parentGeoList) {
  8908. if (!this.geomListProcessed) {
  8909. this.geomList = new com.mxgraph.io.vsdx.mxVsdxGeometryList(parentGeoList);
  8910. if (this.geom != null) {
  8911. for (var index156 = 0; index156 < this.geom.length; index156++) {
  8912. var geoElem = this.geom[index156];
  8913. {
  8914. this.geomList.addGeometry(geoElem);
  8915. }
  8916. }
  8917. }
  8918. this.geomListProcessed = true;
  8919. }
  8920. };
  8921. /**
  8922. * Caches the specified element
  8923. * @param {*} elem the element to cache
  8924. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  8925. */
  8926. Shape.prototype.parseShapeElem = function (elem, model) {
  8927. _super.prototype.parseShapeElem.call(this, elem, model);
  8928. var childName = elem.nodeName;
  8929. if ((function (o1, o2) { if (o1 && o1.equals) {
  8930. return o1.equals(o2);
  8931. }
  8932. else {
  8933. return o1 === o2;
  8934. } })(childName, "ForeignData"))
  8935. {
  8936. function getForeignRel(elem, filename)
  8937. {
  8938. var fdChild = elem.firstChild;
  8939. while (fdChild != null)
  8940. {
  8941. if (fdChild.nodeType == 1)
  8942. {
  8943. var fdElem = fdChild;
  8944. var grandchildName = fdElem.nodeName;
  8945. if (grandchildName.toLowerCase() == "rel")
  8946. {
  8947. var rid = fdElem.getAttribute("r:id");
  8948. if (rid != null && !(rid.length === 0))
  8949. {
  8950. var index = filename.lastIndexOf('/');
  8951. var pre = "";
  8952. var post = "";
  8953. try
  8954. {
  8955. pre = filename.substring(0, index);
  8956. post = filename.substring(index, filename.length);
  8957. }
  8958. catch (e)
  8959. {
  8960. return;
  8961. }
  8962. var relElem = model.getRelationship(rid, pre + "/_rels" + post + ".rels");
  8963. if (relElem != null)
  8964. {
  8965. var target = relElem.getAttribute("Target") || "";
  8966. var type = relElem.getAttribute("Type");
  8967. index = target.lastIndexOf('/');
  8968. try
  8969. {
  8970. target = target.substring(index + 1, target.length);
  8971. }
  8972. catch (e)
  8973. {
  8974. return;
  8975. }
  8976. return {type: type, target: target};
  8977. }
  8978. return;
  8979. }
  8980. }
  8981. }
  8982. fdChild = fdChild.nextSibling;
  8983. }
  8984. }
  8985. var filename = elem.ownerDocument.vsdxFileName; //was getDocumentURI()
  8986. var iType = elem.getAttribute("ForeignType");
  8987. var compression = elem.getAttribute("CompressionType") || "";
  8988. var typeTarget = null;
  8989. if ((function (o1, o2) { if (o1 && o1.equals) {
  8990. return o1.equals(o2);
  8991. }
  8992. else {
  8993. return o1 === o2;
  8994. } })(iType, "Bitmap")) {
  8995. compression = compression.toLowerCase();
  8996. }
  8997. else if ((function (o1, o2) { if (o1 && o1.equals) {
  8998. return o1.equals(o2);
  8999. }
  9000. else {
  9001. return o1 === o2;
  9002. } })(iType, "MetaFile")) {
  9003. compression = "png"; //we convert emf files to png
  9004. }
  9005. else if ((function (o1, o2) { if (o1 && o1.equals) {
  9006. return o1.equals(o2);
  9007. }
  9008. else {
  9009. return o1 === o2;
  9010. } })(iType, "Enhanced Metafile") || (function (o1, o2) { if (o1 && o1.equals) {
  9011. return o1.equals(o2);
  9012. }
  9013. else {
  9014. return o1 === o2;
  9015. } })(iType, "EnhMetaFile")) {
  9016. compression = "png"; //we convert emf files to png
  9017. }
  9018. else if (iType == "Object") //This is a very basic support for embedded visio objects by looking for associated image
  9019. {
  9020. typeTarget = getForeignRel(elem, filename);
  9021. if (typeTarget.type.indexOf('/oleObject') > 0)
  9022. {
  9023. var relElem = model.getRelationship("rId1", "visio/embeddings/_rels/" + typeTarget.target + ".rels");
  9024. if (relElem != null)
  9025. {
  9026. var target = relElem.getAttribute("Target");
  9027. var type = relElem.getAttribute("Type");
  9028. try
  9029. {
  9030. var index = target.lastIndexOf('/');
  9031. target = target.substring(index + 1, target.length);
  9032. }
  9033. catch (e)
  9034. {
  9035. return;
  9036. }
  9037. compression = "png";
  9038. typeTarget = {type: type, target: target};
  9039. }
  9040. else
  9041. {
  9042. return;
  9043. }
  9044. }
  9045. }
  9046. else {
  9047. return;
  9048. }
  9049. if (typeTarget == null)
  9050. {
  9051. typeTarget = getForeignRel(elem, filename);
  9052. }
  9053. var type = typeTarget.type, target = typeTarget.target;
  9054. if (type != null && (function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(type, "image"))
  9055. {
  9056. this.imageData = ({});
  9057. var iData = model.getMedia(com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/media/" + target);
  9058. if (!iData)
  9059. {
  9060. /* put */ (this.imageData["iData"] = Shape.ERROR_IMAGE);
  9061. /* put */ (this.imageData["iType"] = 'svg+xml');
  9062. }
  9063. else
  9064. {
  9065. /* put */ (this.imageData["iData"] = iData);
  9066. if ((function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(target.toLowerCase(), ".bmp")) {
  9067. compression = "jpg";
  9068. }
  9069. /* put */ (this.imageData["iType"] = compression);
  9070. }
  9071. }
  9072. }
  9073. else if ((function (o1, o2) { if (o1 && o1.equals) {
  9074. return o1.equals(o2);
  9075. }
  9076. else {
  9077. return o1 === o2;
  9078. } })(childName, com.mxgraph.io.vsdx.mxVsdxConstants.TEXT)) {
  9079. this.text = elem;
  9080. }
  9081. };
  9082. /**
  9083. * Caches the specific section element
  9084. * @param {*} elem the element to cache
  9085. */
  9086. Shape.prototype.parseSection = function (elem) {
  9087. var n = elem.getAttribute("N");
  9088. if ((function (o1, o2) { if (o1 && o1.equals) {
  9089. return o1.equals(o2);
  9090. }
  9091. else {
  9092. return o1 === o2;
  9093. } })(n, "Geometry")) {
  9094. if (this.geom == null) {
  9095. this.geom = ([]);
  9096. }
  9097. /* add */ (this.geom.push(elem));
  9098. }
  9099. else if ((function (o1, o2) { if (o1 && o1.equals) {
  9100. return o1.equals(o2);
  9101. }
  9102. else {
  9103. return o1 === o2;
  9104. } })(n, "Field")) {
  9105. var rows = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(elem, "Row");
  9106. for (var index157 = 0; index157 < rows.length; index157++) {
  9107. var row = rows[index157];
  9108. {
  9109. var ix = row.getAttribute("IX") || "";
  9110. if (!(ix.length === 0)) {
  9111. if (this.fields == null) {
  9112. this.fields = ({});
  9113. }
  9114. var del = row.getAttribute("Del");
  9115. if ((function (o1, o2) { if (o1 && o1.equals) {
  9116. return o1.equals(o2);
  9117. }
  9118. else {
  9119. return o1 === o2;
  9120. } })("1", del)) {
  9121. /* put */ (this.fields[ix] = "");
  9122. continue;
  9123. }
  9124. var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(row, "Cell");
  9125. var value = "";
  9126. var format = "";
  9127. var calendar = "";
  9128. var type = "";
  9129. for (var index158 = 0; index158 < cells.length; index158++) {
  9130. var cell = cells[index158];
  9131. {
  9132. n = cell.getAttribute("N");
  9133. var v = cell.getAttribute("V") || cell.textContent || "";
  9134. switch ((n)) {
  9135. case "Value":
  9136. value = v;
  9137. break;
  9138. case "Format":
  9139. format = v;
  9140. break;
  9141. case "Calendar":
  9142. calendar = v;
  9143. break;
  9144. case "Type":
  9145. type = v;
  9146. break;
  9147. }
  9148. }
  9149. }
  9150. if (format == 'esc(0)')
  9151. {
  9152. this.fields[ix] = value;
  9153. }
  9154. else if (!(value.length === 0)) {
  9155. try {
  9156. //Date can be in string date format or a number
  9157. var date = isNaN(value)? new Date(value) : new Date(Shape.VSDX_START_TIME + Math.floor((parseFloat(value) * 24 * 60 * 60 * 1000)));
  9158. if (format == 'c')
  9159. {
  9160. if (date.getHours() + date.getMinutes() + date.getSeconds() + date.getMilliseconds() == 0)
  9161. {
  9162. format = 'm/d/yyyy';
  9163. }
  9164. else
  9165. {
  9166. format = 'm/d/yyyy h:MM:ss tt';
  9167. }
  9168. }
  9169. else if (format == 'ddddd')
  9170. {
  9171. format = 'm/d/yyyy';
  9172. }
  9173. else if (format == 'dddddd')
  9174. {
  9175. format = 'dddd, mmmm dd, yyyy';
  9176. }
  9177. else if (format == 'C')
  9178. {
  9179. format = 'dddd, mmmm dd, yyyy h:MM:ss tt';
  9180. }
  9181. else if (format == 'T')
  9182. {
  9183. format = 'h:MM:ss tt';
  9184. }
  9185. else
  9186. {
  9187. //Our date format function swaps M/m meaning
  9188. format = format.replace(/am\/pm/g, 'tt').replace(/m/g, '@').replace(/M/g, 'm').replace(/@/g, 'M');
  9189. }
  9190. value = Graph.prototype.formatDate(date, /* replaceAll */ 'UTC:' + format.replace(new RegExp("\\{|\\}", 'g'), ""));
  9191. }
  9192. catch (e) {
  9193. }
  9194. ;
  9195. /* put */ (this.fields[ix] = value);
  9196. }
  9197. }
  9198. }
  9199. }
  9200. }
  9201. else {
  9202. _super.prototype.parseSection.call(this, elem);
  9203. }
  9204. };
  9205. /**
  9206. *
  9207. * @return {string} mxGraph stencil XML or null or there is no displayed geometry
  9208. */
  9209. Shape.prototype.parseGeom = function () {
  9210. if (!this.hasGeomList()) {
  9211. return "";
  9212. }
  9213. return this.geomList.getShapeXML(this);
  9214. };
  9215. /**
  9216. * Returns the value of the Text element.
  9217. * @return {string} Value of the Text element.
  9218. */
  9219. Shape.prototype.getText = function () {
  9220. return this.text != null ? this.text.textContent : null;
  9221. };
  9222. /**
  9223. * Returns the children Nodes of Text.
  9224. * @return {*} List with the children of the Text element.
  9225. */
  9226. Shape.prototype.getTextChildren = function () {
  9227. return this.text != null ? this.text.childNodes : null;
  9228. };
  9229. /**
  9230. * Returns the value of the width element in pixels.
  9231. * @return {number} Numerical value of the width element.
  9232. */
  9233. Shape.prototype.getWidth = function () {
  9234. if (this.width < 1 && this.childShapes != null)
  9235. {
  9236. try
  9237. {
  9238. for (var i = 0; i < this.childShapes.entries.length; i++)
  9239. {
  9240. var c = this.childShapes.entries[i].value;
  9241. this.width = Math.max(c.width, this.width);
  9242. }
  9243. }
  9244. catch(e){}
  9245. }
  9246. return this.width === 0 && this.height > 0 ? 1 : this.width;
  9247. };
  9248. /**
  9249. * Returns the value of the height element in pixels.
  9250. * @return {number} Numerical value of the height element.
  9251. */
  9252. Shape.prototype.getHeight = function () {
  9253. if (this.height < 1 && this.childShapes != null)
  9254. {
  9255. try
  9256. {
  9257. for (var i = 0; i < this.childShapes.entries.length; i++)
  9258. {
  9259. var c = this.childShapes.entries[i].value;
  9260. this.height = Math.max(c.height, this.height);
  9261. }
  9262. }
  9263. catch(e){}
  9264. }
  9265. return this.height === 0 && this.width > 0 ? 1 : this.height;
  9266. };
  9267. /**
  9268. * Returns the value of the rotation.
  9269. * @return {number} Numerical value of the rotation
  9270. */
  9271. Shape.prototype.getRotation = function () {
  9272. return this.rotation;
  9273. };
  9274. /**
  9275. * Returns the style map of this shape
  9276. * @return {*} the style map
  9277. */
  9278. Shape.prototype.getStyleMap = function () {
  9279. return this.styleMap;
  9280. };
  9281. /**
  9282. * Returns whether or not this shape has a geometry defined, locally
  9283. * or inherited
  9284. * @return {boolean} whether the shape has a geometry
  9285. */
  9286. Shape.prototype.hasGeom = function () {
  9287. return !(this.geom == null || (this.geom.length == 0));
  9288. };
  9289. /**
  9290. * Returns whether or not this shape or its master has a geometry defined
  9291. * @return {boolean} whether the shape has a geometry
  9292. */
  9293. Shape.prototype.hasGeomList = function () {
  9294. return this.geomList != null && this.geomList.hasGeom();
  9295. };
  9296. /**
  9297. * Check if the paragraph is a list and return the list with its style
  9298. * @param {string} pp Reference to a Para element
  9299. * @return {string} the opening tag of the list with style or null if no list is found
  9300. */
  9301. Shape.prototype.getPPList = function (pp)
  9302. {
  9303. var ul = null;
  9304. if (pp != '')
  9305. {
  9306. var bullet = this.getBullet(pp);
  9307. if (bullet != '0')
  9308. {
  9309. ul = '<ul style="margin: 0;list-style-type: ' + (bullet == '4'? 'square' : 'disc') + '">';
  9310. }
  9311. }
  9312. return ul;
  9313. };
  9314. /**
  9315. * Returns the paragraph formated according the properties in the last
  9316. * Para element referenced.
  9317. * @param {string} para Paragraph to be formated
  9318. * @return {string} Formated paragraph.
  9319. */
  9320. Shape.prototype.getTextParagraphFormated = function (para) {
  9321. var ret = "";
  9322. var styleMap = ({});
  9323. /* put */ (styleMap["text-align"] = this.getHorizontalAlign(this.pp, true));
  9324. /* put */ (styleMap["margin-left"] = this.getIndentLeft(this.pp));
  9325. /* put */ (styleMap["margin-right"] = this.getIndentRight(this.pp));
  9326. /* put */ (styleMap["margin-top"] = this.getSpBefore(this.pp) + "px");
  9327. /* put */ (styleMap["margin-bottom"] = this.getSpAfter(this.pp) + "px");
  9328. /* put */ (styleMap["text-indent"] = this.getIndentFirst(this.pp));
  9329. /* put */ (styleMap["vertical-align"] = this.getAlignVertical());
  9330. /* put */ (styleMap["direction"] = this.getTextDirection(this.pp));
  9331. ret += this.insertAttributes(para, styleMap);
  9332. return ret;
  9333. };
  9334. /**
  9335. * Returns the text formated according the properties in the last
  9336. * Char element referenced.
  9337. * @param {string} text Text to be formated
  9338. * @return {string} Formated text.
  9339. */
  9340. Shape.prototype.getTextCharFormated = function (text) {
  9341. var ret = "";
  9342. var color = "color:" + this.getTextColor(this.cp) + ";";
  9343. var size = "font-size:" + (parseFloat(this.getTextSize(this.cp))) + "px;";
  9344. var font = "font-family:" + this.getTextFont(this.cp) + ";";
  9345. var direction = "direction:" + this.getRtlText(this.cp) + ";";
  9346. var space = "letter-spacing:" + (parseFloat(this.getLetterSpace(this.cp)) / 0.71) + "px;";
  9347. var lineHeight = "line-height:" + this.getSpcLine(this.pp);
  9348. var opacity = ";opacity:" + this.getTextOpacity(this.cp);
  9349. var pos = this.getTextPos(this.cp);
  9350. var tCase = this.getTextCase(this.cp);
  9351. if ((function (o1, o2) { if (o1 && o1.equals) {
  9352. return o1.equals(o2);
  9353. }
  9354. else {
  9355. return o1 === o2;
  9356. } })(tCase, "1")) {
  9357. text = text.toUpperCase();
  9358. }
  9359. else if ((function (o1, o2) { if (o1 && o1.equals) {
  9360. return o1.equals(o2);
  9361. }
  9362. else {
  9363. return o1 === o2;
  9364. } })(tCase, "2")) {
  9365. text = com.mxgraph.io.vsdx.mxVsdxUtils.toInitialCapital(text);
  9366. }
  9367. if ((function (o1, o2) { if (o1 && o1.equals) {
  9368. return o1.equals(o2);
  9369. }
  9370. else {
  9371. return o1 === o2;
  9372. } })(pos, "1")) {
  9373. text = com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "sup");
  9374. }
  9375. else if ((function (o1, o2) { if (o1 && o1.equals) {
  9376. return o1.equals(o2);
  9377. }
  9378. else {
  9379. return o1 === o2;
  9380. } })(pos, "2")) {
  9381. text = com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "sub");
  9382. }
  9383. text = this.isBold(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "b") : text;
  9384. text = this.isItalic(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "i") : text;
  9385. text = this.isUnderline(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "u") : text;
  9386. text = this.getTextStrike(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "s") : text;
  9387. text = this.isSmallCaps(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.toSmallCaps(text, this.getTextSize(this.cp)) : text;
  9388. ret += "<font style=\"" + size + font + color + direction + space + lineHeight + opacity + "\">" + text + "</font>";
  9389. return ret;
  9390. };
  9391. /**
  9392. * Returns the direction of the text. It may be right to left or left to right.<br/>
  9393. * This property may to be founded in the shape, master shape, stylesheet or
  9394. * default style-sheet.
  9395. * @param {string} index Index of the Para element that contains the Flags element.
  9396. * @return {string} The direction of the text.
  9397. */
  9398. Shape.prototype.getTextDirection = function (index) {
  9399. var direction = this.getFlags(index);
  9400. if ((function (o1, o2) { if (o1 && o1.equals) {
  9401. return o1.equals(o2);
  9402. }
  9403. else {
  9404. return o1 === o2;
  9405. } })(direction, "0")) {
  9406. direction = "ltr";
  9407. }
  9408. else if ((function (o1, o2) { if (o1 && o1.equals) {
  9409. return o1.equals(o2);
  9410. }
  9411. else {
  9412. return o1 === o2;
  9413. } })(direction, "1")) {
  9414. direction = "rtl";
  9415. }
  9416. return direction;
  9417. };
  9418. /**
  9419. * Returns the space between lines in a paragraph.<br/>
  9420. * This property may to be founded in the shape, master shape, stylesheet or
  9421. * default style-sheet.
  9422. * @param {string} index Index of the Para element that contains the SpLine element.
  9423. * @return {string} The space between lines n pixels.
  9424. */
  9425. Shape.prototype.getSpcLine = function (index) {
  9426. var ret = "0";
  9427. var isPercent = false;
  9428. var space = this.getSpLine(index);
  9429. if (space > 0) {
  9430. space = space * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  9431. }
  9432. else if (space === 0) {
  9433. space = 100;
  9434. isPercent = true;
  9435. }
  9436. else {
  9437. space = Math.abs(space) * 100;
  9438. isPercent = true;
  9439. }
  9440. ret = new String(space).toString();
  9441. ret += isPercent ? "%" : "px";
  9442. return ret;
  9443. };
  9444. /**
  9445. * Returns the space before a paragraph.<br/>
  9446. * This property may to be founded in the shape, master shape, stylesheet or
  9447. * default style-sheet.
  9448. * @param {string} index Index of the Para element that contains the SpBefore element.
  9449. * @return {string} The space before the paragraph in pixels.
  9450. */
  9451. Shape.prototype.getSpcBefore = function (index) {
  9452. return this.getSpBefore(index);
  9453. };
  9454. /**
  9455. * Inserts the style attributes contained in attr into the text.<br/>
  9456. * The text must be surrounded by tags html.
  9457. * @param {string} text Text where the attributes must be inserted.
  9458. * @param {*} attr Map with the attributes.
  9459. * @return {string} Text with the attributes applied like style.
  9460. */
  9461. Shape.prototype.insertAttributes = function (text, attr) {
  9462. if (text.indexOf(">") != -1) {
  9463. var i = text.indexOf(">");
  9464. var tail = text.substring(i);
  9465. var head = text.substring(0, i);
  9466. var style = " style=\"" + com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(attr, ":") + "\"";
  9467. return head + style + tail;
  9468. }
  9469. return text;
  9470. };
  9471. /**
  9472. * Returns the direction of the text. It may be right to left or left to right.<br/>
  9473. * This property may to be founded in the shape, master shape, stylesheet or
  9474. * default stylesheet.
  9475. * @param {string} index Index of the Char element that contains the RTLText element.
  9476. * @return {string} Direction of the text.
  9477. */
  9478. Shape.prototype.getRtlText = function (index) {
  9479. var rtlElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.RTL_TEXT, index, com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH);
  9480. var direction = this.getValue(rtlElem, "ltr");
  9481. if ((function (o1, o2) { if (o1 && o1.equals) {
  9482. return o1.equals(o2);
  9483. }
  9484. else {
  9485. return o1 === o2;
  9486. } })(direction, "0")) {
  9487. direction = "ltr";
  9488. }
  9489. else if ((function (o1, o2) { if (o1 && o1.equals) {
  9490. return o1.equals(o2);
  9491. }
  9492. else {
  9493. return o1 === o2;
  9494. } })(direction, "1")) {
  9495. direction = "rtl";
  9496. }
  9497. return direction;
  9498. };
  9499. /**
  9500. * Checks if the style property of the Char element of index = 'index'
  9501. * indicates bold.<br/>
  9502. * This property may to be founded in the shape, master shape, stylesheet or
  9503. * default stylesheet.
  9504. * @param {string} index Index of the Char element that contains the Style element.
  9505. * @return {boolean} Returns <code>true</code> if the style property of the Char element of
  9506. * index = 'index' indicates bold.
  9507. */
  9508. Shape.prototype.isBold = function (index) {
  9509. var isBold = false;
  9510. var style = this.getTextStyle(index);
  9511. if (!(function (o1, o2) { if (o1 && o1.equals) {
  9512. return o1.equals(o2);
  9513. }
  9514. else {
  9515. return o1 === o2;
  9516. } })(style, "")) {
  9517. if ((function (o1, o2) { if (o1 && o1.equals) {
  9518. return o1.equals(o2);
  9519. }
  9520. else {
  9521. return o1 === o2;
  9522. } })(style.toLowerCase(), "themed")) {
  9523. }
  9524. else {
  9525. var value = parseInt(style);
  9526. isBold = ((value & 1) === 1);
  9527. }
  9528. }
  9529. return isBold;
  9530. };
  9531. /**
  9532. * Checks if the style property of the Char element of index = 'index'
  9533. * indicates italic.<br/>
  9534. * This property may to be founded in the shape, master shape, stylesheet or
  9535. * default stylesheet.
  9536. * @param {string} index Index of the Char element that contains the Style element.
  9537. * @return {boolean} Returns <code>true</code> if the style property of the Char element of
  9538. * index = 'index' indicates italic.
  9539. */
  9540. Shape.prototype.isItalic = function (index) {
  9541. var isItalic = false;
  9542. var style = this.getTextStyle(index);
  9543. if (!(function (o1, o2) { if (o1 && o1.equals) {
  9544. return o1.equals(o2);
  9545. }
  9546. else {
  9547. return o1 === o2;
  9548. } })(style, "")) {
  9549. if ((function (o1, o2) { if (o1 && o1.equals) {
  9550. return o1.equals(o2);
  9551. }
  9552. else {
  9553. return o1 === o2;
  9554. } })(style.toLowerCase(), "themed")) {
  9555. }
  9556. else {
  9557. var value = parseInt(style);
  9558. isItalic = ((value & 2) === 2);
  9559. }
  9560. }
  9561. return isItalic;
  9562. };
  9563. /**
  9564. * Checks if the style property of the Char element of index = 'index'
  9565. * indicates underline.<br/>
  9566. * This property may to be founded in the shape, master shape, stylesheet or
  9567. * default stylesheet.
  9568. * @param {string} index Index of the Char element that contains the Style element.
  9569. * @return {boolean} Returns <code>true</code> if the style property of the Char element of
  9570. * index = 'index' indicates underline.
  9571. */
  9572. Shape.prototype.isUnderline = function (index) {
  9573. var isUnderline = false;
  9574. var style = this.getTextStyle(index);
  9575. if (!(function (o1, o2) { if (o1 && o1.equals) {
  9576. return o1.equals(o2);
  9577. }
  9578. else {
  9579. return o1 === o2;
  9580. } })(style, "")) {
  9581. if ((function (o1, o2) { if (o1 && o1.equals) {
  9582. return o1.equals(o2);
  9583. }
  9584. else {
  9585. return o1 === o2;
  9586. } })(style.toLowerCase(), "themed")) {
  9587. }
  9588. else {
  9589. var value = parseInt(style);
  9590. isUnderline = ((value & 4) === 4);
  9591. }
  9592. }
  9593. return isUnderline;
  9594. };
  9595. /**
  9596. * Checks if the style property of the Char element of index = 'index'
  9597. * indicates small caps.<br/>
  9598. * This property may to be founded in the shape, master shape, stylesheet or
  9599. * default stylesheet.
  9600. * @param {string} index Index of the Char element that contains the Style element.
  9601. * @return {boolean} Returns <code>true</code> if the style property of the Char element of
  9602. * index = 'index' indicates small caps.
  9603. */
  9604. Shape.prototype.isSmallCaps = function (index) {
  9605. var isSmallCaps = false;
  9606. var style = this.getTextStyle(index);
  9607. if (!(function (o1, o2) { if (o1 && o1.equals) {
  9608. return o1.equals(o2);
  9609. }
  9610. else {
  9611. return o1 === o2;
  9612. } })(style, "")) {
  9613. if ((function (o1, o2) { if (o1 && o1.equals) {
  9614. return o1.equals(o2);
  9615. }
  9616. else {
  9617. return o1 === o2;
  9618. } })(style.toLowerCase(), "themed")) {
  9619. }
  9620. else {
  9621. var value = parseInt(style);
  9622. isSmallCaps = ((value & 8) === 8);
  9623. }
  9624. }
  9625. return isSmallCaps;
  9626. };
  9627. Shape.prototype.getTextOpacity = function (index) {
  9628. var colorTrans = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.COLOR_TRANS, index, com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER);
  9629. var trans = this.getValue(colorTrans, "0");
  9630. var result = "1";
  9631. if (trans != null && !(trans.length === 0)) {
  9632. var tmp = 1.0 - parseFloat(trans);
  9633. result = new String(tmp).toString();
  9634. }
  9635. return result;
  9636. };
  9637. /**
  9638. * Returns the actual text size defined by the Char element referenced in cp.<br/>
  9639. * This property may to be founded in the shape, master shape, stylesheet or
  9640. * default stylesheet.
  9641. * @param {string} index Index of the Char element that contains the Size element.
  9642. * @return {string} Returns the size of the font in pixels.
  9643. */
  9644. Shape.prototype.getTextSize = function (index) {
  9645. var sizeElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.SIZE, index, com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER);
  9646. var size = this.getScreenNumericalValue$org_w3c_dom_Element$double(sizeElem, 12);
  9647. return ('' + (Math.round(size * 100) / 100));
  9648. };
  9649. /**
  9650. * Returns the vertical align of the label.<br/>
  9651. * The property may to be defined in master shape or text stylesheet.<br/>
  9652. * @return {string} Vertical align (bottom, middle and top)
  9653. */
  9654. Shape.prototype.getAlignVertical = function () {
  9655. var vertical = mxConstants.ALIGN_MIDDLE;
  9656. var align = parseInt(this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.VERTICAL_ALIGN), "1"));
  9657. if (align === 0) {
  9658. vertical = mxConstants.ALIGN_TOP;
  9659. }
  9660. else if (align === 2) {
  9661. vertical = mxConstants.ALIGN_BOTTOM;
  9662. }
  9663. return vertical;
  9664. };
  9665. Shape.prototype.getGeomList = function () {
  9666. return this.geomList;
  9667. };
  9668. Shape.prototype.getLastX = function () {
  9669. return this.lastX;
  9670. };
  9671. Shape.prototype.getLastY = function () {
  9672. return this.lastY;
  9673. };
  9674. Shape.prototype.getLastMoveX = function () {
  9675. return this.lastMoveX;
  9676. };
  9677. Shape.prototype.getLastMoveY = function () {
  9678. return this.lastMoveY;
  9679. };
  9680. Shape.prototype.getLastKnot = function () {
  9681. return this.lastKnot;
  9682. };
  9683. Shape.prototype.setLastX = function (lastX) {
  9684. this.lastX = lastX;
  9685. };
  9686. Shape.prototype.setLastY = function (lastY) {
  9687. this.lastY = lastY;
  9688. };
  9689. Shape.prototype.setLastMoveX = function (lastMoveX) {
  9690. this.lastMoveX = lastMoveX;
  9691. };
  9692. Shape.prototype.setLastMoveY = function (lastMoveY) {
  9693. this.lastMoveY = lastMoveY;
  9694. };
  9695. Shape.prototype.setLastKnot = function (lastKnot) {
  9696. this.lastKnot = lastKnot;
  9697. };
  9698. Shape.prototype.getConnections = function ()
  9699. {
  9700. var connections = [];
  9701. if (this.sections && this.sections['Connection'])
  9702. {
  9703. var h = this.getHeight(), w = this.getWidth();
  9704. var rows = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(this.sections['Connection'].elem, "Row");
  9705. for (var i = 0; i < rows.length; i++)
  9706. {
  9707. var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(rows[i]);
  9708. var x, y;
  9709. for (var j = 0; j < cells.length; j++)
  9710. {
  9711. var cell = cells[j];
  9712. var cn = cell.getAttribute("N");
  9713. var val = this.getScreenNumericalValue$org_w3c_dom_Element$double(cell, 0);
  9714. if (cn == 'X')
  9715. {
  9716. x = mxUtils.format(val / w);
  9717. }
  9718. else if (cn == 'Y')
  9719. {
  9720. y = mxUtils.format(1 - val / h);
  9721. }
  9722. }
  9723. if (x != null && y != null)
  9724. {
  9725. connections.push({x: x, y: y});
  9726. }
  9727. }
  9728. }
  9729. if (connections.length == 0 && this.master && this.master.masterShape)
  9730. {
  9731. connections = this.master.masterShape.getConnections();
  9732. }
  9733. return connections;
  9734. };
  9735. return Shape;
  9736. }(com.mxgraph.io.vsdx.Style));
  9737. Shape.VSDX_START_TIME = new Date('1899-12-30T00:00:00Z').getTime();
  9738. vsdx.Shape = Shape;
  9739. Shape["__class"] = "com.mxgraph.io.vsdx.Shape";
  9740. })(vsdx = io.vsdx || (io.vsdx = {}));
  9741. })(io = mxgraph.io || (mxgraph.io = {}));
  9742. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  9743. })(com || (com = {}));
  9744. (function (com) {
  9745. var mxgraph;
  9746. (function (mxgraph) {
  9747. var io;
  9748. (function (io) {
  9749. var vsdx;
  9750. (function (vsdx) {
  9751. /**
  9752. * Create a new instance of mxVdxShape.
  9753. * This method get the references to the master element, master shape
  9754. * and stylesheet.
  9755. * @param {*} shape
  9756. * @param {com.mxgraph.io.vsdx.mxVsdxPage} page
  9757. * @param {boolean} vertex
  9758. * @param {*} masters
  9759. * @param {com.mxgraph.io.vsdx.mxVsdxMaster} master
  9760. * @param {com.mxgraph.io.vsdx.mxVsdxModel} model
  9761. * @class
  9762. * @extends com.mxgraph.io.vsdx.Shape
  9763. */
  9764. var VsdxShape = (function (_super) {
  9765. __extends(VsdxShape, _super);
  9766. function VsdxShape(page, shape, vertex, masters, master, model) {
  9767. //BUG in JSweet, fields default values and explicit assignments are not the same (defaults are before super() and assignments are after)!
  9768. var _this = this;
  9769. _this.masterShape = null;
  9770. _this.master = null;
  9771. _this.parentHeight = 0;
  9772. _this = _super.call(this, shape, model) || this;
  9773. /**
  9774. * Whether or not to assume HTML labels
  9775. */
  9776. _this.htmlLabels = true;
  9777. /**
  9778. * If the shape is a sub shape, this is a reference to its root shape, otherwise null
  9779. */
  9780. _this.rootShape = _this;
  9781. /**
  9782. * The prefix of the shape name
  9783. */
  9784. _this.shapeName = null;
  9785. /**
  9786. * Shape index
  9787. */
  9788. _this.shapeIndex = 0;
  9789. /**
  9790. * Whether this cell is a vertex
  9791. */
  9792. _this.vertex = true;
  9793. _this.childShapes = ({});
  9794. var masterId = _this.getMasterId();
  9795. var masterShapeLocal = _this.getShapeMasterId();
  9796. if (masterId != null) {
  9797. _this.master = (function (m, k) { return m[k] ? m[k] : null; })(masters, masterId);
  9798. }
  9799. else {
  9800. _this.master = master;
  9801. }
  9802. if (_this.master != null) {
  9803. if (masterId == null && masterShapeLocal != null) {
  9804. _this.masterShape = _this.master.getSubShape(masterShapeLocal);
  9805. }
  9806. else {
  9807. _this.masterShape = _this.master.getMasterShape();
  9808. }
  9809. }
  9810. var name = _this.getNameU();
  9811. var index = name.lastIndexOf(".");
  9812. if (index !== -1) {
  9813. name = name.substring(0, index);
  9814. }
  9815. _this.shapeName = name;
  9816. var shapesList = shape.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.SHAPES);
  9817. if (shapesList != null && shapesList.length > 0) {
  9818. var shapesElement = shapesList.item(0);
  9819. _this.childShapes = page.parseShapes(shapesElement, _this.master, false);
  9820. }
  9821. var rotation = _this.calcRotation();
  9822. _this.rotation = rotation * 100 / 100;
  9823. _this.rotation = _this.rotation % 360.0;
  9824. var themeIndex = page.getCellIntValue("ThemeIndex", -100);
  9825. if (themeIndex === -100) {
  9826. themeIndex = parseInt(_this.getValue(_this.getCellElement$java_lang_String("ThemeIndex"), "0"));
  9827. }
  9828. var theme = (function (m, k) { if (m.entries == null)
  9829. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9830. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9831. return m.entries[i].value;
  9832. } return null; })(model.getThemes(), themeIndex);
  9833. if (theme == null) {
  9834. if (urlParams['dev'] == '1')
  9835. {
  9836. console.log('No theme found for index ' + themeIndex);
  9837. }
  9838. // Using a default theme doesn't work well with all cases. Maybe give users an option to choose a default theme?
  9839. // theme = model.getDefaultTheme();
  9840. }
  9841. var variant = page.getCellIntValue("VariationColorIndex", 0);
  9842. _this.setThemeAndVariant(theme, variant);
  9843. {
  9844. var array161 = (function (m) { if (m.entries == null)
  9845. m.entries = []; return m.entries; })(_this.childShapes);
  9846. for (var index160 = 0; index160 < array161.length; index160++) {
  9847. var entry = array161[index160];
  9848. {
  9849. var childShape = entry.getValue();
  9850. childShape.setRootShape(_this);
  9851. if (childShape.theme == null) {
  9852. childShape.setThemeAndVariant(theme, variant);
  9853. }
  9854. }
  9855. }
  9856. }
  9857. _this.quickStyleVals = new com.mxgraph.io.vsdx.theme.QuickStyleVals(/* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleEffectsMatrix"), "0")), /* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleFillColor"), "1")), /* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleFillMatrix"), "0")), /* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleFontColor"), "1")), /* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleFontMatrix"), "0")), /* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleLineColor"), "1")), /* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleLineMatrix"), "0")), /* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleShadowColor"), "1")), /* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleType"), "0")), /* parseInt */ parseInt(_this.getValue(_this.getCellElement$java_lang_String("QuickStyleVariation"), "0")));
  9858. if (_this.masterShape != null) {
  9859. _this.masterShape.processGeomList(null);
  9860. _this.processGeomList(_this.masterShape.getGeomList());
  9861. if (_this.width === 0)
  9862. _this.width = _this.getScreenNumericalValue$org_w3c_dom_Element$double(_this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.WIDTH), 0);
  9863. if (_this.height === 0)
  9864. _this.height = _this.getScreenNumericalValue$org_w3c_dom_Element$double(_this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.HEIGHT), 0);
  9865. }
  9866. else {
  9867. _this.processGeomList(null);
  9868. }
  9869. // TODO It's hard to detect edges that should be treated like vertexes whhen they are groups and have child shapes.
  9870. // TODO Check this again if more complains are received or if we can have an edge group
  9871. _this.vertex = vertex || (page.connectsMap[_this.Id] != 2 && (_this.childShapes != null && !(function (m) { if (m.entries == null)
  9872. m.entries = []; return m.entries.length == 0; })(_this.childShapes)) || (_this.geomList != null && (!_this.geomList.isNoFill() || _this.geomList.getGeoCount() > 1)));
  9873. _this.layerMember = _this.getValue(_this.getCellElement$java_lang_String("LayerMember"));
  9874. if (_this.layerMember)
  9875. {
  9876. _this.layerMember = _this.layerMember.split(';');
  9877. }
  9878. return _this;
  9879. }
  9880. VsdxShape.__static_initialize = function () { if (!VsdxShape.__static_initialized) {
  9881. VsdxShape.__static_initialized = true;
  9882. VsdxShape.__static_initializer_0();
  9883. } };
  9884. VsdxShape.OFFSET_ARRAY_$LI$ = function () { VsdxShape.__static_initialize(); if (VsdxShape.OFFSET_ARRAY == null)
  9885. VsdxShape.OFFSET_ARRAY = (["Organizational unit", "Domain 3D"].slice(0).slice(0)); return VsdxShape.OFFSET_ARRAY; };
  9886. ;
  9887. VsdxShape.arrowSizes_$LI$ = function () { VsdxShape.__static_initialize(); if (VsdxShape.arrowSizes == null)
  9888. VsdxShape.arrowSizes = [2, 3, 5, 7, 9, 22, 45]; return VsdxShape.arrowSizes; };
  9889. ;
  9890. VsdxShape.arrowTypes_$LI$ = function () { VsdxShape.__static_initialize(); return VsdxShape.arrowTypes; };
  9891. ;
  9892. VsdxShape.__static_initializer_0 = function () {
  9893. // mxResources.add("/js/vsdx/resources/edgeNameU");
  9894. // mxResources.add("/js/vsdx/resources/nameU");
  9895. VsdxShape.arrowTypes = ({});
  9896. /* put */ (function (m, k, v) { if (m.entries == null)
  9897. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9898. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9899. m.entries[i].value = v;
  9900. return;
  9901. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 0, mxConstants.NONE);
  9902. /* put */ (function (m, k, v) { if (m.entries == null)
  9903. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9904. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9905. m.entries[i].value = v;
  9906. return;
  9907. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 1, mxConstants.ARROW_OPEN);
  9908. /* put */ (function (m, k, v) { if (m.entries == null)
  9909. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9910. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9911. m.entries[i].value = v;
  9912. return;
  9913. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 2, "blockThin");
  9914. /* put */ (function (m, k, v) { if (m.entries == null)
  9915. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9916. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9917. m.entries[i].value = v;
  9918. return;
  9919. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 3, mxConstants.ARROW_OPEN);
  9920. /* put */ (function (m, k, v) { if (m.entries == null)
  9921. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9922. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9923. m.entries[i].value = v;
  9924. return;
  9925. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 4, mxConstants.ARROW_BLOCK);
  9926. /* put */ (function (m, k, v) { if (m.entries == null)
  9927. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9928. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9929. m.entries[i].value = v;
  9930. return;
  9931. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 5, mxConstants.ARROW_CLASSIC);
  9932. /* put */ (function (m, k, v) { if (m.entries == null)
  9933. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9934. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9935. m.entries[i].value = v;
  9936. return;
  9937. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 10, mxConstants.ARROW_OVAL);
  9938. /* put */ (function (m, k, v) { if (m.entries == null)
  9939. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9940. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9941. m.entries[i].value = v;
  9942. return;
  9943. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 13, mxConstants.ARROW_BLOCK);
  9944. /* put */ (function (m, k, v) { if (m.entries == null)
  9945. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9946. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9947. m.entries[i].value = v;
  9948. return;
  9949. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 14, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_BLOCK);
  9950. /* put */ (function (m, k, v) { if (m.entries == null)
  9951. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9952. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9953. m.entries[i].value = v;
  9954. return;
  9955. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 17, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_CLASSIC);
  9956. /* put */ (function (m, k, v) { if (m.entries == null)
  9957. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9958. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9959. m.entries[i].value = v;
  9960. return;
  9961. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 20, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_OVAL);
  9962. /* put */ (function (m, k, v) { if (m.entries == null)
  9963. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9964. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9965. m.entries[i].value = v;
  9966. return;
  9967. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 22, VsdxShape.ARROW_NO_FILL_MARKER + "diamond");
  9968. /* put */ (function (m, k, v) { if (m.entries == null)
  9969. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9970. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9971. m.entries[i].value = v;
  9972. return;
  9973. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 23, "dash");
  9974. /* put */ (function (m, k, v) { if (m.entries == null)
  9975. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9976. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9977. m.entries[i].value = v;
  9978. return;
  9979. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 24, "ERone");
  9980. /* put */ (function (m, k, v) { if (m.entries == null)
  9981. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9982. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9983. m.entries[i].value = v;
  9984. return;
  9985. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 25, "ERmandOne");
  9986. /* put */ (function (m, k, v) { if (m.entries == null)
  9987. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9988. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9989. m.entries[i].value = v;
  9990. return;
  9991. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 27, "ERmany");
  9992. /* put */ (function (m, k, v) { if (m.entries == null)
  9993. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  9994. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  9995. m.entries[i].value = v;
  9996. return;
  9997. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 28, "ERoneToMany");
  9998. /* put */ (function (m, k, v) { if (m.entries == null)
  9999. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10000. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10001. m.entries[i].value = v;
  10002. return;
  10003. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 29, "ERzeroToMany");
  10004. /* put */ (function (m, k, v) { if (m.entries == null)
  10005. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10006. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10007. m.entries[i].value = v;
  10008. return;
  10009. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 30, "ERzeroToOne");
  10010. /* put */ (function (m, k, v) { if (m.entries == null)
  10011. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10012. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10013. m.entries[i].value = v;
  10014. return;
  10015. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 6, mxConstants.ARROW_BLOCK);
  10016. /* put */ (function (m, k, v) { if (m.entries == null)
  10017. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10018. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10019. m.entries[i].value = v;
  10020. return;
  10021. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 7, mxConstants.ARROW_OPEN);
  10022. /* put */ (function (m, k, v) { if (m.entries == null)
  10023. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10024. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10025. m.entries[i].value = v;
  10026. return;
  10027. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 8, mxConstants.ARROW_CLASSIC);
  10028. /* put */ (function (m, k, v) { if (m.entries == null)
  10029. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10030. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10031. m.entries[i].value = v;
  10032. return;
  10033. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 9, "openAsync");
  10034. /* put */ (function (m, k, v) { if (m.entries == null)
  10035. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10036. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10037. m.entries[i].value = v;
  10038. return;
  10039. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 11, "diamond");
  10040. /* put */ (function (m, k, v) { if (m.entries == null)
  10041. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10042. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10043. m.entries[i].value = v;
  10044. return;
  10045. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 12, mxConstants.ARROW_OPEN);
  10046. /* put */ (function (m, k, v) { if (m.entries == null)
  10047. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10048. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10049. m.entries[i].value = v;
  10050. return;
  10051. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 15, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_BLOCK);
  10052. /* put */ (function (m, k, v) { if (m.entries == null)
  10053. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10054. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10055. m.entries[i].value = v;
  10056. return;
  10057. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 16, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_BLOCK);
  10058. /* put */ (function (m, k, v) { if (m.entries == null)
  10059. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10060. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10061. m.entries[i].value = v;
  10062. return;
  10063. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 18, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_BLOCK);
  10064. /* put */ (function (m, k, v) { if (m.entries == null)
  10065. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10066. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10067. m.entries[i].value = v;
  10068. return;
  10069. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 19, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_CLASSIC);
  10070. /* put */ (function (m, k, v) { if (m.entries == null)
  10071. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10072. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10073. m.entries[i].value = v;
  10074. return;
  10075. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 21, VsdxShape.ARROW_NO_FILL_MARKER + "diamond");
  10076. /* put */ (function (m, k, v) { if (m.entries == null)
  10077. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10078. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10079. m.entries[i].value = v;
  10080. return;
  10081. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 26, "ERmandOne");
  10082. /* put */ (function (m, k, v) { if (m.entries == null)
  10083. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10084. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10085. m.entries[i].value = v;
  10086. return;
  10087. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 31, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_OVAL);
  10088. /* put */ (function (m, k, v) { if (m.entries == null)
  10089. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10090. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10091. m.entries[i].value = v;
  10092. return;
  10093. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 32, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_OVAL);
  10094. /* put */ (function (m, k, v) { if (m.entries == null)
  10095. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10096. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10097. m.entries[i].value = v;
  10098. return;
  10099. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 33, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_OVAL);
  10100. /* put */ (function (m, k, v) { if (m.entries == null)
  10101. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10102. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10103. m.entries[i].value = v;
  10104. return;
  10105. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 34, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_OVAL);
  10106. /* put */ (function (m, k, v) { if (m.entries == null)
  10107. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10108. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10109. m.entries[i].value = v;
  10110. return;
  10111. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 35, mxConstants.ARROW_OVAL);
  10112. /* put */ (function (m, k, v) { if (m.entries == null)
  10113. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10114. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10115. m.entries[i].value = v;
  10116. return;
  10117. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 36, mxConstants.ARROW_OVAL);
  10118. /* put */ (function (m, k, v) { if (m.entries == null)
  10119. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10120. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10121. m.entries[i].value = v;
  10122. return;
  10123. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 37, mxConstants.ARROW_OVAL);
  10124. /* put */ (function (m, k, v) { if (m.entries == null)
  10125. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10126. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10127. m.entries[i].value = v;
  10128. return;
  10129. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 38, mxConstants.ARROW_OVAL);
  10130. /* put */ (function (m, k, v) { if (m.entries == null)
  10131. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10132. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10133. m.entries[i].value = v;
  10134. return;
  10135. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 39, mxConstants.ARROW_BLOCK);
  10136. /* put */ (function (m, k, v) { if (m.entries == null)
  10137. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10138. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10139. m.entries[i].value = v;
  10140. return;
  10141. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 40, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_BLOCK);
  10142. /* put */ (function (m, k, v) { if (m.entries == null)
  10143. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10144. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10145. m.entries[i].value = v;
  10146. return;
  10147. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 41, VsdxShape.ARROW_NO_FILL_MARKER + mxConstants.ARROW_OVAL);
  10148. /* put */ (function (m, k, v) { if (m.entries == null)
  10149. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10150. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10151. m.entries[i].value = v;
  10152. return;
  10153. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 42, mxConstants.ARROW_OVAL);
  10154. /* put */ (function (m, k, v) { if (m.entries == null)
  10155. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10156. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10157. m.entries[i].value = v;
  10158. return;
  10159. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 43, mxConstants.ARROW_OPEN);
  10160. /* put */ (function (m, k, v) { if (m.entries == null)
  10161. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10162. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10163. m.entries[i].value = v;
  10164. return;
  10165. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 44, mxConstants.ARROW_OPEN);
  10166. /* put */ (function (m, k, v) { if (m.entries == null)
  10167. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  10168. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  10169. m.entries[i].value = v;
  10170. return;
  10171. } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 45, mxConstants.ARROW_OPEN);
  10172. };
  10173. VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER_$LI$ = function () { VsdxShape.__static_initialize(); if (VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER == null)
  10174. VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER = {}; return VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER; };
  10175. ;
  10176. /**
  10177. * Locates the first entry for the specified attribute string in the shape hierarchy.
  10178. * The order is to look locally, then delegate the request to the master shape
  10179. * if it doesn't exist locally
  10180. * @param {string} key The key of the shape to find
  10181. * @return {*} the Element that first resolves to that shape key or null or none is found
  10182. */
  10183. VsdxShape.prototype.getShapeNode = function (key) {
  10184. var elem = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, key);
  10185. if (elem == null && this.masterShape != null) {
  10186. return this.masterShape.getCellElement$java_lang_String(key);
  10187. }
  10188. return elem;
  10189. };
  10190. /**
  10191. * Returns the value of the Text element.<br/>
  10192. * If the shape has no text, it is obtained from the master shape.
  10193. * @return {string} Text label of the shape.
  10194. */
  10195. VsdxShape.prototype.getTextLabel = function (noOverflow) {
  10196. var hideText = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.HIDE_TEXT), "0");
  10197. if ((function (o1, o2) { if (o1 && o1.equals) {
  10198. return o1.equals(o2);
  10199. }
  10200. else {
  10201. return o1 === o2;
  10202. } })("1", hideText)) {
  10203. return null;
  10204. }
  10205. var txtChildren = this.getTextChildren();
  10206. if (txtChildren == null && this.masterShape != null) {
  10207. txtChildren = this.masterShape.getTextChildren();
  10208. }
  10209. if (this.htmlLabels) {
  10210. if (txtChildren != null) {
  10211. /* put */ (this.styleMap[mxConstants.STYLE_VERTICAL_ALIGN] = this.getAlignVertical());
  10212. /* put */ (this.styleMap[mxConstants.STYLE_ALIGN] = this.getHorizontalAlign("0", false));
  10213. if (!noOverflow)
  10214. {
  10215. this.styleMap['overflow'] = 'width';
  10216. }
  10217. return this.getHtmlTextContent(txtChildren);
  10218. }
  10219. }
  10220. else {
  10221. var text = this.getText();
  10222. if (text == null && this.masterShape != null) {
  10223. return this.masterShape.getText();
  10224. }
  10225. else {
  10226. return text;
  10227. }
  10228. }
  10229. return null;
  10230. };
  10231. /*private*/ VsdxShape.prototype.getIndex = function (elem) {
  10232. var ix = elem.getAttribute("IX") || "";
  10233. return (ix.length === 0) ? "0" : ix;
  10234. };
  10235. /**
  10236. * Initialises the text labels
  10237. * @param {*} children the text Elements
  10238. */
  10239. VsdxShape.prototype.initLabels = function (children) {
  10240. this.paragraphs = ({});
  10241. var ch = null;
  10242. var pg = null;
  10243. var fld = null;
  10244. for (var index = 0; index < children.length; index++) {
  10245. var value = null;
  10246. var node = children.item(index);
  10247. var nodeName = node.nodeName;
  10248. switch ((nodeName)) {
  10249. case "cp":
  10250. {
  10251. var elem = node;
  10252. ch = this.getIndex(elem);
  10253. }
  10254. ;
  10255. break;
  10256. case "tp":
  10257. {
  10258. var elem = node;
  10259. this.getIndex(elem);
  10260. }
  10261. ;
  10262. break;
  10263. case "pp":
  10264. {
  10265. var elem = node;
  10266. pg = this.getIndex(elem);
  10267. }
  10268. ;
  10269. break;
  10270. case "fld":
  10271. {
  10272. var elem = node;
  10273. fld = this.getIndex(elem);
  10274. break;
  10275. }
  10276. ;
  10277. case "#text":
  10278. {
  10279. value = node.textContent;
  10280. var para = (function (m, k) { return m[k] ? m[k] : null; })(this.paragraphs, pg);
  10281. if (para == null) {
  10282. para = new com.mxgraph.io.vsdx.Paragraph(value, ch, pg, fld);
  10283. /* put */ (this.paragraphs[pg] = para);
  10284. }
  10285. else {
  10286. para.addText(value, ch, fld);
  10287. }
  10288. }
  10289. ;
  10290. }
  10291. }
  10292. ;
  10293. };
  10294. /**
  10295. *
  10296. * @param {string} index
  10297. * @return
  10298. * @return {string}
  10299. */
  10300. VsdxShape.prototype.createHybridLabel = function (index) {
  10301. var para = (function (m, k) { return m[k] ? m[k] : null; })(this.paragraphs, index);
  10302. /* put */ (this.styleMap[mxConstants.STYLE_ALIGN] = this.getHorizontalAlign(index, false));
  10303. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_LEFT] = this.getIndentLeft(index));
  10304. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_RIGHT] = this.getIndentRight(index));
  10305. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_TOP] = this.getSpBefore(index));
  10306. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_BOTTOM] = this.getSpAfter(index));
  10307. /* put */ (this.styleMap[mxConstants.STYLE_VERTICAL_ALIGN] = this.getAlignVertical());
  10308. /* put */ (this.styleMap["fontColor"] = this.getTextColor(index));
  10309. /* put */ (this.styleMap["fontSize"] = this.getTextSize(index));
  10310. /* put */ (this.styleMap["fontFamily"] = this.getTextFont(index));
  10311. var fontStyle = this.isBold(index) ? mxConstants.FONT_BOLD : 0;
  10312. fontStyle |= this.isItalic(index) ? mxConstants.FONT_ITALIC : 0;
  10313. fontStyle |= this.isUnderline(index) ? mxConstants.FONT_UNDERLINE : 0;
  10314. /* put */ (this.styleMap["fontStyle"] = new String(fontStyle).toString());
  10315. var numValues = para.numValues();
  10316. var result = null;
  10317. for (var i = 0; i < numValues; i++) {
  10318. var value = para.getValue(i);
  10319. if ((value.length === 0) && this.fields != null) {
  10320. var fieldIx = para.getField(i);
  10321. if (fieldIx != null) {
  10322. value = (function (m, k) { return m[k] ? m[k] : null; })(this.fields, fieldIx);
  10323. if (value == null && this.masterShape != null && this.masterShape.fields != null) {
  10324. value = (function (m, k) { return m[k] ? m[k] : null; })(this.masterShape.fields, fieldIx);
  10325. }
  10326. }
  10327. }
  10328. if (value != null) {
  10329. result = result == null ? value : result + value;
  10330. }
  10331. }
  10332. ;
  10333. return result;
  10334. };
  10335. /**
  10336. * Returns the text contained in the shape formated with tags html.<br/>
  10337. * @return {string} Text content in html.
  10338. * @param {*} txtChildren
  10339. */
  10340. VsdxShape.prototype.getHtmlTextContent = function (txtChildren) {
  10341. var ret = "";
  10342. var first = true;
  10343. var ulMode = false;
  10344. var ulModeFirst = false;
  10345. function processLblTxt(text)
  10346. {
  10347. text = com.mxgraph.io.vsdx.mxVsdxUtils.htmlEntities(text);
  10348. if (ulModeFirst)
  10349. {
  10350. text = '<li>' + text;
  10351. ulModeFirst = false;
  10352. }
  10353. if (ulMode)
  10354. {
  10355. var entries = text.split('\n');
  10356. if (!entries[entries.length - 1])
  10357. {
  10358. entries.pop();
  10359. ulModeFirst = true;
  10360. }
  10361. text = entries.join('</li><li>');
  10362. }
  10363. else
  10364. {
  10365. text = text.replace(new RegExp('\n', 'g'), '<br/>').replace(new RegExp(com.mxgraph.io.vsdx.Shape.UNICODE_LINE_SEP, 'g'), '<br/>');
  10366. }
  10367. return this.getTextCharFormated(text);
  10368. };
  10369. if (txtChildren != null && txtChildren.length > 0) {
  10370. for (var index = 0; index < txtChildren.length; index++) {
  10371. var node = txtChildren.item(index);
  10372. if ((function (o1, o2) { if (o1 && o1.equals) {
  10373. return o1.equals(o2);
  10374. }
  10375. else {
  10376. return o1 === o2;
  10377. } })(node.nodeName, "cp")) {
  10378. var elem = node;
  10379. this.cp = this.getIndex(elem);
  10380. }
  10381. else if ((function (o1, o2) { if (o1 && o1.equals) {
  10382. return o1.equals(o2);
  10383. }
  10384. else {
  10385. return o1 === o2;
  10386. } })(node.nodeName, "tp")) {
  10387. var elem = node;
  10388. this.tp = this.getIndex(elem);
  10389. }
  10390. else if ((function (o1, o2) { if (o1 && o1.equals) {
  10391. return o1.equals(o2);
  10392. }
  10393. else {
  10394. return o1 === o2;
  10395. } })(node.nodeName, "pp"))
  10396. {
  10397. var elem = node;
  10398. this.pp = this.getIndex(elem);
  10399. if (ulMode)
  10400. {
  10401. //TODO closing li is wrongly placed after font (and other tags (e.g, b, i))
  10402. ret += '</li></ul>';
  10403. }
  10404. if (first)
  10405. {
  10406. first = false;
  10407. }
  10408. else
  10409. {
  10410. ret += "</p>";
  10411. }
  10412. var para = "<p>";
  10413. ret += this.getTextParagraphFormated(para);
  10414. var ul = this.getPPList(this.pp);
  10415. ulMode = ul != null;
  10416. ulModeFirst = ulMode;
  10417. ret += ulMode? ul : '';
  10418. }
  10419. else if ((function (o1, o2) { if (o1 && o1.equals) {
  10420. return o1.equals(o2);
  10421. }
  10422. else {
  10423. return o1 === o2;
  10424. } })(node.nodeName, "fld")) {
  10425. var elem = node;
  10426. this.fld = this.getIndex(elem);
  10427. var text = null;
  10428. if (this.fields != null) {
  10429. text = (function (m, k) { return m[k] ? m[k] : null; })(this.fields, this.fld);
  10430. }
  10431. if (text == null && this.masterShape != null && this.masterShape.fields != null) {
  10432. text = (function (m, k) { return m[k] ? m[k] : null; })(this.masterShape.fields, this.fld);
  10433. }
  10434. if (text != null)
  10435. ret += processLblTxt.call(this, text);
  10436. }
  10437. else if ((function (o1, o2) { if (o1 && o1.equals) {
  10438. return o1.equals(o2);
  10439. }
  10440. else {
  10441. return o1 === o2;
  10442. } })(node.nodeName, "#text")) {
  10443. var text = node.textContent;
  10444. ret += processLblTxt.call(this, text);
  10445. }
  10446. }
  10447. }
  10448. if (ulMode)
  10449. {
  10450. //TODO closing li is wrongly placed after font (and other tags (e.g, b, i))
  10451. ret += '</li></ul>';
  10452. }
  10453. var end = first ? "" : "</p>";
  10454. ret += end;
  10455. return com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(ret, "div", "font-size: 1px");
  10456. };
  10457. /**
  10458. * Checks if a nameU is for big connectors.
  10459. * @param {string} nameU NameU attribute.
  10460. * @return {boolean} Returns <code>true</code> if a nameU is for big connectors.
  10461. */
  10462. VsdxShape.prototype.isConnectorBigNameU = function (nameU) {
  10463. return (function (str, searchString, position) {
  10464. if (position === void 0) { position = 0; }
  10465. return str.substr(position, searchString.length) === searchString;
  10466. })(nameU, "60 degree single") || (function (str, searchString, position) {
  10467. if (position === void 0) { position = 0; }
  10468. return str.substr(position, searchString.length) === searchString;
  10469. })(nameU, "45 degree single") || (function (str, searchString, position) {
  10470. if (position === void 0) { position = 0; }
  10471. return str.substr(position, searchString.length) === searchString;
  10472. })(nameU, "45 degree double") || (function (str, searchString, position) {
  10473. if (position === void 0) { position = 0; }
  10474. return str.substr(position, searchString.length) === searchString;
  10475. })(nameU, "60 degree double") || (function (str, searchString, position) {
  10476. if (position === void 0) { position = 0; }
  10477. return str.substr(position, searchString.length) === searchString;
  10478. })(nameU, "45 degree tail") || (function (str, searchString, position) {
  10479. if (position === void 0) { position = 0; }
  10480. return str.substr(position, searchString.length) === searchString;
  10481. })(nameU, "60 degree tail") || (function (str, searchString, position) {
  10482. if (position === void 0) { position = 0; }
  10483. return str.substr(position, searchString.length) === searchString;
  10484. })(nameU, "45 degree tail") || (function (str, searchString, position) {
  10485. if (position === void 0) { position = 0; }
  10486. return str.substr(position, searchString.length) === searchString;
  10487. })(nameU, "60 degree tail") || (function (str, searchString, position) {
  10488. if (position === void 0) { position = 0; }
  10489. return str.substr(position, searchString.length) === searchString;
  10490. })(nameU, "Flexi-arrow 2") || (function (str, searchString, position) {
  10491. if (position === void 0) { position = 0; }
  10492. return str.substr(position, searchString.length) === searchString;
  10493. })(nameU, "Flexi-arrow 1") || (function (str, searchString, position) {
  10494. if (position === void 0) { position = 0; }
  10495. return str.substr(position, searchString.length) === searchString;
  10496. })(nameU, "Flexi-arrow 3") || (function (str, searchString, position) {
  10497. if (position === void 0) { position = 0; }
  10498. return str.substr(position, searchString.length) === searchString;
  10499. })(nameU, "Double flexi-arrow") || (function (str, searchString, position) {
  10500. if (position === void 0) { position = 0; }
  10501. return str.substr(position, searchString.length) === searchString;
  10502. })(nameU, "Fancy arrow");
  10503. };
  10504. /**
  10505. * Checks if the shape represents a vertex.
  10506. * @return {boolean} Returns <code>true</code> if the shape represents a vertex.
  10507. */
  10508. VsdxShape.prototype.isVertex = function () {
  10509. return this.vertex;
  10510. };
  10511. /**
  10512. * Returns the coordinates of the top left corner of the Shape.
  10513. * When a coordinate is not found, it is taken from masterShape.
  10514. * @param {number} parentHeight Height of the parent cell of the shape.
  10515. * @param {boolean} rotation whether to allow for cell rotation
  10516. * @return {mxPoint} mxPoint that represents the coordinates
  10517. */
  10518. VsdxShape.prototype.getOriginPoint = function (parentHeight, rotation) {
  10519. var px = this.getPinX();
  10520. var py = this.getPinY();
  10521. var lpy = this.getLocPinY();
  10522. var lpx = this.getLocPinX();
  10523. var w = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.WIDTH), 0);
  10524. var h = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.HEIGHT), 0);
  10525. var x = px - lpx;
  10526. var y = parentHeight - ((py) + (h - lpy));
  10527. if (rotation && (lpy !== h / 2 || lpx !== w / 2)) {
  10528. if (this.rotation !== 0) {
  10529. var vecX = w / 2 - lpx;
  10530. var vecY = lpy - h / 2;
  10531. var cos = Math.cos(/* toRadians */ (function (x) { return x * Math.PI / 180; })(360 - this.rotation));
  10532. var sin = Math.sin(/* toRadians */ (function (x) { return x * Math.PI / 180; })(360 - this.rotation));
  10533. return new mxPoint(x + vecX - (vecX * cos - vecY * sin), (vecX * sin + vecY * cos) + y - vecY);
  10534. }
  10535. }
  10536. return new mxPoint(x, y);
  10537. };
  10538. /**
  10539. * Returns the width and height of the Shape expressed like an mxPoint.<br/>
  10540. * x = width<br/>
  10541. * y = height<br/>
  10542. * When a dimension is not found, it is taken from masterShape.
  10543. * @return {mxPoint} mxPoint that represents the dimensions of the shape.
  10544. */
  10545. VsdxShape.prototype.getDimensions = function () {
  10546. var w = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.WIDTH), 0);
  10547. var h = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.HEIGHT), 0);
  10548. return new mxPoint(w === 0 && h > 0 ? 1 : w, h === 0 && w > 0 ? 1 : h);
  10549. };
  10550. /**
  10551. * Returns the value of the pinX element.
  10552. * @return {number} The shape pinX element
  10553. */
  10554. VsdxShape.prototype.getPinX = function () {
  10555. return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.PIN_X), 0);
  10556. };
  10557. /**
  10558. * Returns the value of the pinY element in pixels.
  10559. * @return {number} Numerical value of the pinY element.
  10560. */
  10561. VsdxShape.prototype.getPinY = function () {
  10562. return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.PIN_Y), 0);
  10563. };
  10564. /**
  10565. * Returns the value of the locPinX element in pixels.
  10566. * @return {number} Numerical value of the pinY element.
  10567. */
  10568. VsdxShape.prototype.getLocPinX = function () {
  10569. return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.LOC_PIN_X), 0);
  10570. };
  10571. /**
  10572. * Returns the value of the locPinY element in pixels.
  10573. * @return {number} Numerical value of the locPinY element.
  10574. */
  10575. VsdxShape.prototype.getLocPinY = function () {
  10576. return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.LOC_PIN_Y), 0);
  10577. };
  10578. /**
  10579. * Returns the opacity of the Shape.<br/>
  10580. * @return {number} Double in the range of (transparent = 0)..(100 = opaque)
  10581. * @param {string} key
  10582. * @private
  10583. */
  10584. /*private*/ VsdxShape.prototype.getOpacity = function (key) {
  10585. var opacity = 100;
  10586. if (this.isGroup()) {
  10587. opacity = 0;
  10588. }
  10589. opacity = this.getValueAsDouble(this.getCellElement$java_lang_String(key), 0);
  10590. opacity = 100 - opacity * 100;
  10591. opacity = Math.max(opacity, 0);
  10592. opacity = Math.min(opacity, 100);
  10593. return opacity;
  10594. };
  10595. /**
  10596. * Returns the background color for apply in the gradient.<br/>
  10597. * If no gradient must be applicated, returns an empty string.
  10598. * @return {string} hexadecimal representation of the color.
  10599. * @private
  10600. */
  10601. /*private*/ VsdxShape.prototype.getGradient = function () {
  10602. var fillGradientEnabled = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_GRADIENT_ENABLED), "0");
  10603. if ((function (o1, o2) { if (o1 && o1.equals) {
  10604. return o1.equals(o2);
  10605. }
  10606. else {
  10607. return o1 === o2;
  10608. } })("1", fillGradientEnabled)) {
  10609. var fillGradient = (function (m, k) { return m[k] ? m[k] : null; })(this.sections, "FillGradient");
  10610. if (fillGradient != null) {
  10611. var rows = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(fillGradient.elem, "Row");
  10612. var color = this.getColor(fillGradient.getIndexedCell(/* get */ rows[rows.length - 1].getAttribute("IX"), "GradientStopColor"));
  10613. if (color != null && !(color.length === 0))
  10614. return color;
  10615. }
  10616. }
  10617. var gradient = "";
  10618. var fillPattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_PATTERN), "0");
  10619. if (parseInt(fillPattern) >= 25) {
  10620. gradient = this.getColor(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_BKGND));
  10621. }
  10622. else {
  10623. var theme_11 = this.getTheme();
  10624. if (theme_11 != null) {
  10625. var gradColor = theme_11.getFillGraientColor(this.getQuickStyleVals());
  10626. if (gradColor != null)
  10627. gradient = gradColor.toHexStr();
  10628. }
  10629. }
  10630. return gradient;
  10631. };
  10632. /**
  10633. * Returns the direction of the gradient.<br/>
  10634. * If no gradient has to be applied, returns an empty string.
  10635. * @return {string} Direction.(east, west, north or south)
  10636. * @private
  10637. */
  10638. /*private*/ VsdxShape.prototype.getGradientDirection = function () {
  10639. var direction = "";
  10640. var fillPattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_PATTERN), "0");
  10641. if ((function (o1, o2) { if (o1 && o1.equals) {
  10642. return o1.equals(o2);
  10643. }
  10644. else {
  10645. return o1 === o2;
  10646. } })(fillPattern, "25")) {
  10647. direction = mxConstants.DIRECTION_EAST;
  10648. }
  10649. else if ((function (o1, o2) { if (o1 && o1.equals) {
  10650. return o1.equals(o2);
  10651. }
  10652. else {
  10653. return o1 === o2;
  10654. } })(fillPattern, "27")) {
  10655. direction = mxConstants.DIRECTION_WEST;
  10656. }
  10657. else if ((function (o1, o2) { if (o1 && o1.equals) {
  10658. return o1.equals(o2);
  10659. }
  10660. else {
  10661. return o1 === o2;
  10662. } })(fillPattern, "28")) {
  10663. direction = mxConstants.DIRECTION_SOUTH;
  10664. }
  10665. else if ((function (o1, o2) { if (o1 && o1.equals) {
  10666. return o1.equals(o2);
  10667. }
  10668. else {
  10669. return o1 === o2;
  10670. } })(fillPattern, "30")) {
  10671. direction = mxConstants.DIRECTION_NORTH;
  10672. }
  10673. return direction;
  10674. };
  10675. /**
  10676. * Returns the rotation of the shape.<br/>
  10677. * @return {number} Rotation of the shape in degrees.
  10678. */
  10679. VsdxShape.prototype.calcRotation = function () {
  10680. var rotation = parseFloat(this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.ANGLE), "0"));
  10681. rotation = (function (x) { return x * 180 / Math.PI; })(rotation);
  10682. rotation = rotation % 360;
  10683. rotation = rotation * 100 / 100;
  10684. return 360 - rotation;
  10685. };
  10686. /**
  10687. * Used to pass in a parents rotation to the child
  10688. * @param {number} parentRotation the rotation of the parent
  10689. */
  10690. VsdxShape.prototype.propagateRotation = function (parentRotation) {
  10691. this.rotation += parentRotation;
  10692. this.rotation %= 360;
  10693. this.rotation = this.rotation * 100 / 100;
  10694. };
  10695. /**
  10696. * Returns the top spacing of the label in pixels.<br/>
  10697. * The property may to be defined in master shape or text stylesheet.<br/>
  10698. * @return {number} Top spacing in double precision.
  10699. */
  10700. VsdxShape.prototype.getTopSpacing = function () {
  10701. var topMargin = this.getTextTopMargin();
  10702. topMargin = (topMargin / 2 - 2.8) * 100 / 100;
  10703. return topMargin;
  10704. };
  10705. /**
  10706. * Returns the bottom spacing of the label in pixels.<br/>
  10707. * The property may to be defined in master shape or text stylesheet.<br/>
  10708. * @return {number} Bottom spacing in double precision.
  10709. */
  10710. VsdxShape.prototype.getBottomSpacing = function () {
  10711. var bottomMargin = this.getTextBottomMargin();
  10712. bottomMargin = (bottomMargin / 2 - 2.8) * 100 / 100;
  10713. return bottomMargin;
  10714. };
  10715. /**
  10716. * Returns the left spacing of the label in pixels.<br/>
  10717. * The property may to be defined in master shape or text stylesheet.<br/>
  10718. * @return {number} Left spacing in double precision.
  10719. */
  10720. VsdxShape.prototype.getLeftSpacing = function () {
  10721. var leftMargin = this.getTextLeftMargin();
  10722. leftMargin = (leftMargin / 2 - 2.8) * 100 / 100;
  10723. return leftMargin;
  10724. };
  10725. /**
  10726. * Returns the right spacing of the label in pixels.<br/>
  10727. * The property may to be defined in master shape or text stylesheet.<br/>
  10728. * @return {number} Right spacing in double precision.
  10729. */
  10730. VsdxShape.prototype.getRightSpacing = function () {
  10731. var rightMargin = this.getTextRightMargin();
  10732. rightMargin = (rightMargin / 2 - 2.8) * 100 / 100;
  10733. return rightMargin;
  10734. };
  10735. /**
  10736. * Checks if the label must be rotated.<br/>
  10737. * The property may to be defined in master shape or text stylesheet.<br/>
  10738. * @return {boolean} Returns <code>true<code/> if the label should remain horizontal.
  10739. */
  10740. VsdxShape.prototype.getLabelRotation = function () {
  10741. var hor = true;
  10742. var rotation = this.calcRotation();
  10743. var angle = parseFloat(this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE), "0"));
  10744. angle = (function (x) { return x * 180 / Math.PI; })(angle);
  10745. angle = angle - rotation;
  10746. if (!(Math.abs(angle) < 45 || Math.abs(angle) > 270)) {
  10747. hor = false;
  10748. }
  10749. return hor;
  10750. };
  10751. /**
  10752. * Get hyperlink address or subaddress
  10753. */
  10754. VsdxShape.prototype.getHyperlink = function ()
  10755. {
  10756. var addressElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String('Address', null, 'Hyperlink');
  10757. var extLink = this.getValue(addressElem, '');
  10758. var subAddressElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String('SubAddress', null, 'Hyperlink');
  10759. var pageLink = this.getValue(subAddressElem, '');
  10760. return {extLink: extLink, pageLink: pageLink};
  10761. };
  10762. VsdxShape.prototype.getProperties = function ()
  10763. {
  10764. var props = [];
  10765. if (this.sections && this.sections['Property'])
  10766. {
  10767. var rows = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(this.sections['Property'].elem, "Row");
  10768. for (var i = 0; i < rows.length; i++)
  10769. {
  10770. var row = rows[i];
  10771. var n = row.getAttribute("N"), v = null;
  10772. var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(row);
  10773. for (var j = 0; j < cells.length; j++)
  10774. {
  10775. var cell = cells[j];
  10776. var cn = cell.getAttribute("N");
  10777. if (cn == 'Value')
  10778. {
  10779. v = cell.getAttribute("V");
  10780. }
  10781. else if (cn == 'Label')
  10782. {
  10783. n = cell.getAttribute("V");
  10784. }
  10785. }
  10786. if (v != null)
  10787. {
  10788. props.push({key: n, val: v});
  10789. }
  10790. }
  10791. }
  10792. return props;
  10793. };
  10794. /**
  10795. * Analyzes the shape and returns a string with the style.
  10796. * @return {*} style read from the shape.
  10797. */
  10798. VsdxShape.prototype.getStyleFromShape = function () {
  10799. /* put */ (this.styleMap[com.mxgraph.io.vsdx.mxVsdxConstants.VSDX_ID] = this.getId().toString());
  10800. this.rotation = Math.round(this.rotation);
  10801. if (this.rotation !== 0) {
  10802. /* put */ (this.styleMap[mxConstants.STYLE_ROTATION] = ('' + (this.rotation)));
  10803. }
  10804. var fillcolor = this.getFillColor();
  10805. if (!(function (o1, o2) { if (o1 && o1.equals) {
  10806. return o1.equals(o2);
  10807. }
  10808. else {
  10809. return o1 === o2;
  10810. } })(fillcolor, "")) {
  10811. /* put */ (this.styleMap[mxConstants.STYLE_FILLCOLOR] = fillcolor);
  10812. }
  10813. else {
  10814. /* put */ (this.styleMap[mxConstants.STYLE_FILLCOLOR] = "none");
  10815. }
  10816. var id = this.getId();
  10817. this.styleDebug("ID = " + id + " , Fill Color = " + fillcolor);
  10818. var gradient = this.getGradient();
  10819. if (!(function (o1, o2) { if (o1 && o1.equals) {
  10820. return o1.equals(o2);
  10821. }
  10822. else {
  10823. return o1 === o2;
  10824. } })(gradient, "")) {
  10825. /* put */ (this.styleMap[mxConstants.STYLE_GRADIENTCOLOR] = gradient);
  10826. var gradientDirection = this.getGradientDirection();
  10827. if (!(function (o1, o2) { if (o1 && o1.equals) {
  10828. return o1.equals(o2);
  10829. }
  10830. else {
  10831. return o1 === o2;
  10832. } })(gradientDirection, "") && !(function (o1, o2) { if (o1 && o1.equals) {
  10833. return o1.equals(o2);
  10834. }
  10835. else {
  10836. return o1 === o2;
  10837. } })(gradientDirection, mxConstants.DIRECTION_SOUTH)) {
  10838. /* put */ (this.styleMap[mxConstants.STYLE_GRADIENT_DIRECTION] = gradientDirection);
  10839. }
  10840. }
  10841. else {
  10842. /* put */ (this.styleMap[mxConstants.STYLE_GRADIENTCOLOR] = "none");
  10843. }
  10844. var opacity = this.getOpacity(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_FOREGND_TRANS);
  10845. if (opacity < 100) {
  10846. /* put */ (this.styleMap[mxConstants.STYLE_FILL_OPACITY] = ('' + (opacity)));
  10847. }
  10848. opacity = this.getOpacity(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR_TRANS);
  10849. if (opacity < 100) {
  10850. /* put */ (this.styleMap[mxConstants.STYLE_STROKE_OPACITY] = ('' + (opacity)));
  10851. }
  10852. var form = this.getForm();
  10853. if (form.hasOwnProperty(mxConstants.STYLE_SHAPE) && ((function (str, searchString, position) {
  10854. if (position === void 0) { position = 0; }
  10855. return str.substr(position, searchString.length) === searchString;
  10856. })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(form, mxConstants.STYLE_SHAPE), "image;"))) {
  10857. /* put */ (this.styleMap[mxConstants.STYLE_WHITE_SPACE] = "wrap");
  10858. }
  10859. //this.styleMap.putAll(form);
  10860. for (var key in form)
  10861. {
  10862. this.styleMap[key] = form[key];
  10863. }
  10864. if (this.isDashed()) {
  10865. /* put */ (this.styleMap[mxConstants.STYLE_DASHED] = "1");
  10866. var dashPattern = this.getDashPattern();
  10867. if (dashPattern != null) {
  10868. /* put */ (this.styleMap[mxConstants.STYLE_DASH_PATTERN] = dashPattern);
  10869. }
  10870. }
  10871. var color = this.getStrokeColor();
  10872. var tr = this.getStrokeTransparency();
  10873. this.styleDebug("ID = " + id + " , Color = " + color + " , stroke transparency = " + tr);
  10874. if (!(function (o1, o2) { if (o1 && o1.equals) {
  10875. return o1.equals(o2);
  10876. }
  10877. else {
  10878. return o1 === o2;
  10879. } })(color, "") && tr !== 1) {
  10880. /* put */ (this.styleMap[mxConstants.STYLE_STROKECOLOR] = color);
  10881. }
  10882. else {
  10883. }
  10884. var lWeight = (Math.round(this.getLineWidth()) | 0);
  10885. if (lWeight !== 1) {
  10886. /* put */ (this.styleMap[mxConstants.STYLE_STROKEWIDTH] = ('' + (lWeight)));
  10887. }
  10888. if (this.isShadow()) {
  10889. /* put */ (this.styleMap[mxConstants.STYLE_SHADOW] = com.mxgraph.io.vsdx.mxVsdxConstants.TRUE);
  10890. }
  10891. var topMargin = (Math.round(this.getTopSpacing()) | 0);
  10892. if (topMargin !== 0) {
  10893. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_TOP] = ('' + (topMargin)));
  10894. }
  10895. var bottomMargin = (Math.round(this.getBottomSpacing()) | 0);
  10896. if (bottomMargin !== 0) {
  10897. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_BOTTOM] = ('' + (bottomMargin)));
  10898. }
  10899. var leftMargin = (Math.round(this.getLeftSpacing()) | 0);
  10900. if (leftMargin !== 0) {
  10901. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_LEFT] = ('' + (leftMargin)));
  10902. }
  10903. var rightMargin = (Math.round(this.getRightSpacing()) | 0);
  10904. if (rightMargin !== 0) {
  10905. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_RIGHT] = ('' + (rightMargin)));
  10906. }
  10907. var direction = this.getDirection(form);
  10908. if (direction !== mxConstants.DIRECTION_EAST) {
  10909. /* put */ (this.styleMap[mxConstants.STYLE_DIRECTION] = direction);
  10910. }
  10911. var flibX = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FLIP_X), "0");
  10912. var flibY = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FLIP_Y), "0");
  10913. if ((function (o1, o2) { if (o1 && o1.equals) {
  10914. return o1.equals(o2);
  10915. }
  10916. else {
  10917. return o1 === o2;
  10918. } })("1", flibX)) {
  10919. /* put */ (this.styleMap[mxConstants.STYLE_FLIPH] = "1");
  10920. }
  10921. if ((function (o1, o2) { if (o1 && o1.equals) {
  10922. return o1.equals(o2);
  10923. }
  10924. else {
  10925. return o1 === o2;
  10926. } })("1", flibY)) {
  10927. /* put */ (this.styleMap[mxConstants.STYLE_FLIPV] = "1");
  10928. }
  10929. //Connection points
  10930. try
  10931. {
  10932. var connections = this.getConnections();
  10933. var cPoints = [];
  10934. for (var i = 0; i < connections.length; i++)
  10935. {
  10936. //TODO Does vsdx connections points needs dx/dy?
  10937. cPoints.push('[' + connections[i].x + ',' + connections[i].y + ',0]');
  10938. }
  10939. this.styleMap['points'] = '[' + cPoints.join(',') + ']';
  10940. }
  10941. catch(e)
  10942. {
  10943. console.log(e);
  10944. }
  10945. this.resolveCommonStyles();
  10946. return this.styleMap;
  10947. };
  10948. /*private*/ VsdxShape.prototype.getDashPattern = function () {
  10949. var pattern = null;
  10950. var linePattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN), "0");
  10951. if ((function (o1, o2) { if (o1 && o1.equals) {
  10952. return o1.equals(o2);
  10953. }
  10954. else {
  10955. return o1 === o2;
  10956. } })(linePattern, "Themed")) {
  10957. var theme_12 = this.getTheme();
  10958. if (theme_12 != null) {
  10959. pattern = this.isVertex() ? theme_12.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_12.getConnLineDashPattern(this.getQuickStyleVals());
  10960. }
  10961. }
  10962. else {
  10963. pattern = vsdx.Style.getLineDashPattern(/* parseInt */ parseInt(linePattern));
  10964. }
  10965. if (pattern != null && !(pattern.length == 0)) {
  10966. var str = { str: "", toString: function () { return this.str; } };
  10967. var _loop_4 = function (index162) {
  10968. var len = pattern[index162];
  10969. {
  10970. /* append */ (function (sb) { return sb.str = sb.str.concat(len.toFixed(2) + " "); })(str);
  10971. }
  10972. };
  10973. for (var index162 = 0; index162 < pattern.length; index162++) {
  10974. _loop_4(index162);
  10975. }
  10976. return str.str.trim();
  10977. }
  10978. return null;
  10979. };
  10980. /**
  10981. * Checks if the lines of the shape are dashed.<br/>
  10982. * The property may to be defined in master shape or line stylesheet.<br/>
  10983. * @return {boolean} Returns <code>true</code> if the lines of the shape are dashed.
  10984. */
  10985. VsdxShape.prototype.isDashed = function () {
  10986. var linePattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN), "0");
  10987. if ((function (o1, o2) { if (o1 && o1.equals) {
  10988. return o1.equals(o2);
  10989. }
  10990. else {
  10991. return o1 === o2;
  10992. } })(linePattern, "Themed")) {
  10993. var theme_13 = this.getTheme();
  10994. if (theme_13 != null) {
  10995. return this.isVertex() ? theme_13.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_13.isConnLineDashed(this.getQuickStyleVals());
  10996. }
  10997. }
  10998. else if (!((function (o1, o2) { if (o1 && o1.equals) {
  10999. return o1.equals(o2);
  11000. }
  11001. else {
  11002. return o1 === o2;
  11003. } })(linePattern, "0") || (function (o1, o2) { if (o1 && o1.equals) {
  11004. return o1.equals(o2);
  11005. }
  11006. else {
  11007. return o1 === o2;
  11008. } })(linePattern, "1"))) {
  11009. return true;
  11010. }
  11011. return false;
  11012. };
  11013. /**
  11014. * Returns the line width.<br/>
  11015. * The property may to be defined in master shape or line stylesheet.<br/>
  11016. * @return {number} Line width in pixels.
  11017. */
  11018. VsdxShape.prototype.getLineWidth = function () {
  11019. var lineWeight = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_WEIGHT), "1");
  11020. var lWeight = 1;
  11021. try {
  11022. if ((function (o1, o2) { if (o1 && o1.equals) {
  11023. return o1.equals(o2);
  11024. }
  11025. else {
  11026. return o1 === o2;
  11027. } })(lineWeight, "Themed")) {
  11028. var theme_14 = this.getTheme();
  11029. if (theme_14 != null) {
  11030. lWeight = (this.isVertex() ? theme_14.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_14.getConnLineWidth(this.getQuickStyleVals())) / 10000.0;
  11031. }
  11032. }
  11033. else {
  11034. lWeight = parseFloat(lineWeight);
  11035. lWeight = this.getScreenNumericalValue$double(lWeight);
  11036. }
  11037. }
  11038. catch (e) {
  11039. }
  11040. ;
  11041. if (lWeight < 1) {
  11042. lWeight *= 2;
  11043. }
  11044. return lWeight;
  11045. };
  11046. /**
  11047. * Returns the start arrow size.<br/>
  11048. * The property may to be defined in master shape or line stylesheet.<br/>
  11049. * Determines the value in pixels of each arrow size category in .vdx.
  11050. * @return {number} Size in pixels.
  11051. */
  11052. VsdxShape.prototype.getStartArrowSize = function () {
  11053. var baSize = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW_SIZE), "4");
  11054. try {
  11055. var size = 4;
  11056. if ((function (o1, o2) { if (o1 && o1.equals) {
  11057. return o1.equals(o2);
  11058. }
  11059. else {
  11060. return o1 === o2;
  11061. } })(baSize, "Themed")) {
  11062. var theme_15 = this.getTheme();
  11063. if (theme_15 != null) {
  11064. size = this.isVertex() ? theme_15.getStartSize(this.getQuickStyleVals()) : theme_15.getConnStartSize(this.getQuickStyleVals());
  11065. }
  11066. }
  11067. else {
  11068. size = parseFloat(baSize);
  11069. }
  11070. return VsdxShape.arrowSizes_$LI$()[size];
  11071. }
  11072. catch (e) {
  11073. }
  11074. ;
  11075. return 4;
  11076. };
  11077. /**
  11078. * Returns the end arrow size.<br/>
  11079. * The property may to be defined in master shape or line stylesheet.<br/>
  11080. * Determines the value in pixels of each arrow size category in .vdx.
  11081. * @return {number} Size in pixels.
  11082. */
  11083. VsdxShape.prototype.getFinalArrowSize = function () {
  11084. var eaSize = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW_SIZE), "4");
  11085. try {
  11086. var size = 4;
  11087. if ((function (o1, o2) { if (o1 && o1.equals) {
  11088. return o1.equals(o2);
  11089. }
  11090. else {
  11091. return o1 === o2;
  11092. } })(eaSize, "Themed")) {
  11093. var theme_16 = this.getTheme();
  11094. if (theme_16 != null) {
  11095. size = this.isVertex() ? theme_16.getEndSize(this.getQuickStyleVals()) : theme_16.getConnEndSize(this.getQuickStyleVals());
  11096. }
  11097. }
  11098. else {
  11099. size = parseFloat(eaSize);
  11100. }
  11101. return VsdxShape.arrowSizes_$LI$()[size];
  11102. }
  11103. catch (e) {
  11104. }
  11105. ;
  11106. return 4;
  11107. };
  11108. /**
  11109. * Returns whether the cell is Rounded.<br/>
  11110. * The property may to be defined in master shape or line stylesheet.<br/>
  11111. * @return {boolean} Returns <code>true</code> if the cell is Rounded.
  11112. */
  11113. VsdxShape.prototype.getRounding = function () {
  11114. var val = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.ROUNDING), "0");
  11115. if ((function (o1, o2) { if (o1 && o1.equals) {
  11116. return o1.equals(o2);
  11117. }
  11118. else {
  11119. return o1 === o2;
  11120. } })("Themed", val)) {
  11121. val = "0";
  11122. }
  11123. return parseFloat(val);
  11124. };
  11125. /**
  11126. * Return if the line has shadow.<br/>
  11127. * The property may to be defined in master shape or line stylesheet.<br/>
  11128. * @return {boolean} Returns <code>mxVdxConstants.TRUE</code> if the line has shadow.
  11129. */
  11130. VsdxShape.prototype.isShadow = function () {
  11131. var shdw = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.SHDW_PATTERN), "0");
  11132. if ((function (o1, o2) { if (o1 && o1.equals) {
  11133. return o1.equals(o2);
  11134. }
  11135. else {
  11136. return o1 === o2;
  11137. } })(shdw, "Themed")) {
  11138. }
  11139. else if (!(function (o1, o2) { if (o1 && o1.equals) {
  11140. return o1.equals(o2);
  11141. }
  11142. else {
  11143. return o1 === o2;
  11144. } })(shdw, "0")) {
  11145. return true;
  11146. }
  11147. return false;
  11148. };
  11149. VsdxShape.prototype.getEdgeStyle$java_util_Map = function (edgeShape) {
  11150. var result = ({});
  11151. var edgeName = (function (m, k) { return m[k] ? m[k] : null; })(edgeShape, mxConstants.STYLE_SHAPE);
  11152. if ((function (o1, o2) { if (o1 && o1.equals) {
  11153. return o1.equals(o2);
  11154. }
  11155. else {
  11156. return o1 === o2;
  11157. } })(edgeName, "mxgraph.lean_mapping.electronic_info_flow_edge")) {
  11158. /* put */ (result[mxConstants.STYLE_EDGE] = mxConstants.NONE);
  11159. return result;
  11160. }
  11161. else {
  11162. /* put */ (result[mxConstants.STYLE_EDGE] = mxConstants.EDGESTYLE_ELBOW);
  11163. return result;
  11164. }
  11165. };
  11166. /**
  11167. * Returns the style of the edge. (Orthogonal or straight)
  11168. * @return {*} Edge Style.
  11169. * @param {*} edgeShape
  11170. */
  11171. VsdxShape.prototype.getEdgeStyle = function (edgeShape) {
  11172. if (((edgeShape != null && (edgeShape instanceof Object)) || edgeShape === null)) {
  11173. return this.getEdgeStyle$java_util_Map(edgeShape);
  11174. }
  11175. else if (edgeShape === undefined) {
  11176. return this.getEdgeStyle$();
  11177. }
  11178. else
  11179. throw new Error('invalid overload');
  11180. };
  11181. /**
  11182. * Returns the master's Id of the Shape.
  11183. * @return {string} Master's ID of the shape, null if has not a master.
  11184. */
  11185. VsdxShape.prototype.getMasterId = function () {
  11186. if (this.shape.hasAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER)) {
  11187. return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER);
  11188. }
  11189. else {
  11190. return null;
  11191. }
  11192. };
  11193. /**
  11194. * Returns the masterShape's Id of the shape.
  11195. * @return {string} Master Shape's ID of the shape, null if has not a master shape.
  11196. */
  11197. VsdxShape.prototype.getShapeMasterId = function () {
  11198. if (this.shape.hasAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER_SHAPE)) {
  11199. return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER_SHAPE);
  11200. }
  11201. else {
  11202. return null;
  11203. }
  11204. };
  11205. /**
  11206. * Checks if a shape contains other shapes inside.
  11207. * @return {boolean} Returns <code>true</code> if a shape contains other shapes inside.
  11208. */
  11209. VsdxShape.prototype.isGroup = function () {
  11210. return (function (o1, o2) { if (o1 && o1.equals) {
  11211. return o1.equals(o2);
  11212. }
  11213. else {
  11214. return o1 === o2;
  11215. } })(this.shape.getAttribute("Type"), "Group");
  11216. };
  11217. /**
  11218. * Checks if a shape contains other shapes inside.
  11219. * @return {string} Returns <code>true</code> if a shape contains other shapes inside.
  11220. * @param {*} shape
  11221. */
  11222. VsdxShape.getType = function (shape) {
  11223. return shape.getAttribute("Type");
  11224. };
  11225. VsdxShape.prototype.getMaster = function () {
  11226. return this.master;
  11227. };
  11228. /**
  11229. * Returns the NameU attribute.
  11230. * @return {string} Value of the NameU attribute.
  11231. */
  11232. VsdxShape.prototype.getNameU = function () {
  11233. var result = this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U) || "";
  11234. if ((result == null || (function (o1, o2) { if (o1 && o1.equals) {
  11235. return o1.equals(o2);
  11236. }
  11237. else {
  11238. return o1 === o2;
  11239. } })(result, "")) && this.masterShape != null) {
  11240. result = this.masterShape.getNameU();
  11241. }
  11242. return result;
  11243. };
  11244. /**
  11245. * Returns the Name attribute.
  11246. * @return {string} Value of the Name attribute (Human readable name).
  11247. */
  11248. VsdxShape.prototype.getName = function () {
  11249. var result = this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME);
  11250. if ((result == null || (function (o1, o2) { if (o1 && o1.equals) {
  11251. return o1.equals(o2);
  11252. }
  11253. else {
  11254. return o1 === o2;
  11255. } })(result, "")) && this.masterShape != null) {
  11256. result = this.masterShape.getName();
  11257. }
  11258. return result;
  11259. };
  11260. /**
  11261. * Returns the master name of the shape
  11262. * @return {string} Master name of the shape
  11263. */
  11264. VsdxShape.prototype.getMasterName = function () {
  11265. return this.shapeName;
  11266. };
  11267. VsdxShape.prototype.setLabelOffset = function (vertex, style) {
  11268. var nameU = "";
  11269. var masterNameU = "";
  11270. if (this.shape.hasAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U)) {
  11271. nameU = this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U);
  11272. }
  11273. if (this.getMaster() != null && this.getMaster().getMasterElement() != null) {
  11274. if (this.getMaster().getMasterElement().hasAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U)) {
  11275. masterNameU = this.getMaster().getMasterElement().getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U);
  11276. }
  11277. }
  11278. if ((function (str, searchString, position) {
  11279. if (position === void 0) { position = 0; }
  11280. return str.substr(position, searchString.length) === searchString;
  11281. })(nameU, "Organizational unit") || (function (str, searchString, position) {
  11282. if (position === void 0) { position = 0; }
  11283. return str.substr(position, searchString.length) === searchString;
  11284. })(masterNameU, "Organizational unit")) {
  11285. var control = this.shape.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.CONTROL).item(0);
  11286. var xEl = null;
  11287. var xS = "0.0";
  11288. var yEl = null;
  11289. var yS = "-0.4";
  11290. if (control != null) {
  11291. xEl = control.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.X).item(0);
  11292. if (xEl.hasAttribute("F")) {
  11293. xS = xEl.getAttribute("F");
  11294. }
  11295. else {
  11296. xS = xEl.textContent;
  11297. }
  11298. yEl = control.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.Y).item(0);
  11299. if (yEl.hasAttribute("F")) {
  11300. yS = yEl.getAttribute("F");
  11301. }
  11302. else {
  11303. yS = yEl.textContent;
  11304. }
  11305. }
  11306. var geometry_3 = vertex.getGeometry();
  11307. xS = xS.split("Width/2+").join("");
  11308. xS = xS.split("DL").join("");
  11309. yS = yS.split("Height*").join("");
  11310. if ((function (o1, o2) { if (o1 && o1.equals) {
  11311. return o1.equals(o2);
  11312. }
  11313. else {
  11314. return o1 === o2;
  11315. } })(xS, "Inh")) {
  11316. xS = "0.0";
  11317. }
  11318. if ((function (o1, o2) { if (o1 && o1.equals) {
  11319. return o1.equals(o2);
  11320. }
  11321. else {
  11322. return o1 === o2;
  11323. } })(yS, "Inh")) {
  11324. yS = "-0.4";
  11325. }
  11326. if (yS.indexOf("txtHeight") != -1) {
  11327. yS = "-0.4";
  11328. }
  11329. var styleArray = style.split(";");
  11330. var tabHeight = "";
  11331. for (var i = 0; i < styleArray.length; i++) {
  11332. var currStyle = styleArray[i];
  11333. currStyle = currStyle.trim();
  11334. if ((function (str, searchString, position) {
  11335. if (position === void 0) { position = 0; }
  11336. return str.substr(position, searchString.length) === searchString;
  11337. })(currStyle, "tabHeight=")) {
  11338. tabHeight = currStyle.split("tabHeight=").join("");
  11339. }
  11340. }
  11341. ;
  11342. if ((function (o1, o2) { if (o1 && o1.equals) {
  11343. return o1.equals(o2);
  11344. }
  11345. else {
  11346. return o1 === o2;
  11347. } })(tabHeight, "")) {
  11348. tabHeight = "20";
  11349. }
  11350. var tH = parseFloat(tabHeight);
  11351. var x = parseFloat(xS);
  11352. var y = parseFloat(yS);
  11353. var h = geometry_3.height;
  11354. var xFinal = geometry_3.width * 0.1 + x * 100;
  11355. var yFinal = h - h * y - tH / 2;
  11356. var offset = new mxPoint(xFinal, yFinal);
  11357. vertex.getGeometry().offset = (offset);
  11358. }
  11359. else if ((function (str, searchString, position) {
  11360. if (position === void 0) { position = 0; }
  11361. return str.substr(position, searchString.length) === searchString;
  11362. })(nameU, "Domain 3D") || (function (str, searchString, position) {
  11363. if (position === void 0) { position = 0; }
  11364. return str.substr(position, searchString.length) === searchString;
  11365. })(masterNameU, "Domain 3D")) {
  11366. var control = this.shape.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.CONTROL).item(0);
  11367. var xEl = null;
  11368. var xS = "0.0";
  11369. var yEl = null;
  11370. var yS = "-0.4";
  11371. if (control != null) {
  11372. xEl = control.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.X).item(0);
  11373. xS = xEl.getAttribute("F") || "";
  11374. yEl = control.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.Y).item(0);
  11375. yS = yEl.getAttribute("F") || "";
  11376. }
  11377. var geometry_4 = vertex.getGeometry();
  11378. xS = xS.split("Width/2+").join("");
  11379. xS = xS.split("DL").join("");
  11380. yS = yS.split("Height*").join("");
  11381. if ((function (o1, o2) { if (o1 && o1.equals) {
  11382. return o1.equals(o2);
  11383. }
  11384. else {
  11385. return o1 === o2;
  11386. } })(xS, "Inh") || (function (o1, o2) { if (o1 && o1.equals) {
  11387. return o1.equals(o2);
  11388. }
  11389. else {
  11390. return o1 === o2;
  11391. } })(xS, "")) {
  11392. xS = "0.0";
  11393. }
  11394. if ((function (o1, o2) { if (o1 && o1.equals) {
  11395. return o1.equals(o2);
  11396. }
  11397. else {
  11398. return o1 === o2;
  11399. } })(yS, "Inh") || (function (o1, o2) { if (o1 && o1.equals) {
  11400. return o1.equals(o2);
  11401. }
  11402. else {
  11403. return o1 === o2;
  11404. } })(yS, "")) {
  11405. yS = "-0.4";
  11406. }
  11407. if (yS.indexOf("txtHeight") != -1) {
  11408. yS = "-0.4";
  11409. }
  11410. var x = parseFloat(xS);
  11411. var y = parseFloat(yS);
  11412. var h = geometry_4.height;
  11413. var xFinal = geometry_4.width * 0.1 + x * 100;
  11414. var yFinal = h - h * y;
  11415. var offset = new mxPoint(xFinal, yFinal);
  11416. vertex.getGeometry().offset = (offset);
  11417. }
  11418. };
  11419. /**
  11420. * Returns the constant that represents the Shape.
  11421. * @return {*} String that represent the form.
  11422. */
  11423. VsdxShape.prototype.getForm = function () {
  11424. var result = ({});
  11425. // this.styleDebug("Looking to match shape = " + this.shapeName);
  11426. // if (this.shapeName != null && !(function (o1, o2) { if (o1 && o1.equals) {
  11427. // return o1.equals(o2);
  11428. // }
  11429. // else {
  11430. // return o1 === o2;
  11431. // } })(this.shapeName, "") && VsdxShape.USE_SHAPE_MATCH) {
  11432. // var trans = mxResources.get(this.shapeName);
  11433. // if (trans != null && !(function (o1, o2) { if (o1 && o1.equals) {
  11434. // return o1.equals(o2);
  11435. // }
  11436. // else {
  11437. // return o1 === o2;
  11438. // } })(trans, "")) {
  11439. // this.styleDebug("Translation = " + trans);
  11440. // /* put */ (result[mxConstants.STYLE_SHAPE] = trans);
  11441. // return result;
  11442. // }
  11443. // }
  11444. if (this.isVertex()) {
  11445. try {
  11446. var type = VsdxShape.getType(this.getShape());
  11447. this.styleDebug("shape type = " + type);
  11448. if (this.imageData != null || ((function (o1, o2) { if (o1 && o1.equals) {
  11449. return o1.equals(o2);
  11450. }
  11451. else {
  11452. return o1 === o2;
  11453. } })(com.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN, type) && this.masterShape != null && this.masterShape.imageData != null)) {
  11454. var imageData = this.imageData != null ? this.imageData : this.masterShape.imageData;
  11455. /* put */ (result["shape"] = "image");
  11456. /* put */ (result["aspect"] = "fixed");
  11457. var iType = (function (m, k) { return m[k] ? m[k] : null; })(imageData, "iType");
  11458. var iData = (function (m, k) { return m[k] ? m[k] : null; })(imageData, "iData");
  11459. var imgOffsetX = parseFloat(this.getValue(this.getCellElement$java_lang_String('ImgOffsetX'), "0"));
  11460. var imgOffsetY = parseFloat(this.getValue(this.getCellElement$java_lang_String('ImgOffsetY'), "0"));
  11461. var imgWidth = parseFloat(this.getValue(this.getCellElement$java_lang_String('ImgWidth'), "0"));
  11462. var imgHeight = parseFloat(this.getValue(this.getCellElement$java_lang_String('ImgHeight'), "0"));
  11463. var width = parseFloat(this.getValue(this.getCellElement$java_lang_String('Width'), "0"));
  11464. var height = parseFloat(this.getValue(this.getCellElement$java_lang_String('Height'), "0"));
  11465. if (imgOffsetX != 0 || imgOffsetY != 0 ||
  11466. imgWidth != width || imgHeight != height)
  11467. {
  11468. this.toBeCroppedImg = {
  11469. imgOffsetX: imgOffsetX,
  11470. imgOffsetY: imgOffsetY,
  11471. imgWidth: imgWidth,
  11472. imgHeight: imgHeight,
  11473. width: width,
  11474. height: height,
  11475. iType: iType,
  11476. iData: iData
  11477. };
  11478. }
  11479. else
  11480. {
  11481. /* put */ (result["image"] = "data:image/" + iType + "," + iData);
  11482. }
  11483. return result;
  11484. }
  11485. var parsedGeom = this.parseGeom();
  11486. if ((function (o1, o2) { if (o1 && o1.equals) {
  11487. return o1.equals(o2);
  11488. }
  11489. else {
  11490. return o1 === o2;
  11491. } })(parsedGeom, "")) {
  11492. this.styleDebug("No geom found");
  11493. return result;
  11494. }
  11495. var enc = Graph.compress(parsedGeom);
  11496. /* put */ (result[mxConstants.STYLE_SHAPE] = "stencil(" + enc + ")");
  11497. }
  11498. catch (e) {
  11499. //console.error(e.message, e);
  11500. }
  11501. ;
  11502. }
  11503. else {
  11504. return this.getEdgeStyle();
  11505. }
  11506. return result;
  11507. };
  11508. /**
  11509. * Checks if a shape may to be imported like an Off page reference.
  11510. * @return {boolean} Returns <code>true</code> if a shape may to be imported like an Off page reference.
  11511. */
  11512. VsdxShape.prototype.isOff_page_reference = function () {
  11513. var name = this.getNameU();
  11514. if ((function (o1, o2) { if (o1 && o1.equals) {
  11515. return o1.equals(o2);
  11516. }
  11517. else {
  11518. return o1 === o2;
  11519. } })(name, "Off-page reference") || (function (o1, o2) { if (o1 && o1.equals) {
  11520. return o1.equals(o2);
  11521. }
  11522. else {
  11523. return o1 === o2;
  11524. } })(name, "Lined/Shaded process")) {
  11525. return true;
  11526. }
  11527. return false;
  11528. };
  11529. /**
  11530. * Checks if a shape may to be imported like an External process.
  11531. * @return {boolean} Returns <code>true</code> if a shape may to be imported like an External process.
  11532. */
  11533. VsdxShape.prototype.isExternal_process = function () {
  11534. return ((function (o1, o2) { if (o1 && o1.equals) {
  11535. return o1.equals(o2);
  11536. }
  11537. else {
  11538. return o1 === o2;
  11539. } })(this.shapeName, "External process"));
  11540. };
  11541. /**
  11542. * Returns the direction of the shape.
  11543. * @param {*} form Form of the shape.
  11544. * @return {string} Direction(south, north, east and south)
  11545. */
  11546. VsdxShape.prototype.getDirection = function (form) {
  11547. var offsetS = mxResources.get("mxOffset" + this.shapeName);
  11548. if (offsetS == null || (function (o1, o2) { if (o1 && o1.equals) {
  11549. return o1.equals(o2);
  11550. }
  11551. else {
  11552. return o1 === o2;
  11553. } })(offsetS, "0") || (function (o1, o2) { if (o1 && o1.equals) {
  11554. return o1.equals(o2);
  11555. }
  11556. else {
  11557. return o1 === o2;
  11558. } })(offsetS, "")) {
  11559. return mxConstants.DIRECTION_EAST;
  11560. }
  11561. else if ((function (o1, o2) { if (o1 && o1.equals) {
  11562. return o1.equals(o2);
  11563. }
  11564. else {
  11565. return o1 === o2;
  11566. } })(offsetS, "1")) {
  11567. return mxConstants.DIRECTION_SOUTH;
  11568. }
  11569. else if ((function (o1, o2) { if (o1 && o1.equals) {
  11570. return o1.equals(o2);
  11571. }
  11572. else {
  11573. return o1 === o2;
  11574. } })(offsetS, "2")) {
  11575. return mxConstants.DIRECTION_WEST;
  11576. }
  11577. else if ((function (o1, o2) { if (o1 && o1.equals) {
  11578. return o1.equals(o2);
  11579. }
  11580. else {
  11581. return o1 === o2;
  11582. } })(offsetS, "3")) {
  11583. return mxConstants.DIRECTION_NORTH;
  11584. }
  11585. return mxConstants.DIRECTION_EAST;
  11586. };
  11587. /**
  11588. * Checks if a shape may to be imported like a Sub-process.
  11589. * This method is approximated.
  11590. * @return {boolean} Returns <code>true</code> if a shape may to be imported like a
  11591. * Sub-process.
  11592. */
  11593. VsdxShape.prototype.isSubproces = function () {
  11594. return (function (o1, o2) { if (o1 && o1.equals) {
  11595. return o1.equals(o2);
  11596. }
  11597. else {
  11598. return o1 === o2;
  11599. } })(this.shapeName, "Subproces");
  11600. };
  11601. VsdxShape.prototype.getEdgeStyle$ = function () {
  11602. var result = ({});
  11603. /* put */ (result["edgeStyle"] = "none");
  11604. return result;
  11605. };
  11606. VsdxShape.prototype.getChildShapes = function () {
  11607. return this.childShapes;
  11608. };
  11609. VsdxShape.prototype.setChildShapes = function (childShapes) {
  11610. this.childShapes = childShapes;
  11611. };
  11612. VsdxShape.prototype.isDisplacedLabel = function () {
  11613. var txtPinXF = this.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X, "F", "");
  11614. var txtPinYF = this.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y, "F", "");
  11615. var txtWidthF = this.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH, "F", "");
  11616. var txtHeightF = this.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT, "F", "");
  11617. if (this.masterShape != null) {
  11618. if (txtPinXF === "" || (function (o1, o2) { if (o1 && o1.equals) {
  11619. return o1.equals(o2);
  11620. }
  11621. else {
  11622. return o1 === o2;
  11623. } })(txtPinXF.toLowerCase(), "inh")) {
  11624. txtPinXF = this.masterShape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X, "F", "");
  11625. }
  11626. if (txtPinYF === "" || (function (o1, o2) { if (o1 && o1.equals) {
  11627. return o1.equals(o2);
  11628. }
  11629. else {
  11630. return o1 === o2;
  11631. } })(txtPinYF.toLowerCase(), "inh")) {
  11632. txtPinYF = this.masterShape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y, "F", "");
  11633. }
  11634. if (txtWidthF === "" || (function (o1, o2) { if (o1 && o1.equals) {
  11635. return o1.equals(o2);
  11636. }
  11637. else {
  11638. return o1 === o2;
  11639. } })(txtWidthF.toLowerCase(), "inh")) {
  11640. txtWidthF = this.masterShape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH, "F", "");
  11641. }
  11642. if (txtHeightF === "" || (function (o1, o2) { if (o1 && o1.equals) {
  11643. return o1.equals(o2);
  11644. }
  11645. else {
  11646. return o1 === o2;
  11647. } })(txtHeightF.toLowerCase(), "inh")) {
  11648. txtHeightF = this.masterShape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT, "F", "");
  11649. }
  11650. }
  11651. if ((function (o1, o2) { if (o1 && o1.equals) {
  11652. return o1.equals(o2);
  11653. }
  11654. else {
  11655. return o1 === o2;
  11656. } })(txtPinXF.toLowerCase(), "width*0.5") && (function (o1, o2) { if (o1 && o1.equals) {
  11657. return o1.equals(o2);
  11658. }
  11659. else {
  11660. return o1 === o2;
  11661. } })(txtPinYF.toLowerCase(), "height*0.5") && (function (o1, o2) { if (o1 && o1.equals) {
  11662. return o1.equals(o2);
  11663. }
  11664. else {
  11665. return o1 === o2;
  11666. } })(txtWidthF.toLowerCase(), "width*1") && (function (o1, o2) { if (o1 && o1.equals) {
  11667. return o1.equals(o2);
  11668. }
  11669. else {
  11670. return o1 === o2;
  11671. } })(txtHeightF.toLowerCase(), "height*1")) {
  11672. return false;
  11673. }
  11674. else if ((function (str, searchString, position) {
  11675. if (position === void 0) { position = 0; }
  11676. return str.substr(position, searchString.length) === searchString;
  11677. })(txtPinXF.toLowerCase(), "width*") && (function (str, searchString, position) {
  11678. if (position === void 0) { position = 0; }
  11679. return str.substr(position, searchString.length) === searchString;
  11680. })(txtPinYF.toLowerCase(), "height*") && (function (str, searchString, position) {
  11681. if (position === void 0) { position = 0; }
  11682. return str.substr(position, searchString.length) === searchString;
  11683. })(txtWidthF.toLowerCase(), "width*") && (function (str, searchString, position) {
  11684. if (position === void 0) { position = 0; }
  11685. return str.substr(position, searchString.length) === searchString;
  11686. })(txtHeightF.toLowerCase(), "height*")) {
  11687. return true;
  11688. }
  11689. else if ((function (str, searchString, position) {
  11690. if (position === void 0) { position = 0; }
  11691. return str.substr(position, searchString.length) === searchString;
  11692. })(txtPinXF.toLowerCase(), "controls.row_") || (function (str, searchString, position) {
  11693. if (position === void 0) { position = 0; }
  11694. return str.substr(position, searchString.length) === searchString;
  11695. })(txtPinYF.toLowerCase(), "controls.row_")) {
  11696. return true;
  11697. }
  11698. return false;
  11699. };
  11700. VsdxShape.prototype.isVerticalLabel = function ()
  11701. {
  11702. var txtDir = this.getAttribute('TextDirection', 'V', '');
  11703. if (!txtDir && this.masterShape != null)
  11704. {
  11705. txtDir = this.masterShape.getAttribute('TextDirection', 'V', '');
  11706. }
  11707. return txtDir == '1';
  11708. };
  11709. VsdxShape.prototype.isRotatedLabel = function ()
  11710. {
  11711. if (this.isVerticalLabel())
  11712. {
  11713. return true;
  11714. }
  11715. var txtAngleValue = this.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE, "V", "");
  11716. if (this.masterShape != null) {
  11717. if ((function (o1, o2) { if (o1 && o1.equals) {
  11718. return o1.equals(o2);
  11719. }
  11720. else {
  11721. return o1 === o2;
  11722. } })(txtAngleValue, "")) {
  11723. txtAngleValue = this.masterShape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE, "V", "");
  11724. }
  11725. }
  11726. if (!(function (o1, o2) { if (o1 && o1.equals) {
  11727. return o1.equals(o2);
  11728. }
  11729. else {
  11730. return o1 === o2;
  11731. } })(txtAngleValue, "0") && !(function (o1, o2) { if (o1 && o1.equals) {
  11732. return o1.equals(o2);
  11733. }
  11734. else {
  11735. return o1 === o2;
  11736. } })(txtAngleValue, "0.0") && !(function (o1, o2) { if (o1 && o1.equals) {
  11737. return o1.equals(o2);
  11738. }
  11739. else {
  11740. return o1 === o2;
  11741. } })(txtAngleValue, "")) {
  11742. return true;
  11743. }
  11744. return false;
  11745. };
  11746. VsdxShape.prototype.setRootShape = function (shape) {
  11747. this.rootShape = shape;
  11748. };
  11749. VsdxShape.prototype.getRootShape = function () {
  11750. return this.rootShape;
  11751. };
  11752. /**
  11753. * Returns the coordinates of the begin point of an Edge Shape.
  11754. * @param {number} parentHeight Height of the parent of the shape.
  11755. * @return {mxPoint} mxPoint that represents the coordinates.
  11756. */
  11757. VsdxShape.prototype.getStartXY = function (parentHeight) {
  11758. var startX = Math.floor(Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_X), 0) * 100) / 100);
  11759. var startY = Math.floor(Math.round((parentHeight - this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_Y), 0)) * 100) / 100);
  11760. return new mxPoint(startX, startY);
  11761. };
  11762. /**
  11763. * Returns the coordinates of the end point of an Edge Shape.
  11764. * @param {number} parentHeight Height of the parent of the shape.
  11765. * @return {mxPoint} mxPoint that represents the coordinates.
  11766. */
  11767. VsdxShape.prototype.getEndXY = function (parentHeight) {
  11768. var endX = Math.floor(Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.END_X), 0) * 100) / 100);
  11769. var endY = Math.floor(Math.round((parentHeight - this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.END_Y), 0)) * 100) / 100);
  11770. return new mxPoint(endX, endY);
  11771. };
  11772. /**
  11773. * Returns the list of routing points of a edge shape.
  11774. * @param {number} parentHeight Height of the parent of the shape.
  11775. * @return {mxPoint[]} List of mxPoint that represents the routing points.
  11776. * @param {mxPoint} startPoint
  11777. * @param {number} rotation
  11778. */
  11779. VsdxShape.prototype.getRoutingPoints = function (parentHeight, startPoint, rotation) {
  11780. if (this.geomList != null) {
  11781. return this.geomList.getRoutingPoints(parentHeight, startPoint, rotation);
  11782. }
  11783. return null;
  11784. };
  11785. /**
  11786. * Returns the list of control points of a edge shape.
  11787. * @param {number} parentHeight Height of the parent of the shape.
  11788. * @return {mxPoint[]} List of mxPoint that represents the control points.
  11789. */
  11790. VsdxShape.prototype.getControlPoints = function (parentHeight) {
  11791. var startXY = this.getStartXY(parentHeight);
  11792. var endXY = this.getEndXY(parentHeight);
  11793. var pointList = ([]);
  11794. if (this.shape != null) {
  11795. var geomList = this.shape.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.GEOM);
  11796. if (geomList.length > 0) {
  11797. var firstGeom = geomList.item(0);
  11798. var firstNURBS = firstGeom.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.NURBS_TO).item(0);
  11799. var firstE = firstNURBS.getElementsByTagName("E").item(0);
  11800. if (firstE != null) {
  11801. var f = firstE.getAttribute("F") || "";
  11802. f = f.replace(new RegExp("NURBS\\(", 'g'), "");
  11803. f = f.replace(new RegExp("\\)", 'g'), "");
  11804. f = f.replace(new RegExp(",", 'g'), " ");
  11805. f = f.replace(new RegExp("\\s\\s", 'g'), " ");
  11806. var pointsS = f.split(" ");
  11807. var pointsRaw = (function (s) { var a = []; while (s-- > 0)
  11808. a.push(0); return a; })(pointsS.length);
  11809. for (var i = 0; i < pointsS.length; i++) {
  11810. pointsRaw[i] = parseFloat(pointsS[i]);
  11811. }
  11812. ;
  11813. for (var i = 2; i + 4 < pointsS.length; i = i + 4) {
  11814. var currPoint = new mxPoint();
  11815. var rawX = pointsRaw[i + 2];
  11816. var rawY = pointsRaw[i + 3];
  11817. var width = Math.abs(endXY.x - startXY.x);
  11818. var widthFixed = Math.min(100, width);
  11819. var heightFixed = 100;
  11820. var finalX = 0;
  11821. finalX = startXY.x + widthFixed * rawX;
  11822. currPoint.x = (Math.floor(Math.round(finalX * 100) / 100));
  11823. currPoint.y = (Math.floor(Math.round((startXY.y - heightFixed * rawY) * 100) / 100));
  11824. /* add */ (pointList.push(currPoint));
  11825. }
  11826. ;
  11827. return pointList;
  11828. }
  11829. else {
  11830. return null;
  11831. }
  11832. }
  11833. }
  11834. return null;
  11835. };
  11836. /**
  11837. * Analyzes a edge shape and returns a string with the style.
  11838. * @return {*} style read from the edge shape.
  11839. * @param {number} parentHeight
  11840. */
  11841. VsdxShape.prototype.getStyleFromEdgeShape = function (parentHeight) {
  11842. /* put */ (this.styleMap[com.mxgraph.io.vsdx.mxVsdxConstants.VSDX_ID] = this.getId().toString());
  11843. var edgeShape = this.getForm();
  11844. if (edgeShape != null && !(function (o1, o2) { if (o1 && o1.equals) {
  11845. return o1.equals(o2);
  11846. }
  11847. else {
  11848. return o1 === o2;
  11849. } })(edgeShape, "")) {
  11850. //this.styleMap.putAll(edgeShape);
  11851. for (var key in edgeShape)
  11852. {
  11853. this.styleMap[key] = edgeShape[key];
  11854. }
  11855. }
  11856. if (this.isDashed()) {
  11857. /* put */ (this.styleMap[mxConstants.STYLE_DASHED] = "1");
  11858. var dashPattern = this.getDashPattern();
  11859. if (dashPattern != null) {
  11860. /* put */ (this.styleMap[mxConstants.STYLE_DASH_PATTERN] = dashPattern);
  11861. }
  11862. }
  11863. var startArrow = this.getEdgeMarker(true);
  11864. if (startArrow != null) {
  11865. if ((function (str, searchString, position) {
  11866. if (position === void 0) { position = 0; }
  11867. return str.substr(position, searchString.length) === searchString;
  11868. })(startArrow, VsdxShape.ARROW_NO_FILL_MARKER)) {
  11869. startArrow = startArrow.substring(VsdxShape.ARROW_NO_FILL_MARKER.length);
  11870. /* put */ (this.styleMap[mxConstants.STYLE_STARTFILL] = "0");
  11871. }
  11872. /* put */ (this.styleMap[mxConstants.STYLE_STARTARROW] = startArrow);
  11873. }
  11874. var endArrow = this.getEdgeMarker(false);
  11875. if (endArrow != null) {
  11876. if ((function (str, searchString, position) {
  11877. if (position === void 0) { position = 0; }
  11878. return str.substr(position, searchString.length) === searchString;
  11879. })(endArrow, VsdxShape.ARROW_NO_FILL_MARKER)) {
  11880. endArrow = endArrow.substring(VsdxShape.ARROW_NO_FILL_MARKER.length);
  11881. /* put */ (this.styleMap[mxConstants.STYLE_ENDFILL] = "0");
  11882. }
  11883. /* put */ (this.styleMap[mxConstants.STYLE_ENDARROW] = endArrow);
  11884. }
  11885. var saSize = (Math.round(this.getStartArrowSize()) | 0);
  11886. if (saSize !== 6) {
  11887. /* put */ (this.styleMap[mxConstants.STYLE_STARTSIZE] = ('' + (saSize)));
  11888. }
  11889. var faSize = (Math.round(this.getFinalArrowSize()) | 0);
  11890. if (faSize !== 6) {
  11891. /* put */ (this.styleMap[mxConstants.STYLE_ENDSIZE] = ('' + (faSize)));
  11892. }
  11893. var lWeight = (Math.round(this.getLineWidth()) | 0);
  11894. if (lWeight !== 1.0) {
  11895. /* put */ (this.styleMap[mxConstants.STYLE_STROKEWIDTH] = ('' + (lWeight)));
  11896. }
  11897. var color = this.getStrokeColor();
  11898. if (!(function (o1, o2) { if (o1 && o1.equals) {
  11899. return o1.equals(o2);
  11900. }
  11901. else {
  11902. return o1 === o2;
  11903. } })(color, "")) {
  11904. /* put */ (this.styleMap[mxConstants.STYLE_STROKECOLOR] = color);
  11905. }
  11906. if (this.isShadow()) {
  11907. /* put */ (this.styleMap[mxConstants.STYLE_SHADOW] = com.mxgraph.io.vsdx.mxVsdxConstants.TRUE);
  11908. }
  11909. if (this.isConnectorBigNameU(this.getNameU())) {
  11910. /* put */ (this.styleMap[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_ARROW);
  11911. var fillcolor = this.getFillColor();
  11912. if (!(function (o1, o2) { if (o1 && o1.equals) {
  11913. return o1.equals(o2);
  11914. }
  11915. else {
  11916. return o1 === o2;
  11917. } })(fillcolor, "")) {
  11918. /* put */ (this.styleMap[mxConstants.STYLE_FILLCOLOR] = fillcolor);
  11919. }
  11920. }
  11921. var topMargin = (Math.round(this.getTopSpacing()) | 0);
  11922. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_TOP] = ('' + (topMargin)));
  11923. var bottomMargin = (Math.round(this.getBottomSpacing()) | 0);
  11924. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_BOTTOM] = ('' + (bottomMargin)));
  11925. var leftMargin = (Math.round(this.getLeftSpacing()) | 0);
  11926. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_LEFT] = ('' + (leftMargin)));
  11927. var rightMargin = (Math.round(this.getRightSpacing()) | 0);
  11928. /* put */ (this.styleMap[mxConstants.STYLE_SPACING_RIGHT] = ('' + (rightMargin)));
  11929. var verticalAlign = this.getAlignVertical();
  11930. /* put */ (this.styleMap[mxConstants.STYLE_VERTICAL_ALIGN] = verticalAlign);
  11931. /* put */ (this.styleMap["html"] = "1");
  11932. this.resolveCommonStyles();
  11933. return this.styleMap;
  11934. };
  11935. /**
  11936. * Analyzes a edge shape and returns a string with the style.
  11937. * @return {*} style read from the edge shape.
  11938. */
  11939. VsdxShape.prototype.resolveCommonStyles = function () {
  11940. var lbkgnd = this.getTextBkgndColor(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_BKGND));
  11941. if (!(function (o1, o2) { if (o1 && o1.equals) {
  11942. return o1.equals(o2);
  11943. }
  11944. else {
  11945. return o1 === o2;
  11946. } })(lbkgnd, "")) {
  11947. var isFullyTransparent = this.getValue(this.getCellElement$java_lang_String('TextBkgndTrans'), '0') == '1';
  11948. if (!isFullyTransparent)
  11949. {
  11950. /* put */ (this.styleMap[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR] = lbkgnd);
  11951. }
  11952. }
  11953. /* put */ (this.styleMap[mxConstants.STYLE_ROUNDED] = this.getRounding() > 0 ? com.mxgraph.io.vsdx.mxVsdxConstants.TRUE : com.mxgraph.io.vsdx.mxVsdxConstants.FALSE);
  11954. return this.styleMap;
  11955. };
  11956. /**
  11957. * Returns the arrow of the line.
  11958. * @return {string} Type of arrow.
  11959. * @param {boolean} start
  11960. */
  11961. VsdxShape.prototype.getEdgeMarker = function (start) {
  11962. var marker = this.getValue(this.getCellElement$java_lang_String(start ? com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW : com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW), "0");
  11963. var val = 0;
  11964. try {
  11965. if ((function (o1, o2) { if (o1 && o1.equals) {
  11966. return o1.equals(o2);
  11967. }
  11968. else {
  11969. return o1 === o2;
  11970. } })(marker, "Themed")) {
  11971. var theme_17 = this.getTheme();
  11972. if (theme_17 != null) {
  11973. val = this.isVertex() ? theme_17.getEdgeMarker(start, this.getQuickStyleVals()) : theme_17.getConnEdgeMarker(start, this.getQuickStyleVals());
  11974. }
  11975. }
  11976. else {
  11977. val = parseInt(marker);
  11978. }
  11979. }
  11980. catch (e) {
  11981. }
  11982. ;
  11983. var type = (function (m, k) { if (m.entries == null)
  11984. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  11985. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  11986. return m.entries[i].value;
  11987. } return null; })(VsdxShape.arrowTypes_$LI$(), val);
  11988. if (val > 0 && type == null) {
  11989. type = (function (m, k) { if (m.entries == null)
  11990. m.entries = []; for (var i = 0; i < m.entries.length; i++)
  11991. if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) {
  11992. return m.entries[i].value;
  11993. } return null; })(VsdxShape.arrowTypes_$LI$(), 1);
  11994. }
  11995. return type;
  11996. };
  11997. VsdxShape.prototype.getCellElement$java_lang_String = function (key) {
  11998. var elem = _super.prototype.getCellElement$java_lang_String.call(this, key);
  11999. if (elem == null && this.masterShape != null) {
  12000. return this.masterShape.getCellElement$java_lang_String(key);
  12001. }
  12002. return elem;
  12003. };
  12004. VsdxShape.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String = function (cellKey, index, sectKey) {
  12005. var elem = _super.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String.call(this, cellKey, index, sectKey);
  12006. if (elem == null && this.masterShape != null) {
  12007. return this.masterShape.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey);
  12008. }
  12009. return elem;
  12010. };
  12011. VsdxShape.prototype.getCellElement = function (cellKey, index, sectKey) {
  12012. if (((typeof cellKey === 'string') || cellKey === null) && ((typeof index === 'string') || index === null) && ((typeof sectKey === 'string') || sectKey === null)) {
  12013. return this.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey);
  12014. }
  12015. else if (((typeof cellKey === 'string') || cellKey === null) && index === undefined && sectKey === undefined) {
  12016. return this.getCellElement$java_lang_String(cellKey);
  12017. }
  12018. else
  12019. throw new Error('invalid overload');
  12020. };
  12021. /**
  12022. * Creates a sub shape for <b>shape</b> that contains the label. Used internally, when the label is positioned by an anchor.
  12023. * @param graph
  12024. * @param shape the shape we want to create the label for
  12025. * @param {mxCell} parent
  12026. * @param parentHeight
  12027. * @return {mxCell} label sub-shape
  12028. */
  12029. VsdxShape.prototype.createLabelSubShape = function (graph, parent) {
  12030. var txtWV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH), this.getWidth());
  12031. var txtHV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT), this.getHeight());
  12032. var txtLocPinXV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_X), txtWV / 2.0);
  12033. var txtLocPinYV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_Y), txtHV / 2.0);
  12034. var txtPinXV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X), txtLocPinXV);
  12035. var txtPinYV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y), txtLocPinYV);
  12036. var txtAngleV = this.getValueAsDouble(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE), 0);
  12037. var textLabel = this.getTextLabel(txtWV < 1 || txtHV < 1);
  12038. if (textLabel != null && !(textLabel.length === 0)) {
  12039. var styleMap = mxUtils.clone(this.getStyleMap()) || {};
  12040. /* put */ (styleMap[mxConstants.STYLE_FILLCOLOR] = mxConstants.NONE);
  12041. /* put */ (styleMap[mxConstants.STYLE_STROKECOLOR] = mxConstants.NONE);
  12042. /* put */ (styleMap[mxConstants.STYLE_GRADIENTCOLOR] = mxConstants.NONE);
  12043. if (!styleMap.hasOwnProperty("align"))
  12044. (styleMap["align"] = "center");
  12045. if (!styleMap.hasOwnProperty("verticalAlign"))
  12046. (styleMap["verticalAlign"] = "middle");
  12047. if (!styleMap.hasOwnProperty("whiteSpace"))
  12048. (styleMap["whiteSpace"] = "wrap");
  12049. /* remove */ delete styleMap["shape"];
  12050. /* remove */ delete styleMap["image"];
  12051. if (this.isVerticalLabel())
  12052. {
  12053. txtAngleV += Math.PI + 0.01; //TODO Added 0.01 since we don't override the parent rotation if labRot is zero. Why?
  12054. styleMap['horizontal'] = '0';
  12055. }
  12056. var rotation = this.getRotation();
  12057. if (txtAngleV !== 0) {
  12058. var labRot = 360 - (function (x) { return x * 180 / Math.PI; })(txtAngleV);
  12059. labRot = Math.round(((labRot + rotation) % 360.0) * 100.0) / 100.0;
  12060. if (labRot !== 0.0) {
  12061. /* put */ (styleMap["rotation"] = ('' + (labRot)));
  12062. }
  12063. }
  12064. var style = "text;" + com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "=");
  12065. var y = parent.getGeometry().height - (txtPinYV + txtHV - txtLocPinYV);
  12066. var x = txtPinXV - txtLocPinXV;
  12067. if (rotation > 0) {
  12068. var tmpGeo = new mxGeometry(x, y, txtWV, txtHV);
  12069. var pgeo = parent.getGeometry();
  12070. var hw = pgeo.width / 2;
  12071. var hh = pgeo.height / 2;
  12072. com.mxgraph.online.Utils.rotatedGeometry(tmpGeo, rotation, hw, hh);
  12073. x = tmpGeo.x;
  12074. y = tmpGeo.y;
  12075. }
  12076. var v1 = graph.insertVertex(parent, null, textLabel,
  12077. Math.round(x * 100) / 100, Math.round(y * 100) / 100,
  12078. Math.round(txtWV * 100) / 100, Math.round(txtHV * 100) / 100,
  12079. style + ";html=1;");
  12080. return v1;
  12081. }
  12082. return null;
  12083. };
  12084. VsdxShape.prototype.getLblEdgeOffset = function (view, points) {
  12085. if (points != null && points.length > 1) {
  12086. //find mxGraph label offset
  12087. var state = new mxCellState();
  12088. state.absolutePoints = (points);
  12089. view.updateEdgeBounds(state);
  12090. var mxOffset = view.getPoint(state);
  12091. var p0 = points[0];
  12092. var pe = points[points.length - 1];
  12093. var txtWV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH), this.getWidth());
  12094. var txtHV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT), this.getHeight());
  12095. var txtLocPinXV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_X), 0);
  12096. var txtLocPinYV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_Y), 0);
  12097. var txtPinXV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X), 0);
  12098. var txtPinYV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y), 0);
  12099. var y = (this.getHeight() - (p0.y - pe.y)) / 2 + p0.y - mxOffset.y - (txtPinYV - txtLocPinYV + txtHV / 2);
  12100. var x = txtPinXV - txtLocPinXV + txtWV / 2 + (p0.x - mxOffset.x);
  12101. //FIXME one file has txtPinX/Y values extremely high which cause draw.io to hang
  12102. // <Cell N='TxtPinX' V='-1.651384506429589E199' F='SETATREF(Controls.TextPosition)'/>
  12103. // <Cell N='TxtPinY' V='1.183491078740126E185' F='SETATREF(Controls.TextPosition.Y)'/>
  12104. if (Math.abs(x) > 1.0E11)
  12105. return null;
  12106. return new mxPoint(Math.floor(Math.round(x * 100) / 100), Math.floor(Math.round(y * 100) / 100));
  12107. }
  12108. else {
  12109. return null;
  12110. }
  12111. };
  12112. VsdxShape.prototype.getShapeIndex = function () {
  12113. return this.shapeIndex;
  12114. };
  12115. VsdxShape.prototype.setShapeIndex = function (shapeIndex) {
  12116. this.shapeIndex = shapeIndex;
  12117. };
  12118. return VsdxShape;
  12119. }(com.mxgraph.io.vsdx.Shape));
  12120. VsdxShape.__static_initialized = false;
  12121. VsdxShape.ARROW_NO_FILL_MARKER = "0";
  12122. /**
  12123. * Number of d.p. to round non-integers to
  12124. */
  12125. VsdxShape.maxDp = 2;
  12126. //TODO FIXME In online, matching fails which gives better results!
  12127. VsdxShape.USE_SHAPE_MATCH = false;
  12128. VsdxShape.stencilTemplate = "<shape h=\"htemplate\" w=\"wtemplate\" aspect=\"variable\" strokewidth=\"inherit\"><connections></connections><background></background><foreground></foreground></shape>";
  12129. vsdx.VsdxShape = VsdxShape;
  12130. VsdxShape["__class"] = "com.mxgraph.io.vsdx.VsdxShape";
  12131. })(vsdx = io.vsdx || (io.vsdx = {}));
  12132. })(io = mxgraph.io || (mxgraph.io = {}));
  12133. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  12134. })(com || (com = {}));
  12135. var com;
  12136. (function (com) {
  12137. var mxgraph;
  12138. (function (mxgraph) {
  12139. var online;
  12140. (function (online) {
  12141. /**
  12142. * A very fast and memory efficient class to encode and decode to and from BASE64 in full accordance
  12143. * with RFC 2045.<br><br>
  12144. * On Windows XP sp1 with 1.4.2_04 and later ;), this encoder and decoder is about 10 times faster
  12145. * on small arrays (10 - 1000 bytes) and 2-3 times as fast on larger arrays (10000 - 1000000 bytes)
  12146. * compared to <code>sun.misc.Encoder()/Decoder()</code>.<br><br>
  12147. *
  12148. * On byte arrays the encoder is about 20% faster than Jakarta Commons Base64 Codec for encode and
  12149. * about 50% faster for decoding large arrays. This implementation is about twice as fast on very small
  12150. * arrays (&lt 30 bytes). If source/destination is a <code>String</code> this
  12151. * version is about three times as fast due to the fact that the Commons Codec result has to be recoded
  12152. * to a <code>String</code> from <code>byte[]</code>, which is very expensive.<br><br>
  12153. *
  12154. * This encode/decode algorithm doesn't create any temporary arrays as many other codecs do, it only
  12155. * allocates the resulting array. This produces less garbage and it is possible to handle arrays twice
  12156. * as large as algorithms that create a temporary array. (E.g. Jakarta Commons Codec). It is unknown
  12157. * whether Sun's <code>sun.misc.Encoder()/Decoder()</code> produce temporary arrays but since performance
  12158. * is quite low it probably does.<br><br>
  12159. *
  12160. * The encoder produces the same output as the Sun one except that the Sun's encoder appends
  12161. * a trailing line separator if the last character isn't a pad. Unclear why but it only adds to the
  12162. * length and is probably a side effect. Both are in conformance with RFC 2045 though.<br>
  12163. * Commons codec seem to always att a trailing line separator.<br><br>
  12164. *
  12165. * <b>Note!</b>
  12166. * The encode/decode method pairs (types) come in three versions with the <b>exact</b> same algorithm and
  12167. * thus a lot of code redundancy. This is to not create any temporary arrays for transcoding to/from different
  12168. * format types. The methods not used can simply be commented out.<br><br>
  12169. *
  12170. * There is also a "fast" version of all decode methods that works the same way as the normal ones, but
  12171. * har a few demands on the decoded input. Normally though, these fast verions should be used if the source if
  12172. * the input is known and it hasn't bee tampered with.<br><br>
  12173. *
  12174. * If you find the code useful or you find a bug, please send me a note at base64 @ miginfocom . com.
  12175. *
  12176. * Licence (BSD):
  12177. * ==============
  12178. *
  12179. * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (base64 @ miginfocom . com)
  12180. * All rights reserved.
  12181. *
  12182. * Redistribution and use in source and binary forms, with or without modification,
  12183. * are permitted provided that the following conditions are met:
  12184. * Redistributions of source code must retain the above copyright notice, this list
  12185. * of conditions and the following disclaimer.
  12186. * Redistributions in binary form must reproduce the above copyright notice, this
  12187. * list of conditions and the following disclaimer in the documentation and/or other
  12188. * materials provided with the distribution.
  12189. * Neither the name of the MiG InfoCom AB nor the names of its contributors may be
  12190. * used to endorse or promote products derived from this software without specific
  12191. * prior written permission.
  12192. *
  12193. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  12194. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  12195. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  12196. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  12197. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  12198. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  12199. * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  12200. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  12201. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
  12202. * OF SUCH DAMAGE.
  12203. *
  12204. * @version 2.2
  12205. * @author Mikael Grev
  12206. * Date: 2004-aug-02
  12207. * Time: 11:31:11
  12208. * @class
  12209. */
  12210. var mxBase64 = (function () {
  12211. function mxBase64() {
  12212. }
  12213. mxBase64.__static_initialize = function () { if (!mxBase64.__static_initialized) {
  12214. mxBase64.__static_initialized = true;
  12215. mxBase64.__static_initializer_0();
  12216. } };
  12217. mxBase64.CA_$LI$ = function () { mxBase64.__static_initialize(); if (mxBase64.CA == null)
  12218. mxBase64.CA = ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").split(''); return mxBase64.CA; };
  12219. ;
  12220. mxBase64.IA_$LI$ = function () { mxBase64.__static_initialize(); if (mxBase64.IA == null)
  12221. mxBase64.IA = (function (s) { var a = []; while (s-- > 0)
  12222. a.push(0); return a; })(256); return mxBase64.IA; };
  12223. ;
  12224. mxBase64.__static_initializer_0 = function () {
  12225. /* fill */ (function (a, v) { for (var i = 0; i < a.length; i++)
  12226. a[i] = v; })(mxBase64.IA_$LI$(), -1);
  12227. for (var i = 0, iS = mxBase64.CA_$LI$().length; i < iS; i++)
  12228. mxBase64.IA_$LI$()[(mxBase64.CA_$LI$()[i]).charCodeAt(0)] = i;
  12229. mxBase64.IA_$LI$()[('=').charCodeAt(0)] = 0;
  12230. };
  12231. /**
  12232. * Encodes a raw byte array into a BASE64 <code>char[]</code> representation i accordance with RFC 2045.
  12233. * @param {Array} sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
  12234. * @param {boolean} lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
  12235. * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
  12236. * little faster.
  12237. * @return {Array} A BASE64 encoded array. Never <code>null</code>.
  12238. */
  12239. mxBase64.encodeToChar = function (sArr, start, lineSep) {
  12240. var sLen = sArr != null ? sArr.length - start : 0;
  12241. if (sLen === 0)
  12242. return new Array(0);
  12243. var eLen = ((sLen / 3 | 0)) * 3;
  12244. var cCnt = (((sLen - 1) / 3 | 0) + 1) << 2;
  12245. var dLen = cCnt + (lineSep ? ((cCnt - 1) / 76 | 0) << 1 : 0);
  12246. var dArr = new Array(dLen);
  12247. for (var s = start, d = 0, cc = 0; s < eLen + start;) {
  12248. var i = (sArr[s++] & 255) << 16 | (sArr[s++] & 255) << 8 | (sArr[s++] & 255);
  12249. dArr[d++] = mxBase64.CA_$LI$()[(i >>> 18) & 63];
  12250. dArr[d++] = mxBase64.CA_$LI$()[(i >>> 12) & 63];
  12251. dArr[d++] = mxBase64.CA_$LI$()[(i >>> 6) & 63];
  12252. dArr[d++] = mxBase64.CA_$LI$()[i & 63];
  12253. if (lineSep && ++cc === 19 && d < dLen - 2) {
  12254. dArr[d++] = '\r';
  12255. dArr[d++] = '\n';
  12256. cc = 0;
  12257. }
  12258. }
  12259. ;
  12260. var left = sLen - eLen;
  12261. if (left > 0) {
  12262. var i = ((sArr[eLen + start] & 255) << 10) | (left === 2 ? ((sArr[sLen + start - 1] & 255) << 2) : 0);
  12263. dArr[dLen - 4] = mxBase64.CA_$LI$()[i >> 12];
  12264. dArr[dLen - 3] = mxBase64.CA_$LI$()[(i >>> 6) & 63];
  12265. dArr[dLen - 2] = left === 2 ? mxBase64.CA_$LI$()[i & 63] : '=';
  12266. dArr[dLen - 1] = '=';
  12267. }
  12268. return dArr;
  12269. };
  12270. mxBase64.decode$char_A = function (sArr) {
  12271. var sLen = sArr != null ? sArr.length : 0;
  12272. if (sLen === 0)
  12273. return [];
  12274. var sepCnt = 0;
  12275. for (var i = 0; i < sLen; i++)
  12276. if (mxBase64.IA_$LI$()[(sArr[i]).charCodeAt(0)] < 0)
  12277. sepCnt++;
  12278. ;
  12279. if ((sLen - sepCnt) % 4 !== 0)
  12280. return null;
  12281. var pad = 0;
  12282. for (var i = sLen; i > 1 && mxBase64.IA_$LI$()[(sArr[--i]).charCodeAt(0)] <= 0;)
  12283. if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(sArr[i]) == '='.charCodeAt(0))
  12284. pad++;
  12285. ;
  12286. var len = ((sLen - sepCnt) * 6 >> 3) - pad;
  12287. var dArr = (function (s) { var a = []; while (s-- > 0)
  12288. a.push(0); return a; })(len);
  12289. for (var s = 0, d = 0; d < len;) {
  12290. var i = 0;
  12291. for (var j = 0; j < 4; j++) {
  12292. var c = mxBase64.IA_$LI$()[(sArr[s++]).charCodeAt(0)];
  12293. if (c >= 0)
  12294. i |= c << (18 - j * 6);
  12295. else
  12296. j--;
  12297. }
  12298. ;
  12299. dArr[d++] = ((i >> 16) | 0);
  12300. if (d < len) {
  12301. dArr[d++] = ((i >> 8) | 0);
  12302. if (d < len)
  12303. dArr[d++] = (i | 0);
  12304. }
  12305. }
  12306. ;
  12307. return dArr;
  12308. };
  12309. /**
  12310. * Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with
  12311. * and without line separators.
  12312. * @param {Array} sArr The source array. <code>null</code> or length 0 will return an empty array.
  12313. * @return {Array} The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
  12314. * (including '=') isn't divideable by 4. (I.e. definitely corrupted).
  12315. */
  12316. mxBase64.decode = function (sArr) {
  12317. if (((sArr != null && sArr instanceof Array && (sArr.length == 0 || sArr[0] == null || (typeof sArr[0] === 'string'))) || sArr === null)) {
  12318. return com.mxgraph.online.mxBase64.decode$char_A(sArr);
  12319. }
  12320. else if (((sArr != null && sArr instanceof Array && (sArr.length == 0 || sArr[0] == null || (typeof sArr[0] === 'number'))) || sArr === null)) {
  12321. return com.mxgraph.online.mxBase64.decode$byte_A(sArr);
  12322. }
  12323. else if (((typeof sArr === 'string') || sArr === null)) {
  12324. return com.mxgraph.online.mxBase64.decode$java_lang_String(sArr);
  12325. }
  12326. else
  12327. throw new Error('invalid overload');
  12328. };
  12329. mxBase64.decodeFast$char_A = function (sArr) {
  12330. var sLen = sArr.length;
  12331. if (sLen === 0)
  12332. return [];
  12333. var sIx = 0;
  12334. var eIx = sLen - 1;
  12335. while ((sIx < eIx && mxBase64.IA_$LI$()[(sArr[sIx]).charCodeAt(0)] < 0))
  12336. sIx++;
  12337. while ((eIx > 0 && mxBase64.IA_$LI$()[(sArr[eIx]).charCodeAt(0)] < 0))
  12338. eIx--;
  12339. var pad = (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(sArr[eIx]) == '='.charCodeAt(0) ? ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(sArr[eIx - 1]) == '='.charCodeAt(0) ? 2 : 1) : 0;
  12340. var cCnt = eIx - sIx + 1;
  12341. var sepCnt = sLen > 76 ? ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(sArr[76]) == '\r'.charCodeAt(0) ? (cCnt / 78 | 0) : 0) << 1 : 0;
  12342. var len = ((cCnt - sepCnt) * 6 >> 3) - pad;
  12343. var dArr = (function (s) { var a = []; while (s-- > 0)
  12344. a.push(0); return a; })(len);
  12345. var d = 0;
  12346. for (var cc = 0, eLen = ((len / 3 | 0)) * 3; d < eLen;) {
  12347. var i = mxBase64.IA_$LI$()[(sArr[sIx++]).charCodeAt(0)] << 18 | mxBase64.IA_$LI$()[(sArr[sIx++]).charCodeAt(0)] << 12 | mxBase64.IA_$LI$()[(sArr[sIx++]).charCodeAt(0)] << 6 | mxBase64.IA_$LI$()[(sArr[sIx++]).charCodeAt(0)];
  12348. dArr[d++] = ((i >> 16) | 0);
  12349. dArr[d++] = ((i >> 8) | 0);
  12350. dArr[d++] = (i | 0);
  12351. if (sepCnt > 0 && ++cc === 19) {
  12352. sIx += 2;
  12353. cc = 0;
  12354. }
  12355. }
  12356. ;
  12357. if (d < len) {
  12358. var i = 0;
  12359. for (var j = 0; sIx <= eIx - pad; j++)
  12360. i |= mxBase64.IA_$LI$()[(sArr[sIx++]).charCodeAt(0)] << (18 - j * 6);
  12361. for (var r = 16; d < len; r -= 8)
  12362. dArr[d++] = ((i >> r) | 0);
  12363. }
  12364. return dArr;
  12365. };
  12366. /**
  12367. * Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as
  12368. * fast as {@link #decode(char[])}. The preconditions are:<br>
  12369. * + The array must have a line length of 76 chars OR no line separators at all (one line).<br>
  12370. * + Line separator must be "\r\n", as specified in RFC 2045
  12371. * + The array must not contain illegal characters within the encoded string<br>
  12372. * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
  12373. * @param {Array} sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
  12374. * @return {Array} The decoded array of bytes. May be of length 0.
  12375. */
  12376. mxBase64.decodeFast = function (sArr) {
  12377. if (((sArr != null && sArr instanceof Array && (sArr.length == 0 || sArr[0] == null || (typeof sArr[0] === 'string'))) || sArr === null)) {
  12378. return com.mxgraph.online.mxBase64.decodeFast$char_A(sArr);
  12379. }
  12380. else if (((sArr != null && sArr instanceof Array && (sArr.length == 0 || sArr[0] == null || (typeof sArr[0] === 'number'))) || sArr === null)) {
  12381. return com.mxgraph.online.mxBase64.decodeFast$byte_A(sArr);
  12382. }
  12383. else if (((typeof sArr === 'string') || sArr === null)) {
  12384. return com.mxgraph.online.mxBase64.decodeFast$java_lang_String(sArr);
  12385. }
  12386. else
  12387. throw new Error('invalid overload');
  12388. };
  12389. /**
  12390. * Encodes a raw byte array into a BASE64 <code>byte[]</code> representation i accordance with RFC 2045.
  12391. * @param {Array} sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
  12392. * @param {boolean} lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
  12393. * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
  12394. * little faster.
  12395. * @return {Array} A BASE64 encoded array. Never <code>null</code>.
  12396. */
  12397. mxBase64.encodeToByte = function (sArr, lineSep) {
  12398. var sLen = sArr != null ? sArr.length : 0;
  12399. if (sLen === 0)
  12400. return [];
  12401. var eLen = ((sLen / 3 | 0)) * 3;
  12402. var cCnt = (((sLen - 1) / 3 | 0) + 1) << 2;
  12403. var dLen = cCnt + (lineSep ? ((cCnt - 1) / 76 | 0) << 1 : 0);
  12404. var dArr = (function (s) { var a = []; while (s-- > 0)
  12405. a.push(0); return a; })(dLen);
  12406. for (var s = 0, d = 0, cc = 0; s < eLen;) {
  12407. var i = (sArr[s++] & 255) << 16 | (sArr[s++] & 255) << 8 | (sArr[s++] & 255);
  12408. dArr[d++] = (mxBase64.CA_$LI$()[(i >>> 18) & 63]).charCodeAt(0);
  12409. dArr[d++] = (mxBase64.CA_$LI$()[(i >>> 12) & 63]).charCodeAt(0);
  12410. dArr[d++] = (mxBase64.CA_$LI$()[(i >>> 6) & 63]).charCodeAt(0);
  12411. dArr[d++] = (mxBase64.CA_$LI$()[i & 63]).charCodeAt(0);
  12412. if (lineSep && ++cc === 19 && d < dLen - 2) {
  12413. dArr[d++] = ('\r').charCodeAt(0);
  12414. dArr[d++] = ('\n').charCodeAt(0);
  12415. cc = 0;
  12416. }
  12417. }
  12418. ;
  12419. var left = sLen - eLen;
  12420. if (left > 0) {
  12421. var i = ((sArr[eLen] & 255) << 10) | (left === 2 ? ((sArr[sLen - 1] & 255) << 2) : 0);
  12422. dArr[dLen - 4] = (mxBase64.CA_$LI$()[i >> 12]).charCodeAt(0);
  12423. dArr[dLen - 3] = (mxBase64.CA_$LI$()[(i >>> 6) & 63]).charCodeAt(0);
  12424. dArr[dLen - 2] = left === 2 ? (mxBase64.CA_$LI$()[i & 63]).charCodeAt(0) : ('=').charCodeAt(0);
  12425. dArr[dLen - 1] = ('=').charCodeAt(0);
  12426. }
  12427. return dArr;
  12428. };
  12429. mxBase64.decode$byte_A = function (sArr) {
  12430. var sLen = sArr.length;
  12431. var sepCnt = 0;
  12432. for (var i = 0; i < sLen; i++)
  12433. if (mxBase64.IA_$LI$()[sArr[i] & 255] < 0)
  12434. sepCnt++;
  12435. ;
  12436. if ((sLen - sepCnt) % 4 !== 0)
  12437. return null;
  12438. var pad = 0;
  12439. for (var i = sLen; i > 1 && mxBase64.IA_$LI$()[sArr[--i] & 255] <= 0;)
  12440. if (sArr[i] == '='.charCodeAt(0))
  12441. pad++;
  12442. ;
  12443. var len = ((sLen - sepCnt) * 6 >> 3) - pad;
  12444. var dArr = (function (s) { var a = []; while (s-- > 0)
  12445. a.push(0); return a; })(len);
  12446. for (var s = 0, d = 0; d < len;) {
  12447. var i = 0;
  12448. for (var j = 0; j < 4; j++) {
  12449. var c = mxBase64.IA_$LI$()[sArr[s++] & 255];
  12450. if (c >= 0)
  12451. i |= c << (18 - j * 6);
  12452. else
  12453. j--;
  12454. }
  12455. ;
  12456. dArr[d++] = ((i >> 16) | 0);
  12457. if (d < len) {
  12458. dArr[d++] = ((i >> 8) | 0);
  12459. if (d < len)
  12460. dArr[d++] = (i | 0);
  12461. }
  12462. }
  12463. ;
  12464. return dArr;
  12465. };
  12466. mxBase64.decodeFast$byte_A = function (sArr) {
  12467. var sLen = sArr.length;
  12468. if (sLen === 0)
  12469. return [];
  12470. var sIx = 0;
  12471. var eIx = sLen - 1;
  12472. while ((sIx < eIx && mxBase64.IA_$LI$()[sArr[sIx] & 255] < 0))
  12473. sIx++;
  12474. while ((eIx > 0 && mxBase64.IA_$LI$()[sArr[eIx] & 255] < 0))
  12475. eIx--;
  12476. var pad = sArr[eIx] == '='.charCodeAt(0) ? (sArr[eIx - 1] == '='.charCodeAt(0) ? 2 : 1) : 0;
  12477. var cCnt = eIx - sIx + 1;
  12478. var sepCnt = sLen > 76 ? (sArr[76] == '\r'.charCodeAt(0) ? (cCnt / 78 | 0) : 0) << 1 : 0;
  12479. var len = ((cCnt - sepCnt) * 6 >> 3) - pad;
  12480. var dArr = (function (s) { var a = []; while (s-- > 0)
  12481. a.push(0); return a; })(len);
  12482. var d = 0;
  12483. for (var cc = 0, eLen = ((len / 3 | 0)) * 3; d < eLen;) {
  12484. var i = mxBase64.IA_$LI$()[sArr[sIx++]] << 18 | mxBase64.IA_$LI$()[sArr[sIx++]] << 12 | mxBase64.IA_$LI$()[sArr[sIx++]] << 6 | mxBase64.IA_$LI$()[sArr[sIx++]];
  12485. dArr[d++] = ((i >> 16) | 0);
  12486. dArr[d++] = ((i >> 8) | 0);
  12487. dArr[d++] = (i | 0);
  12488. if (sepCnt > 0 && ++cc === 19) {
  12489. sIx += 2;
  12490. cc = 0;
  12491. }
  12492. }
  12493. ;
  12494. if (d < len) {
  12495. var i = 0;
  12496. for (var j = 0; sIx <= eIx - pad; j++)
  12497. i |= mxBase64.IA_$LI$()[sArr[sIx++]] << (18 - j * 6);
  12498. for (var r = 16; d < len; r -= 8)
  12499. dArr[d++] = ((i >> r) | 0);
  12500. }
  12501. return dArr;
  12502. };
  12503. /**
  12504. * Encodes a raw byte array into a BASE64 <code>String</code> representation i accordance with RFC 2045.
  12505. * @param {Array} sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.
  12506. * @param {boolean} lineSep Optional "\r\n" after 76 characters, unless end of file.<br>
  12507. * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
  12508. * little faster.
  12509. * @return {string} A BASE64 encoded array. Never <code>null</code>.
  12510. */
  12511. mxBase64.encodeToString = function (sArr, start, lineSep) {
  12512. return mxBase64.encodeToChar(sArr, start, lineSep).join('');
  12513. };
  12514. mxBase64.decode$java_lang_String = function (str) {
  12515. var sLen = str != null ? str.length : 0;
  12516. if (sLen === 0)
  12517. return [];
  12518. var sepCnt = 0;
  12519. for (var i = 0; i < sLen; i++)
  12520. if (mxBase64.IA_$LI$()[(str.charAt(i)).charCodeAt(0)] < 0)
  12521. sepCnt++;
  12522. ;
  12523. if ((sLen - sepCnt) % 4 !== 0)
  12524. return null;
  12525. var pad = 0;
  12526. for (var i = sLen; i > 1 && mxBase64.IA_$LI$()[(str.charAt(--i)).charCodeAt(0)] <= 0;)
  12527. if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(str.charAt(i)) == '='.charCodeAt(0))
  12528. pad++;
  12529. ;
  12530. var len = ((sLen - sepCnt) * 6 >> 3) - pad;
  12531. var dArr = (function (s) { var a = []; while (s-- > 0)
  12532. a.push(0); return a; })(len);
  12533. for (var s = 0, d = 0; d < len;) {
  12534. var i = 0;
  12535. for (var j = 0; j < 4; j++) {
  12536. var c = mxBase64.IA_$LI$()[(str.charAt(s++)).charCodeAt(0)];
  12537. if (c >= 0)
  12538. i |= c << (18 - j * 6);
  12539. else
  12540. j--;
  12541. }
  12542. ;
  12543. dArr[d++] = ((i >> 16) | 0);
  12544. if (d < len) {
  12545. dArr[d++] = ((i >> 8) | 0);
  12546. if (d < len)
  12547. dArr[d++] = (i | 0);
  12548. }
  12549. }
  12550. ;
  12551. return dArr;
  12552. };
  12553. mxBase64.decodeFast$java_lang_String = function (s) {
  12554. var sLen = s.length;
  12555. if (sLen === 0)
  12556. return [];
  12557. var sIx = 0;
  12558. var eIx = sLen - 1;
  12559. while ((sIx < eIx && mxBase64.IA_$LI$()[(function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(sIx)) & 255] < 0))
  12560. sIx++;
  12561. while ((eIx > 0 && mxBase64.IA_$LI$()[(function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(eIx)) & 255] < 0))
  12562. eIx--;
  12563. var pad = (function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(eIx)) == '='.charCodeAt(0) ? ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(eIx - 1)) == '='.charCodeAt(0) ? 2 : 1) : 0;
  12564. var cCnt = eIx - sIx + 1;
  12565. var sepCnt = sLen > 76 ? ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(76)) == '\r'.charCodeAt(0) ? (cCnt / 78 | 0) : 0) << 1 : 0;
  12566. var len = ((cCnt - sepCnt) * 6 >> 3) - pad;
  12567. var dArr = (function (s) { var a = []; while (s-- > 0)
  12568. a.push(0); return a; })(len);
  12569. var d = 0;
  12570. for (var cc = 0, eLen = ((len / 3 | 0)) * 3; d < eLen;) {
  12571. var i = mxBase64.IA_$LI$()[(s.charAt(sIx++)).charCodeAt(0)] << 18 | mxBase64.IA_$LI$()[(s.charAt(sIx++)).charCodeAt(0)] << 12 | mxBase64.IA_$LI$()[(s.charAt(sIx++)).charCodeAt(0)] << 6 | mxBase64.IA_$LI$()[(s.charAt(sIx++)).charCodeAt(0)];
  12572. dArr[d++] = ((i >> 16) | 0);
  12573. dArr[d++] = ((i >> 8) | 0);
  12574. dArr[d++] = (i | 0);
  12575. if (sepCnt > 0 && ++cc === 19) {
  12576. sIx += 2;
  12577. cc = 0;
  12578. }
  12579. }
  12580. ;
  12581. if (d < len) {
  12582. var i = 0;
  12583. for (var j = 0; sIx <= eIx - pad; j++)
  12584. i |= mxBase64.IA_$LI$()[(s.charAt(sIx++)).charCodeAt(0)] << (18 - j * 6);
  12585. for (var r = 16; d < len; r -= 8)
  12586. dArr[d++] = ((i >> r) | 0);
  12587. }
  12588. return dArr;
  12589. };
  12590. return mxBase64;
  12591. }());
  12592. mxBase64.__static_initialized = false;
  12593. online.mxBase64 = mxBase64;
  12594. mxBase64["__class"] = "com.mxgraph.online.mxBase64";
  12595. })(online = mxgraph.online || (mxgraph.online = {}));
  12596. })(mxgraph = com.mxgraph || (com.mxgraph = {}));
  12597. })(com || (com = {}));
  12598. com.mxgraph.online.mxBase64.IA_$LI$();
  12599. com.mxgraph.online.mxBase64.CA_$LI$();
  12600. com.mxgraph.online.mxBase64.__static_initialize();
  12601. com.mxgraph.io.vsdx.VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER_$LI$();
  12602. com.mxgraph.io.vsdx.VsdxShape.arrowTypes_$LI$();
  12603. com.mxgraph.io.vsdx.VsdxShape.arrowSizes_$LI$();
  12604. com.mxgraph.io.vsdx.VsdxShape.OFFSET_ARRAY_$LI$();
  12605. com.mxgraph.io.vsdx.VsdxShape.__static_initialize();
  12606. com.mxgraph.io.vsdx.Shape.UNICODE_LINE_SEP_$LI$();
  12607. com.mxgraph.io.vsdx.Style.lineDashPatterns_$LI$();
  12608. com.mxgraph.io.vsdx.Style.styleTypes_$LI$();
  12609. com.mxgraph.io.vsdx.Style.__static_initialize();
  12610. com.mxgraph.online.Constants.MAX_AREA_$LI$();
  12611. com.mxgraph.io.vsdx.theme.Color.NONE_$LI$();
  12612. com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$();
  12613. com.mxgraph.io.vsdx.mxVsdxTheme.colorIds_$LI$();
  12614. com.mxgraph.io.vsdx.mxVsdxTheme.themesIds_$LI$();
  12615. com.mxgraph.io.vsdx.mxVsdxTheme.__static_initialize();
  12616. com.mxgraph.io.vsdx.mxVsdxConstants.MY_SET_$LI$();
  12617. com.mxgraph.io.vsdx.mxVsdxConstants.SET_VALUES_$LI$();
  12618. com.mxgraph.io.vsdx.mxPropertiesManager.defaultColors_$LI$();
  12619. com.mxgraph.io.vsdx.mxPropertiesManager.__static_initialize();
  12620. com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder_$LI$();
  12621. com.mxgraph.io.mxVsdxCodec.parsererrorNS_$LI$();
  12622. EditorUi.prototype.doImportVisio = function(file, done, onerror, filename)
  12623. {
  12624. filename = filename || file.name;
  12625. if (filename != null && /(\.vs(x|sx?))($|\?)/i.test(filename))
  12626. {
  12627. new com.mxgraph.io.mxVssxCodec(this).decodeVssx(file, done, null, onerror);
  12628. }
  12629. else
  12630. {
  12631. new com.mxgraph.io.mxVsdxCodec(this).decodeVsdx(file, done, null, onerror);
  12632. }
  12633. };