1var __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 */ 7var 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 /** 25 * Stores the vertexes imported. 26 */ 27 this.vertexMap = ({}); 28 /** 29 * Stores the shapes that represent Edges. 30 */ 31 this.edgeShapeMap = ({}); 32 /** 33 * Stores the shapes that represent Vertexes. 34 */ 35 this.vertexShapeMap = ({}); 36 /** 37 * Stores the parents of the shapes imported. 38 */ 39 this.parentsMap = ({}); 40 41 this.layersMap = ({}); 42 /** 43 * Set to true if you want to display spline debug data 44 */ 45 this.debugPaths = false; 46 this.vsdxModel = null; 47 this.editorUi = editorUi; 48 this.shapeIndexShift = 0; 49 } 50 mxVsdxCodec.vsdxPlaceholder_$LI$ = function () 51 { 52 if (mxVsdxCodec.vsdxPlaceholder == null) 53 { 54 var tmp = "dmlzaW8="; 55 mxVsdxCodec.vsdxPlaceholder = (window.atob) ? atob(tmp) : Base64.decode(tmp, true); 56 } 57 58 return mxVsdxCodec.vsdxPlaceholder; 59 }; 60 61 mxVsdxCodec.parsererrorNS_$LI$ = function () 62 { 63 mxVsdxCodec.parsererrorNS = mxConstants.NS_XHTML; 64 65// if (mxVsdxCodec.parsererrorNS == null) 66// { 67// mxVsdxCodec.parsererrorNS = ""; 68// 69// if (window.DOMParser) 70// { 71// var parser = new DOMParser(); 72// 73// try 74// { 75// mxVsdxCodec.parsererrorNS = parser.parseFromString('<', 'text/xml').getElementsByTagName("parsererror")[0].namespaceURI; 76// } 77// catch(e) 78// { 79// //ignore! IE11 throw an exception on XML syntax error 80// } 81// } 82// } 83 84 return mxVsdxCodec.parsererrorNS; 85 }; 86 87 mxVsdxCodec.parseXml = function (xml) 88 { 89 try 90 { 91 var doc = mxUtils.parseXml(xml); 92 93 if (doc.getElementsByTagNameNS(mxVsdxCodec.parsererrorNS, 'parsererror').length > 0) 94 { 95 return null; 96 } 97 else 98 { 99 return doc; 100 } 101 } 102 catch (e) 103 { 104 //IE11 throw an exception on XML syntax error 105 return null; 106 } 107 }; 108 109 //TODO Optimize this function 110 mxVsdxCodec.decodeUTF16LE = function ( binaryStr ) 111 { 112 var cp = ""; 113 for( var i = 0; i < binaryStr.length; i+=2) 114 { 115 cp += String.fromCharCode( 116 binaryStr.charCodeAt(i) | 117 ( binaryStr.charCodeAt(i+1) << 8 ) 118 ); 119 } 120 121 return cp ; 122 } 123 124 mxVsdxCodec.prototype.scaleGraph = function(graph, scale) 125 { 126 if (scale !== 1) { 127 var model = graph.getModel(); 128 { 129 for (var id in model.cells) { 130 var c = model.cells[id]; 131 { 132 var geo = model.getGeometry(c); 133 if (geo != null) { 134 this.scaleRect(geo, scale); 135 this.scaleRect(geo.alternateBounds, scale); 136 if (model.isEdge(c)) { 137 this.scalePoint(geo.sourcePoint, scale); 138 this.scalePoint(geo.targetPoint, scale); 139 this.scalePoint(geo.offset, scale); 140 var points = geo.points; 141 if (points != null) { 142 for (var index125 = 0; index125 < points.length; index125++) { 143 var p = points[index125]; 144 { 145 this.scalePoint(p, scale); 146 } 147 } 148 } 149 } 150 } 151 } 152 } 153 } 154 } 155 }; 156 157 mxVsdxCodec.incorrectXMLReqExp = [ 158 { 159 regExp: /\&(?!amp;|lt;|gt;|quot;|#)/g, 160 repl: '&' 161 } 162 ]; 163 164 /** 165 * Parses the input VSDX format and uses the information to populate 166 * the specified graph. 167 * @param docs All XML documents contained in the VSDX source file 168 * @throws IOException 169 * @throws ParserConfigurationException 170 * @throws SAXException 171 * @throws TransformerException 172 * @param {Array} data 173 * @param {string} charset 174 * @return {string} 175 */ 176 //FIXME TODO add charset support 177 mxVsdxCodec.prototype.decodeVsdx = function (file, callback, charset, onerror) { 178 var _this = this; 179 var docData = ({}); 180 var mediaData = ({}); 181 182 var allDone = function () 183 { 184 var path = mxVsdxCodec.vsdxPlaceholder + "/document.xml"; 185 var rootDoc = (function (m, k) { return m[k] ? m[k] : null; })(docData, path); 186 var rootChild = rootDoc.firstChild; 187 while (rootChild != null && !(rootChild.nodeType == 1)) { 188 rootChild = rootChild.nextSibling; 189 } 190 ; 191 if (rootChild != null && (rootChild.nodeType == 1)) { 192 _this.importNodes(rootDoc, rootChild, path, docData); 193 } 194 else { 195 return null; 196 } 197 _this.vsdxModel = new com.mxgraph.io.vsdx.mxVsdxModel(rootDoc, docData, mediaData); 198 var pages = _this.vsdxModel.getPages(); 199 var xmlBuilder = { str: _this.RESPONSE_HEADER, toString: function () { return this.str; } }; 200 { 201 var array122 = (function (m) { if (m.entries == null) 202 m.entries = []; return m.entries; })(pages); 203 var _loop_1 = function (index121, remaining) { 204 var entry = array122[index121]; 205 { 206 var page_1 = entry.getValue(); 207 //As per many requests, include all pages in the output 208 //if (!page_1.isBackground()) 209 { 210 var graph_1 = this_1.createMxGraph(); 211 graph_1.getModel().beginUpdate(); 212 this_1.importPage(page_1, graph_1, graph_1.getDefaultParent(), true); 213 this_1.scaleGraph(graph_1, page_1.getPageScale() / page_1.getDrawingScale()); 214 graph_1.getModel().endUpdate(); 215 216 this_1.postImportPage(page_1, graph_1, function() 217 { 218 this_1.sanitiseGraph(graph_1); 219 /* append */ (function (sb) { return sb.str = sb.str.concat(_this.RESPONSE_DIAGRAM_START); })(xmlBuilder); 220 /* append */ (function (sb) { return sb.str = sb.str.concat(_this.processPage(graph_1, page_1)); })(xmlBuilder); 221 /* append */ (function (sb) { return sb.str = sb.str.concat(_this.RESPONSE_DIAGRAM_END); })(xmlBuilder); 222 223 if (index121 < array122.length - 1) 224 { 225 _loop_1(index121 + 1, remaining); 226 } 227 else 228 { 229 remaining(); 230 } 231 }); 232 } 233 } 234 }; 235 var this_1 = _this; 236 237 if (array122.length > 0) 238 { 239 _loop_1(0, remaining); 240 } 241 else 242 { 243 remaining(); 244 } 245 } 246 247 function remaining() 248 { 249 /* append */ (function (sb) { return sb.str = sb.str.concat(_this.RESPONSE_END); })(xmlBuilder); 250 var dateAfter = new Date(); 251 //console.log("File processed in " + (dateAfter - dateBefore) + "ms"); 252 //console.log(xmlBuilder.str); 253 if (callback) 254 { 255 callback(xmlBuilder.str); 256 } 257 } 258 }; 259 260 var dateBefore = new Date(); 261 var filesCount = 0; 262 var processedFiles = 0; 263 264 var doneCheck = function() 265 { 266 if (processedFiles == filesCount) 267 { 268 var dateAfter = new Date(); 269 //console.log(processedFiles + " File extracted in " + (dateAfter - dateBefore) + "ms"); 270 try 271 { 272 allDone(); 273 } 274 catch(e) 275 { 276 console.log(e); 277 278 if (onerror != null) 279 { 280 onerror(e); 281 } 282 else 283 { 284 callback(""); 285 } 286 } 287 288 } 289 }; 290 291 JSZip.loadAsync(file) 292 .then(function(zip) 293 { 294 if (Object.keys(zip.files).length == 0) 295 { 296 if (onerror != null) 297 { 298 onerror(); 299 } 300 } 301 else 302 { 303 var dateAfter = new Date(); 304 //console.log(" (loaded in " + (dateAfter - dateBefore) + "ms)"); 305 306 zip.forEach(function (relativePath, zipEntry) 307 { 308 var filename = zipEntry.name; 309 var name = filename.toLowerCase(); 310 var nameLen = name.length; 311 if (name.indexOf('.xml') == nameLen - 4 || name.indexOf('.rels') == nameLen - 5) //xml files 312 { 313 filesCount++; 314 zipEntry.async("string").then(function (str) 315 { 316 if (!(str.length === 0)) { 317 //UTF-8 BOM causes exception while parsing, so remove it 318 //TODO is the text encoding will be correct or string must be re-read as UTF-8? 319 if (str.charCodeAt(0) == 65279) 320 { 321 str = str.substring(1); 322 } 323 324 var doc = mxVsdxCodec.parseXml(str); 325 326 if (doc == null) 327 { 328 if (str.charCodeAt(1) === 0 && str.charCodeAt(3) === 0 && str.charCodeAt(5) === 0) 329 { 330 doc = mxVsdxCodec.parseXml(mxVsdxCodec.decodeUTF16LE(str)); 331 } 332 else 333 { 334 for (var r = 0; r < mxVsdxCodec.incorrectXMLReqExp.length; r++) 335 { 336 if (mxVsdxCodec.incorrectXMLReqExp[r].regExp.test(str)) 337 { 338 str = str.replace(mxVsdxCodec.incorrectXMLReqExp[r].regExp, mxVsdxCodec.incorrectXMLReqExp[r].repl); 339 } 340 } 341 342 doc = mxVsdxCodec.parseXml(str); 343 } 344 //TODO add any other non-standard encoding that may be needed 345 } 346 347 if (doc != null) 348 { 349 doc.vsdxFileName = filename; 350 /* put */ (docData[filename] = doc); 351 } 352 } 353 processedFiles++; 354 355 doneCheck(); 356 }); 357 } 358 else if (name.indexOf(mxVsdxCodec.vsdxPlaceholder + "/media") === 0)//binary files 359 { 360 filesCount++; 361 if ((function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(name, ".emf")) 362 { 363 var emfDone = function() 364 { 365 processedFiles++; 366 367 doneCheck(); 368 } 369 370 if (JSZip.support.blob && window.EMF_CONVERT_URL) 371 { 372 zipEntry.async("blob").then(function (emfBlob) 373 { 374 //send to emf conversion service 375 var formData = new FormData(); 376 formData.append('img', emfBlob, name); 377 formData.append('inputformat', 'emf'); 378 formData.append('outputformat', 'png'); 379 380 var xhr = new XMLHttpRequest(); 381 xhr.open('POST', EMF_CONVERT_URL); 382 xhr.responseType = 'blob'; 383 _this.editorUi.addRemoteServiceSecurityCheck(xhr); 384 385 xhr.onreadystatechange = mxUtils.bind(this, function() 386 { 387 if (xhr.readyState == 4) 388 { 389 if (xhr.status >= 200 && xhr.status <= 299) 390 { 391 try 392 { 393 var reader = new FileReader(); 394 reader.readAsDataURL(xhr.response); 395 reader.onloadend = function() 396 { 397 var dataPos = reader.result.indexOf(',') + 1; 398 mediaData[filename] = reader.result.substr(dataPos); 399 emfDone(); 400 } 401 } 402 catch (e) 403 { 404 console.log(e); 405 emfDone(); 406 } 407 } 408 else 409 { 410 emfDone(); 411 } 412 } 413 }); 414 415 xhr.send(formData); 416 }); 417 } 418 else 419 { 420 emfDone(); 421 } 422 } 423 else if ((function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(name, ".bmp")) { 424 if (JSZip.support.uint8array) 425 { 426 zipEntry.async("uint8array").then(function (bmpData) 427 { 428 var bitmap = new BmpDecoder(bmpData); 429 430 var c = document.createElement("canvas"); 431 c.width = bitmap.width; 432 c.height = bitmap.height; 433 var ctx = c.getContext("2d"); 434 ctx.putImageData(bitmap.imageData, 0, 0); 435 var jpgData = c.toDataURL("image/jpeg"); 436 /* put */ (mediaData[filename] = jpgData.substr(23)); //23 is the length of "data:image/jpeg;base64," 437 438 processedFiles++; 439 doneCheck(); 440 }); 441 } 442 } 443 else 444 { 445 zipEntry.async("base64").then(function (base64Str) 446 { 447 // if ((function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(name, ".bmp")) { 448 // try 449 // { 450 // //convert BMP files to PNG 451 // var bmpImg = new Image(); 452 // 453 // bmpImg.onload = function() { 454 // var c = document.createElement("canvas"); 455 // c.width = bmpImg.width; 456 // c.height = bmpImg.height; 457 // var ctx = c.getContext("2d"); 458 // ctx.drawImage(bmpImg, 0, 0); 459 // var jpgData = c.toDataURL("image/jpeg"); 460 // 461 // /* put */ (mediaData[filename] = jpgData.substr(23)); //23 is the length of "data:image/jpeg;base64," 462 // 463 // processedFiles++; 464 // doneCheck(); 465 // }; 466 // 467 // bmpImg.src = "data:image/bmp;base64," + base64Str; 468 // } 469 // catch (e) {} //conversion failed. Nothing can be done! 470 // } 471 // else 472 // { 473 /* put */ (mediaData[filename] = base64Str); 474 475 processedFiles++; 476 doneCheck(); 477 // } 478 }); 479 } 480 } 481 }); 482 } 483 }, function (e) { 484 //console.log("Error!" + e.message); 485 if (onerror != null) 486 { 487 onerror(e); 488 } 489 }); 490 }; 491 mxVsdxCodec.prototype.createMxGraph = function () { 492 var graph = new Graph(); 493 graph.setExtendParents(false); 494 graph.setExtendParentsOnAdd(false); 495 graph.setConstrainChildren(false); 496 graph.setHtmlLabels(true); 497 graph.getModel().maintainEdgeParent = false; 498 return graph; 499 }; 500 mxVsdxCodec.prototype.processPage = function (graph, page) { 501 var codec = new mxCodec(); 502 var node = codec.encode(graph.getModel()); 503 node.setAttribute("style", "default-style2"); 504 var modelString = mxUtils.getXml(node); 505 506 var output = ""; 507 if (page != null) { 508 //var pageName_1 = org.apache.commons.lang3.StringEscapeUtils.escapeXml11(page.getPageName()); 509 //TODO FIXME htmlEntities is not exactly as escapeXml11 but close 510 var pageName_1 = mxUtils.htmlEntities(page.getPageName()) + (page.isBackground()? ' (Background)' : ''); 511 output += '<diagram name="' + pageName_1 + '" id="' + pageName_1.replace(/\s/g, '_') + '">'; 512 } 513 514 output += Graph.compress(modelString); 515 return output; 516 }; 517 /** 518 * Scale a point in place 519 * 520 * @param {mxPoint} p point to scale in place 521 * @param {number} scale scale 522 * @return {mxPoint} scaled point 523 * @private 524 */ 525 /*private*/ mxVsdxCodec.prototype.scalePoint = function (p, scale) { 526 if (p != null) { 527 p.x = (p.x * scale); 528 p.y = (p.y * scale); 529 } 530 return p; 531 }; 532 /** 533 * Scale a rectangle in place 534 * 535 * @param {mxRectangle} rect rectangle to scale in place 536 * @param {number} scale scale 537 * @return {mxRectangle} scaled rectangle 538 * @private 539 */ 540 /*private*/ mxVsdxCodec.prototype.scaleRect = function (rect, scale) { 541 if (rect != null) { 542 rect.x = (rect.x * scale); 543 rect.y = (rect.y * scale); 544 rect.height = (rect.height * scale); 545 rect.width = (rect.width * scale); 546 } 547 return rect; 548 }; 549 /** 550 * 551 * @param {*} rootDoc 552 * @param {*} currentNode 553 * @param {string} path 554 * @param {*} docData 555 * @private 556 */ 557 /*private*/ mxVsdxCodec.prototype.importNodes = function (rootDoc, currentNode, path, docData) { 558 var lastSlash = path.lastIndexOf("/"); 559 var dir = path; 560 var fileName = path; 561 if (lastSlash !== -1) { 562 dir = path.substring(0, lastSlash); 563 fileName = path.substring(lastSlash + 1, path.length); 564 } 565 else { 566 return; 567 } 568 var relsPath = dir + "/_rels/" + fileName + ".rels"; 569 var relsDoc = (function (m, k) { return m[k] ? m[k] : null; })(docData, relsPath); 570 if (relsDoc == null) { 571 return; 572 } 573 var rels = relsDoc.getElementsByTagName("Relationship"); 574 var relMap = ({}); 575 for (var i = 0; i < rels.length; i++) { 576 var currElem = rels.item(i); 577 var id = currElem.getAttribute("Id"); 578 var target = currElem.getAttribute("Target"); 579 /* put */ (relMap[id] = target); 580 } 581 ; 582 var relList = currentNode.getElementsByTagName("Rel"); 583 for (var i = 0; i < relList.length; i++) { 584 var rel = relList.item(i); 585 var pathSuffix = (function (m, k) { return m[k] ? m[k] : null; })(relMap, rel.getAttribute("r:id")); 586 var target = dir + "/" + pathSuffix; 587 if (target != null) { 588 var childDoc = (function (m, k) { return m[k] ? m[k] : null; })(docData, target); 589 if (childDoc != null) { 590 var parent_1 = rel.parentNode; 591 var rootChild = childDoc.firstChild; 592 while (rootChild != null && !(rootChild.nodeType == 1)) { 593 rootChild = rootChild.nextSibling; 594 } 595 ; 596 if (rootChild != null && (rootChild.nodeType == 1)) { 597 var importNode = rootChild.firstChild; 598 while ((importNode != null)) { 599 if (importNode != null && importNode.nodeType == 1) { 600 var newNode = parent_1.appendChild(rootDoc.importNode(importNode, true)); 601 var pathTmp = target; 602 this.importNodes(rootDoc, newNode, pathTmp, docData); 603 } 604 importNode = importNode.nextSibling; 605 } 606 ; 607 } 608 } 609 } 610 } 611 ; 612 }; 613 /** 614 * Imports a page of the document with the actual pageHeight.<br/> 615 * In .vdx, the Y-coordinate grows upward from the bottom of the page.<br/> 616 * The page height is used for calculating the correct position in mxGraph using 617 * this formula: mxGraph_Y_Coord = PageHeight - VSDX_Y_Coord. 618 * @param {com.mxgraph.io.vsdx.mxVsdxPage} page Actual page Element to be imported 619 * @param {mxGraph} graph Graph where the parsed graph is included. 620 * @param {*} parent The parent of the elements to be imported. 621 * @return {number} 622 */ 623 mxVsdxCodec.prototype.importPage = function (page, graph, parent, noSanitize) 624 { 625 //BackPages can include another backPage, so it is recursive 626 var backPage = page.getBackPage(); 627 628 if (backPage != null) 629 { 630 graph.getModel().setValue(graph.getDefaultParent(), page.getPageName()); 631 var backCell = new mxCell(backPage.getPageName()); 632 graph.addCell(backCell, graph.getModel().getRoot(), 0, null, null); 633 this.importPage(backPage, graph, graph.getDefaultParent()); 634 } 635 636 //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 637 // This cannot be done in draw.io currently 638 // Also, layers should NOT affect cells order. So, as a best effort solution, layers should be orders such that the cells order is maintained 639 640 //add page layers 641 var layers = page.getLayers(); 642 this.layersMap[0] = graph.getDefaultParent(); 643 var layersOrder = {}, lastOrder = 0, lastLayer = null; 644 var shapes = page.getShapes(); 645 646 try 647 { 648 //Trying to determine layers order 649 for (var k = 0; shapes.entries != null && k < shapes.entries.length; k++) 650 { 651 var layer = shapes.entries[k].getValue().layerMember; 652 653 if (layer != null) 654 { 655 if (lastLayer == null) 656 { 657 layersOrder[layer] = lastOrder; 658 lastLayer = layer; 659 } 660 else if (lastLayer != layer && layersOrder[layer] == null) 661 { 662 lastOrder++; 663 layersOrder[layer] = lastOrder; 664 lastLayer = layer; 665 } 666 } 667 } 668 } 669 catch(e) 670 { 671 console.log('VSDX Import: Failed to detect layers order'); 672 } 673 674 for (var k = 0; k < layers.length; k++) 675 { 676 var layer = layers[k]; 677 var layerIndex = layersOrder[k] != null? layersOrder[k] : k; 678 679 if (layerIndex == 0) 680 { 681 var layerCell = graph.getDefaultParent(); 682 } 683 else 684 { 685 var layerCell = new mxCell(); 686 graph.addCell(layerCell, graph.model.root, layerIndex); 687 } 688 689 layerCell.setVisible(layer.Visible == 1); 690 691 if (layer.Lock == 1) 692 { 693 layerCell.setStyle("locked=1;"); 694 } 695 696 //TODO handlle color and other properties 697 layerCell.setValue(layer.Name); 698 699 this.layersMap[k] = layerCell; 700 } 701 702 //add shapes 703 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) 704 m.entries = []; return m.entries; })(shapes)); 705 var pageHeight = page.getPageDimensions().y; 706 var pageId = page.getId(); 707 while ((entries.hasNext())) { 708 var entry = entries.next(); 709 var shape = entry.getValue(); 710 var p = this.layersMap[shape.layerMember]; 711 this.addShape(graph, shape, p? p : parent, pageId, pageHeight); 712 } 713 ; 714 var connects = page.getConnects(); 715 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) 716 m.entries = []; return m.entries; })(connects)); 717 while ((entries2.hasNext())) { 718 var entry = entries2.next(); 719 var edgeId = this.addConnectedEdge(graph, entry.getValue(), pageId, pageHeight); 720 if (edgeId != null) { 721 /* remove */ (function (m, k) { if (m.entries == null) 722 m.entries = []; for (var i = 0; i < m.entries.length; i++) 723 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 724 return m.entries.splice(i, 1)[0]; 725 } })(this.edgeShapeMap, edgeId); 726 } 727 } 728 ; 729 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) 730 m.entries = []; return m.entries; })(this.edgeShapeMap)); 731 while ((it.hasNext())) { 732 var edgeShapeEntry = it.next(); 733 if (edgeShapeEntry.getKey().getPageNumber() === pageId) { 734 this.addUnconnectedEdge(graph, /* get */ (function (m, k) { if (m.entries == null) 735 m.entries = []; for (var i = 0; i < m.entries.length; i++) 736 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 737 return m.entries[i].value; 738 } return null; })(this.parentsMap, edgeShapeEntry.getKey()), edgeShapeEntry.getValue(), pageHeight); 739 } 740 } 741 ; 742 if (!noSanitize) 743 { 744 this.sanitiseGraph(graph); 745 } 746 747 return pageHeight; 748 }; 749 750 /** 751 * This function is for doing any async processing needed after importing a page 752 */ 753 mxVsdxCodec.prototype.postImportPage = function(page, graph, callback) 754 { 755 try 756 { 757 var me = this; 758 var toCropImgs = []; 759 var shapes = page.getShapes().entries || []; 760 761 for (var i = 0; i < shapes.length; i++) 762 { 763 var shape = shapes[i].value || {}; 764 765 if (shape.toBeCroppedImg) 766 { 767 toCropImgs.push(shape); 768 } 769 } 770 771 if (toCropImgs.length > 0) 772 { 773 function cropImage(index, callback) 774 { 775 function next() 776 { 777 if (index < toCropImgs.length - 1) 778 { 779 cropImage(index + 1, callback); 780 } 781 else 782 { 783 callback(); 784 } 785 }; 786 787 var shape = toCropImgs[index]; 788 var imgInfo = shape.toBeCroppedImg; 789 790 var cell = (function (m, k) { if (m.entries == null) 791 m.entries = []; for (var i = 0; i < m.entries.length; i++) 792 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 793 return m.entries[i].value; 794 } return null; })(me.vertexMap, new com.mxgraph.io.vsdx.ShapePageId(page.Id, shape.Id)); 795 796 var img = new Image(); 797 798 img.onload = function() 799 { 800 var data = imgInfo.iData; 801 var type = imgInfo.iType; 802 803 try 804 { 805 //TODO There is still some minor inaccuracy in width/height 806 var scaleX = img.width / imgInfo.imgWidth; 807 var scaleY = img.height / imgInfo.imgHeight; 808 var offsetX = (-imgInfo.imgOffsetX) * scaleX; 809 var offsetY = (imgInfo.imgHeight - imgInfo.height + imgInfo.imgOffsetY) * scaleY; 810 var c = document.createElement("canvas"); 811 c.width = imgInfo.width * scaleX; 812 c.height = imgInfo.height * scaleY; 813 var ctx = c.getContext("2d"); 814 ctx.fillStyle = "#FFFFFF"; 815 ctx.fillRect(0, 0, c.width, c.height); 816 ctx.drawImage(img, offsetX, offsetY, c.width, c.height, 0, 0, c.width, c.height); 817 var jpgData = c.toDataURL("image/jpeg"); 818 data = jpgData.substr(23); //23 is the length of "data:image/jpeg;base64," 819 type = 'jpg'; 820 } 821 catch(e) 822 { 823 console.log(e); 824 } 825 826 cell.style += ';image=data:image/' + type + ',' + data; 827 next(); 828 }; 829 830 img.src = 'data:image/' + imgInfo.iType + ';base64,' + imgInfo.iData; 831 832 img.onerror = function() 833 { 834 cell.style += ';image=data:image/' + imgInfo.iType + ',' + imgInfo.iData; 835 next(); 836 } 837 }; 838 839 cropImage(0, callback); 840 } 841 else 842 { 843 callback(); 844 } 845 } 846 catch(e) 847 { 848 console.log(e); 849 callback(); 850 } 851 }; 852 853 /** 854 * Adds a vertex to the graph if 'shape' is a vertex or add the shape to edgeShapeMap if it is an edge. 855 * This method doesn't import sub-shapes of 'shape'. 856 * @param {mxGraph} graph Graph where the parsed graph is included. 857 * @param shp Shape to be imported. 858 * @param {number} parentHeight Height of the parent cell. 859 * @return {mxCell} the new vertex added. null if 'shape' is not a vertex. 860 * @param {com.mxgraph.io.vsdx.VsdxShape} shape 861 * @param {*} parent 862 * @param {number} pageId 863 */ 864 mxVsdxCodec.prototype.addShape = function (graph, shape, parent, pageId, parentHeight) { 865 shape.parentHeight = parentHeight; 866 var type = com.mxgraph.io.vsdx.VsdxShape.getType(shape.getShape()); 867 if (type != null && ((function (o1, o2) { if (o1 && o1.equals) { 868 return o1.equals(o2); 869 } 870 else { 871 return o1 === o2; 872 } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.TYPE_SHAPE) || (function (o1, o2) { if (o1 && o1.equals) { 873 return o1.equals(o2); 874 } 875 else { 876 return o1 === o2; 877 } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.TYPE_GROUP) || (function (o1, o2) { if (o1 && o1.equals) { 878 return o1.equals(o2); 879 } 880 else { 881 return o1 === o2; 882 } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN))) { 883 var id = shape.getId(); 884 if (shape.isVertex()) { 885 var v1 = null; 886 if (shape.isGroup()) { 887 v1 = this.addGroup(graph, shape, parent, pageId, parentHeight); 888 } 889 else { 890 v1 = this.addVertex(graph, shape, parent, pageId, parentHeight); 891 } 892 /* put */ (function (m, k, v) { if (m.entries == null) 893 m.entries = []; for (var i = 0; i < m.entries.length; i++) 894 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 895 m.entries[i].value = v; 896 return; 897 } 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); 898 899 var lnkObj = shape.getHyperlink(); 900 901 if (lnkObj.extLink) 902 { 903 graph.setLinkForCell(v1, lnkObj.extLink); 904 } 905 else if (lnkObj.pageLink) 906 { 907 graph.setLinkForCell(v1, 'data:page/id,' + lnkObj.pageLink); 908 } 909 910 // Add Shape properties 911 var props = shape.getProperties(); 912 913 for (var i = 0; i < props.length; i++) 914 { 915 try 916 { 917 graph.setAttributeForCell(v1, props[i].key, props[i].val); 918 } 919 catch(e) 920 { 921 console.log('Attribute: "', props[i].key, '" with value "', props[i].val, '" not allowed in HTML'); 922 } 923 } 924 925 return v1; 926 } 927 else { 928 shape.setShapeIndex(graph.getModel().getChildCount(parent)); 929 /* put */ (function (m, k, v) { if (m.entries == null) 930 m.entries = []; for (var i = 0; i < m.entries.length; i++) 931 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 932 m.entries[i].value = v; 933 return; 934 } 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); 935 /* put */ (function (m, k, v) { if (m.entries == null) 936 m.entries = []; for (var i = 0; i < m.entries.length; i++) 937 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 938 m.entries[i].value = v; 939 return; 940 } 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); 941 } 942 } 943 return null; 944 }; 945 /** 946 * Adds a group to the graph. 947 * The sub-shapes of a complex shape are processed like part of the shape. 948 * @param {mxGraph} graph Graph where the parsed graph is included. 949 * @param {*} parent Parent cell of the shape. 950 * @param {number} parentHeight Height of the parent cell of the shape. 951 * @return {mxCell} Cell added to the graph. 952 * @param {com.mxgraph.io.vsdx.VsdxShape} shape 953 * @param {number} pageId 954 */ 955 mxVsdxCodec.prototype.addGroup = function (graph, shape, parent, pageId, parentHeight) { 956 var d = shape.getDimensions(); 957 var master = shape.getMaster(); 958 var styleMap = shape.getStyleFromShape(); 959 var geomList = shape.getGeomList(); 960 if (geomList.isNoFill()) { 961 /* put */ (styleMap[mxConstants.STYLE_FILLCOLOR] = "none"); 962 /* put */ (styleMap[mxConstants.STYLE_GRADIENTCOLOR] = "none"); 963 } 964 if (geomList.isNoLine()) { 965 /* put */ (styleMap[mxConstants.STYLE_STROKECOLOR] = "none"); 966 } 967 /* put */ (styleMap["html"] = "1"); 968 /* put */ (styleMap[mxConstants.STYLE_WHITE_SPACE] = "wrap"); 969 var style = com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "="); 970 var group = null; 971 var children = shape.getChildShapes(); 972 var hasChildren = children != null && (function (m) { if (m.entries == null) 973 m.entries = []; return m.entries.length; })(children) > 0; 974 var subLabel = shape.isDisplacedLabel() || shape.isRotatedLabel() || hasChildren; 975 var o = shape.getOriginPoint(parentHeight, true); 976 if (subLabel) { 977 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); 978 } 979 else { 980 var textLabel = shape.getTextLabel(); 981 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); 982 } 983 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) 984 m.entries = []; return m.entries; })(children)); 985 while ((entries.hasNext())) { 986 var entry = entries.next(); 987 var subShape = entry.getValue(); 988 var Id = subShape.getId(); 989 if (subShape.isVertex()) { 990 var type = com.mxgraph.io.vsdx.VsdxShape.getType(subShape.getShape()); 991 if (type != null && ((function (o1, o2) { if (o1 && o1.equals) { 992 return o1.equals(o2); 993 } 994 else { 995 return o1 === o2; 996 } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.TYPE_SHAPE) || (function (o1, o2) { if (o1 && o1.equals) { 997 return o1.equals(o2); 998 } 999 else { 1000 return o1 === o2; 1001 } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.TYPE_GROUP) || (function (o1, o2) { if (o1 && o1.equals) { 1002 return o1.equals(o2); 1003 } 1004 else { 1005 return o1 === o2; 1006 } })(type, com.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN))) { 1007 if (subShape.isVertex()) { 1008 subShape.propagateRotation(shape.getRotation()); 1009 if (subShape.isGroup()) { 1010 this.addGroup(graph, subShape, group, pageId, d.y); 1011 } 1012 else { 1013 this.addVertex(graph, subShape, group, pageId, d.y); 1014 } 1015 } 1016 } 1017 if (master == null) { 1018 /* put */ (function (m, k, v) { if (m.entries == null) 1019 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1020 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1021 m.entries[i].value = v; 1022 return; 1023 } 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); 1024 } 1025 } 1026 else { 1027 if (master == null) { 1028 /* put */ (function (m, k, v) { if (m.entries == null) 1029 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1030 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1031 m.entries[i].value = v; 1032 return; 1033 } 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); 1034 /* put */ (function (m, k, v) { if (m.entries == null) 1035 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1036 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1037 m.entries[i].value = v; 1038 return; 1039 } 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); 1040 } 1041 else { 1042 this.addUnconnectedEdge(graph, group, subShape, parentHeight); 1043 } 1044 } 1045 } 1046 ; 1047 if (subLabel) { 1048 shape.createLabelSubShape(graph, group); 1049 } 1050 var rotation = shape.getRotation(); 1051 if (rotation !== 0) { 1052 var pgeo = group.getGeometry(); 1053 var hw = pgeo.width / 2; 1054 var hh = pgeo.height / 2; 1055 for (var i = 0; i < group.getChildCount(); i++) { 1056 var child = group.getChildAt(i); 1057 com.mxgraph.online.Utils.rotatedGeometry(child.getGeometry(), rotation, hw, hh); 1058 } 1059 ; 1060 } 1061 1062 /* put */ (function (m, k, v) { if (m.entries == null) 1063 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1064 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1065 m.entries[i].value = v; 1066 return; 1067 } 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); 1068 1069 return group; 1070 }; 1071 mxVsdxCodec.rotatedEdgePoint = function (pt, rotation, cx, cy) { 1072 rotation = (function (x) { return x * Math.PI / 180; })(rotation); 1073 var cos = Math.cos(rotation); 1074 var sin = Math.sin(rotation); 1075 var x = pt.x - cx; 1076 var y = pt.y - cy; 1077 var x1 = x * cos - y * sin; 1078 var y1 = y * cos + x * sin; 1079 pt.x = (Math.round(x1 + cx)); 1080 pt.y = (Math.round(y1 + cy)); 1081 }; 1082 /** 1083 * Adds a simple shape to the graph 1084 * @param {mxGraph} graph Graph where the parsed graph is included. 1085 * @param {*} parent Parent cell of the shape. 1086 * @param {number} parentHeight Height of the parent cell of the shape. 1087 * @return {mxCell} Cell added to the graph. 1088 * @param {com.mxgraph.io.vsdx.VsdxShape} shape 1089 * @param {number} pageId 1090 */ 1091 mxVsdxCodec.prototype.addVertex = function (graph, shape, parent, pageId, parentHeight) { 1092 var textLabel = ""; 1093 var hasSubLabel = shape.isDisplacedLabel() || shape.isRotatedLabel(); 1094 if (!hasSubLabel) { 1095 textLabel = shape.getTextLabel(); 1096 } 1097 var dimensions = shape.getDimensions(); 1098 var styleMap = shape.getStyleFromShape(); 1099 /* put */ (styleMap["html"] = "1"); 1100 var geomExists = styleMap.hasOwnProperty(mxConstants.STYLE_SHAPE) || styleMap.hasOwnProperty("stencil"); 1101 if (!styleMap.hasOwnProperty(mxConstants.STYLE_FILLCOLOR) || !geomExists) { 1102 /* put */ (styleMap[mxConstants.STYLE_FILLCOLOR] = "none"); 1103 } 1104 if (!geomExists) { 1105 /* put */ (styleMap[mxConstants.STYLE_STROKECOLOR] = "none"); 1106 } 1107 if (!styleMap.hasOwnProperty(mxConstants.STYLE_GRADIENTCOLOR) || !geomExists) { 1108 /* put */ (styleMap[mxConstants.STYLE_GRADIENTCOLOR] = "none"); 1109 } 1110 /* put */ (styleMap[mxConstants.STYLE_WHITE_SPACE] = "wrap"); 1111 var coordinates = shape.getOriginPoint(parentHeight, true); 1112 if (geomExists || textLabel != null) { 1113 var style = com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "="); 1114 var v1 = null; 1115 if (hasSubLabel) { 1116 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); 1117 } 1118 else { 1119 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); 1120 } 1121 /* put */ (function (m, k, v) { if (m.entries == null) 1122 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1123 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1124 m.entries[i].value = v; 1125 return; 1126 } 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); 1127 shape.setLabelOffset(v1, style); 1128 if (hasSubLabel) { 1129 shape.createLabelSubShape(graph, v1); 1130 } 1131 return v1; 1132 } 1133 return null; 1134 }; 1135 1136 1137 mxVsdxCodec.calculateAbsolutePoint = function (cell) 1138 { 1139 var x = 0, y = 0; 1140 while (cell != null) 1141 { 1142 var geo = cell.geometry; 1143 1144 if (geo != null) 1145 { 1146 x += geo.x; 1147 y += geo.y; 1148 } 1149 cell = cell.parent; 1150 } 1151 1152 return new mxPoint(x, y); 1153 } 1154 1155 mxVsdxCodec.prototype.processEdgeGeo = function (edgeShape, edge) 1156 { 1157 //Detect Line jumps (best effots) 1158 try 1159 { 1160 var rows = edgeShape.geomList.geomList[0].rows; 1161 1162 for (var i = 0; i < rows.length; i++) 1163 { 1164 if (rows[i] instanceof com.mxgraph.io.vsdx.geometry.ArcTo) 1165 { 1166 edge.style += 'jumpStyle=arc;'; 1167 break; 1168 } 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 1184 /** 1185 * Adds a connected edge to the graph. 1186 * These edged are the referenced in one Connect element at least. 1187 * @param {mxGraph} graph graph Graph where the parsed graph is included. 1188 * @param {com.mxgraph.io.vsdx.mxVsdxConnect} connect Connect Element that references an edge shape and the source vertex. 1189 * @param {number} pageId 1190 * @param {number} pageHeight 1191 * @return {com.mxgraph.io.vsdx.ShapePageId} 1192 */ 1193 mxVsdxCodec.prototype.addConnectedEdge = function (graph, connect, pageId, pageHeight) { 1194 var fromSheet = connect.getFromSheet(); 1195 var edgeId = new com.mxgraph.io.vsdx.ShapePageId(pageId, fromSheet); 1196 var edgeShape = (function (m, k) { if (m.entries == null) 1197 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1198 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1199 return m.entries[i].value; 1200 } return null; })(this.edgeShapeMap, edgeId); 1201 if (edgeShape == null) { 1202 return null; 1203 } 1204 var parent = (function (m, k) { if (m.entries == null) 1205 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1206 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1207 return m.entries[i].value; 1208 } return null; })(this.parentsMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, edgeShape.getId())); 1209 var parentHeight = pageHeight; 1210 if (parent != null) { 1211 var parentGeo = graph.getModel().getGeometry(parent); 1212 if (parentGeo != null) { 1213 parentHeight = parentGeo.height; 1214 } 1215 } 1216 var beginXY = edgeShape.getStartXY(parentHeight); 1217 var endXY = edgeShape.getEndXY(parentHeight); 1218 var points = edgeShape.getRoutingPoints(parentHeight, beginXY, edgeShape.getRotation()); 1219 this.rotateChildEdge(graph.getModel(), parent, beginXY, endXY, points); 1220 var fromConstraint = null; 1221 var sourceSheet = connect.getSourceToSheet(); 1222 var source = sourceSheet != null ? (function (m, k) { if (m.entries == null) 1223 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1224 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1225 return m.entries[i].value; 1226 } return null; })(this.vertexMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, sourceSheet)) : null; 1227 1228 var removeFirstPt = true; 1229 //Treat source with zero height/width as null since constraint calc will be invalid 1230 if (source == null || source.geometry.width == 0 || source.geometry.height == 0) 1231 { 1232 source = graph.insertVertex(parent, null, null, Math.floor(Math.round(beginXY.x * 100) / 100), Math.floor(Math.round(beginXY.y * 100) / 100), 0, 0); 1233 } 1234 else if (source.style && source.style.indexOf(';rotation=') == -1) 1235 { 1236 var absOriginFrom = mxVsdxCodec.calculateAbsolutePoint(source); 1237 var absBeginXY = mxVsdxCodec.calculateAbsolutePoint(parent); 1238 var srcGeo = source.geometry; 1239 fromConstraint = new mxPoint( 1240 (absBeginXY.x + beginXY.x - absOriginFrom.x) 1241 / srcGeo.width, 1242 (absBeginXY.y + beginXY.y - absOriginFrom.y) 1243 / srcGeo.height); 1244 //TODO fromConstraint rotation support 1245 } 1246 else 1247 { 1248 removeFirstPt = false; 1249 } 1250 1251 var toConstraint = null; 1252 var toSheet = connect.getTargetToSheet(); 1253 var target = toSheet != null ? (function (m, k) { if (m.entries == null) 1254 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1255 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1256 return m.entries[i].value; 1257 } return null; })(this.vertexMap, new com.mxgraph.io.vsdx.ShapePageId(pageId, toSheet)) : null; 1258 1259 var removeLastPt = true; 1260 //Treat target with zero height/width as null since constraint calc will be invalid 1261 if (target == null || target.geometry.width == 0 || target.geometry.height == 0) 1262 { 1263 target = graph.insertVertex(parent, null, null, Math.floor(Math.round(endXY.x * 100) / 100), Math.floor(Math.round(endXY.y * 100) / 100), 0, 0); 1264 } 1265 else if (target.style && target.style.indexOf(';rotation=') == -1) 1266 { 1267 var absOriginTo = mxVsdxCodec.calculateAbsolutePoint(target); 1268 var absEndXY = mxVsdxCodec.calculateAbsolutePoint(parent); 1269 var trgGeo = target.geometry; 1270 toConstraint = new mxPoint( 1271 (absEndXY.x + endXY.x - absOriginTo.x) 1272 / trgGeo.width, 1273 (absEndXY.y + endXY.y - absOriginTo.y) 1274 / trgGeo.height); 1275 //TODO toConstraint rotation support 1276 } 1277 else 1278 { 1279 removeLastPt = false; 1280 } 1281 1282 var styleMap = edgeShape.getStyleFromEdgeShape(parentHeight); 1283 var edge; 1284 var rotation = edgeShape.getRotation(); 1285 if (rotation !== 0) { 1286 edge = graph.insertEdge(parent, null, null, source, target, com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "=")); 1287 var label = edgeShape.createLabelSubShape(graph, edge); 1288 if (label != null) { 1289 label.setStyle(label.getStyle() + ";rotation=" + (rotation > 60 && rotation < 240 ? (rotation + 180) % 360 : rotation)); 1290 var geo = label.getGeometry(); 1291 geo.x = (0); 1292 geo.y = (0); 1293 geo.relative = (true); 1294 geo.offset = (new mxPoint(-geo.width / 2, -geo.height / 2)); 1295 } 1296 } 1297 else { 1298 edge = graph.insertEdge(parent, null, edgeShape.getTextLabel(), source, target, com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "=")); 1299 var lblOffset = edgeShape.getLblEdgeOffset(graph.getView(), points); 1300 edge.getGeometry().offset = (lblOffset); 1301 1302 //add entry/exit points when edge, src, and trg are not rotated 1303 if (fromConstraint != null) 1304 { 1305 graph.setConnectionConstraint(edge, source, true, 1306 new mxConnectionConstraint(fromConstraint, false)); 1307 } 1308 1309 if (removeFirstPt) 1310 { 1311 points.shift(); 1312 } 1313 1314 if (toConstraint != null) 1315 { 1316 graph.setConnectionConstraint(edge, target, false, 1317 new mxConnectionConstraint(toConstraint, false)); 1318 } 1319 1320 if (removeLastPt) 1321 { 1322 points.pop(); 1323 } 1324 } 1325 var edgeGeometry = graph.getModel().getGeometry(edge); 1326 1327 //when source.parent != target.parent the front end will change the edge parent to parent 1 but waypoints are not corrected 1328 if (source.parent != target.parent && parent != null && parent.id != 1 && source.parent.id == 1) 1329 { 1330 var accX = 0; 1331 var accY = 0; 1332 1333 var prnt = parent; 1334 1335 do 1336 { 1337 var prntGeo = prnt.geometry; 1338 1339 if (prntGeo != null) 1340 { 1341 accX += prntGeo.x; 1342 accY += prntGeo.y; 1343 } 1344 prnt = prnt.parent; 1345 } 1346 while(prnt != null); 1347 1348 edge.parent = source.parent; 1349 1350 for (var i = 0; i < points.length; i++) 1351 { 1352 points[i].x += accX; 1353 points[i].y += accY; 1354 } 1355 } 1356 1357 edgeGeometry.points = (points); 1358 if (styleMap.hasOwnProperty("curved") && (function (o1, o2) { if (o1 && o1.equals) { 1359 return o1.equals(o2); 1360 } 1361 else { 1362 return o1 === o2; 1363 } })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(styleMap, "curved"), "1")) { 1364 edgeGeometry = graph.getModel().getGeometry(edge); 1365 var pointList = edgeShape.getControlPoints(parentHeight); 1366 edgeGeometry.points = (pointList); 1367 } 1368 1369 this.processEdgeGeo(edgeShape, edge) ; 1370 1371 return edgeId; 1372 }; 1373 /** 1374 * Adds a new edge not connected to any vertex to the graph. 1375 * @param {mxGraph} graph Graph where the parsed graph is included. 1376 * @param {*} parent Parent cell of the edge to be imported. 1377 * @param {com.mxgraph.io.vsdx.VsdxShape} edgeShape Shape Element that represents an edge. 1378 * @return {*} The new edge added. 1379 * @param {number} pageHeight 1380 */ 1381 mxVsdxCodec.prototype.addUnconnectedEdge = function (graph, parent, edgeShape, pageHeight) { 1382 var parentHeight = pageHeight; 1383 if (parent != null) { 1384 var parentGeometry = graph.getModel().getGeometry(parent); 1385 if (parentGeometry != null) { 1386 parentHeight = parentGeometry.height; 1387 } 1388 } 1389 var beginXY = edgeShape.getStartXY(parentHeight); 1390 var endXY = edgeShape.getEndXY(parentHeight); 1391 var styleMap = edgeShape.getStyleFromEdgeShape(parentHeight); 1392 var edge; 1393 var points = edgeShape.getRoutingPoints(parentHeight, beginXY, edgeShape.getRotation()); 1394 var rotation = edgeShape.getRotation(); 1395 if (rotation !== 0) { 1396 if (edgeShape.getShapeIndex() === 0) { 1397 edge = graph.insertEdge(parent, null, null, null, null, com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "=")); 1398 } 1399 else { 1400 edge = graph.createEdge(parent, null, null, null, null, com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "=")); 1401 edge = graph.addEdge(edge, parent, null, null, edgeShape.getShapeIndex() + this.shapeIndexShift++); 1402 } 1403 var label = edgeShape.createLabelSubShape(graph, edge); 1404 if (label != null) { 1405 label.setStyle(label.getStyle() + ";rotation=" + (rotation > 60 && rotation < 240 ? (rotation + 180) % 360 : rotation)); 1406 var geo = label.getGeometry(); 1407 geo.x = (0); 1408 geo.y = (0); 1409 geo.relative = (true); 1410 geo.offset = (new mxPoint(-geo.width / 2, -geo.height / 2)); 1411 } 1412 } 1413 else { 1414 if (edgeShape.getShapeIndex() === 0) { 1415 edge = graph.insertEdge(parent, null, edgeShape.getTextLabel(), null, null, com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "=")); 1416 } 1417 else { 1418 edge = graph.createEdge(parent, null, edgeShape.getTextLabel(), null, null, com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "=")); 1419 edge = graph.addEdge(edge, parent, null, null, edgeShape.getShapeIndex() + this.shapeIndexShift++); 1420 } 1421 var lblOffset = edgeShape.getLblEdgeOffset(graph.getView(), points); 1422 edge.getGeometry().offset = (lblOffset); 1423 } 1424 this.rotateChildEdge(graph.getModel(), parent, beginXY, endXY, points); 1425 var edgeGeometry = graph.getModel().getGeometry(edge); 1426 //remove begin/end points from points array 1427 points.pop(); 1428 points.shift(); 1429 edgeGeometry.points = (points); 1430 edgeGeometry.setTerminalPoint(beginXY, true); 1431 edgeGeometry.setTerminalPoint(endXY, false); 1432 if (styleMap.hasOwnProperty("curved") && (function (o1, o2) { if (o1 && o1.equals) { 1433 return o1.equals(o2); 1434 } 1435 else { 1436 return o1 === o2; 1437 } })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(styleMap, "curved"), "1")) { 1438 edgeGeometry = graph.getModel().getGeometry(edge); 1439 var pointList = edgeShape.getControlPoints(parentHeight); 1440 edgeGeometry.points = (pointList); 1441 } 1442 1443 this.processEdgeGeo(edgeShape, edge) ; 1444 1445 return edge; 1446 }; 1447 mxVsdxCodec.prototype.rotateChildEdge = function (model, parent, beginXY, endXY, points) { 1448 if (parent != null) { 1449 var pgeo = model.getGeometry(parent); 1450 var pStyle = model.getStyle(parent); 1451 if (pgeo != null && pStyle != null) { 1452 var pos = pStyle.indexOf("rotation="); 1453 if (pos > -1) { 1454 var pRotation = parseFloat(pStyle.substring(pos + 9, pStyle.indexOf(';', pos))); 1455 var hw = pgeo.width / 2; 1456 var hh = pgeo.height / 2; 1457 mxVsdxCodec.rotatedEdgePoint(beginXY, pRotation, hw, hh); 1458 mxVsdxCodec.rotatedEdgePoint(endXY, pRotation, hw, hh); 1459 for (var index126 = 0; index126 < points.length; index126++) { 1460 var p = points[index126]; 1461 { 1462 mxVsdxCodec.rotatedEdgePoint(p, pRotation, hw, hh); 1463 } 1464 } 1465 } 1466 } 1467 } 1468 }; 1469 /** 1470 * Post processes groups to remove leaf vertices that render nothing 1471 * @param group 1472 * @param {mxGraph} graph 1473 */ 1474 mxVsdxCodec.prototype.sanitiseGraph = function (graph) { 1475 var root = graph.getModel().getRoot(); 1476 this.sanitiseCell(graph, root); 1477 }; 1478 /*private*/ mxVsdxCodec.prototype.sanitiseCell = function (graph, cell) { 1479 var model = graph.getModel(); 1480 var childCount = model.getChildCount(cell); 1481 var removeList = ([]); 1482 for (var i = 0; i < childCount; i++) { 1483 var child = model.getChildAt(cell, i); 1484 var remove = this.sanitiseCell(graph, child); 1485 if (remove) { 1486 /* add */ (removeList.push(child)); 1487 } 1488 } 1489 ; 1490 for (var index127 = 0; index127 < removeList.length; index127++) { 1491 var removeChild = removeList[index127]; 1492 { 1493 model.remove(removeChild); 1494 } 1495 } 1496 1497 //Check for -ve width/height cells and correct it 1498 var geo = cell.geometry; 1499 1500 if (geo != null) 1501 { 1502 if (geo.height < 0) 1503 { 1504 geo.height = Math.abs(geo.height); 1505 geo.y -= geo.height; 1506 cell.style += ';flipV=1;'; 1507 } 1508 1509 if (geo.width < 0) 1510 { 1511 geo.width = Math.abs(geo.width); 1512 geo.x -= geo.width; 1513 cell.style += ';flipH=1;'; 1514 } 1515 } 1516 1517 if (childCount > 0) { 1518 childCount = model.getChildCount(cell); 1519 } 1520 var value = new String(model.getValue(cell)).toString(); 1521 var style = model.getStyle(cell); 1522 if (childCount === 0 && model.isVertex(cell)) { 1523 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)) { 1524 return true; 1525 } 1526 } 1527 return false; 1528 }; 1529 return mxVsdxCodec; 1530 }()); 1531 io.mxVsdxCodec = mxVsdxCodec; 1532 mxVsdxCodec["__class"] = "com.mxgraph.io.mxVsdxCodec"; 1533 })(io = mxgraph.io || (mxgraph.io = {})); 1534 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 1535})(com || (com = {})); 1536(function (com) { 1537 var mxgraph; 1538 (function (mxgraph) { 1539 var io; 1540 (function (io) { 1541 var mxVssxCodec = (function (_super) { 1542 __extends(mxVssxCodec, _super); 1543 function mxVssxCodec(editorUi) { 1544 var _this = _super.call(this) || this; 1545 _this.RESPONSE_END = ""; 1546 _this.RESPONSE_DIAGRAM_START = ""; 1547 _this.RESPONSE_DIAGRAM_END = ""; 1548 _this.RESPONSE_HEADER = ""; 1549 _this.editorUi = editorUi; 1550 return _this; 1551 } 1552 mxVssxCodec.prototype.decodeVssx = function (file, callback, charset, onerror) { 1553 var _this = this; 1554 var library = { str: "<mxlibrary>[", toString: function () { return this.str; } }; 1555 this.decodeVsdx(file, function(shapesInPages) 1556 { 1557 /* append */ (function (sb) { return sb.str = sb.str.concat(shapesInPages); })(library); 1558 var masterShapes = _this.vsdxModel.getMasterShapes(); 1559 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) 1560 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1561 r.push(m.entries[i].value); return r; })(_this.vsdxModel.getPages())).next(); 1562 if (masterShapes != null) { 1563 var shapes_1 = { str: "", toString: function () { return this.str; } }; 1564 var comma_1 = (shapesInPages.length === 0) ? "" : ","; 1565 { 1566 var array129 = (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(masterShapes); 1567 var _loop_1 = function (index128) { 1568 var master = array129[index128]; 1569 { 1570 var shapeGraph = this_1.createMxGraph(); 1571 1572 var scale = 1; 1573 1574 if (master.pageSheet != null) 1575 { 1576 var dScaleV = 1, pScaleV = 1; 1577 var dScale = master.pageSheet["DrawingScale"]; 1578 1579 if (dScale != null) 1580 { 1581 dScaleV = parseFloat(dScale.getAttribute("V")) || 1; 1582 } 1583 1584 var pScale = master.pageSheet["PageScale"]; 1585 1586 if (pScale != null) 1587 { 1588 pScaleV = parseFloat(pScale.getAttribute("V")) || 1; 1589 } 1590 1591 scale = pScaleV / dScaleV; 1592 } 1593 1594 var hasCells = false; 1595 1596 for (var chI = 0; master.firstLevelShapes != null && chI < master.firstLevelShapes.length; chI++) 1597 { 1598 var shapeElem = master.firstLevelShapes[chI].getShape(); 1599 var shape = new com.mxgraph.io.vsdx.VsdxShape(page, shapeElem, !page.isEdge(shapeElem), masterShapes, null, this_1.vsdxModel); 1600 1601 var cell = null; 1602 if (shape.isVertex()) { 1603 /* clear */ this_1.edgeShapeMap.entries = []; 1604 /* clear */ this_1.parentsMap.entries = []; 1605 cell = this_1.addShape(shapeGraph, shape, shapeGraph.getDefaultParent(), 0, 1169); 1606 { 1607 var array131 = (function (m) { if (m.entries == null) 1608 m.entries = []; return m.entries; })(this_1.edgeShapeMap); 1609 for (var index130 = 0; index130 < array131.length; index130++) { 1610 var edgeEntry = array131[index130]; 1611 { 1612 var parent_1 = (function (m, k) { if (m.entries == null) 1613 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1614 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1615 return m.entries[i].value; 1616 } return null; })(this_1.parentsMap, edgeEntry.getKey()); 1617 this_1.addUnconnectedEdge(shapeGraph, parent_1, edgeEntry.getValue(), 1169); 1618 } 1619 } 1620 } 1621 } 1622 else { 1623 cell = this_1.addUnconnectedEdge(shapeGraph, null, shape, 1169); 1624 } 1625 1626 hasCells |= (cell != null); 1627 } 1628 1629 if (hasCells) 1630 { 1631 this_1.scaleGraph(shapeGraph, scale); 1632 var size = this_1.normalizeGraph(shapeGraph); 1633 this_1.sanitiseGraph(shapeGraph); 1634 if (shapeGraph.getModel().getChildCount(shapeGraph.getDefaultParent()) === 0) 1635 return "continue"; 1636 /* append */ (function (sb) { return sb.str = sb.str.concat(comma_1); })(shapes_1); 1637 /* append */ (function (sb) { return sb.str = sb.str.concat("{\"xml\":\""); })(shapes_1); 1638 var shapeXML_1 = _super.prototype.processPage.call(this_1, shapeGraph, null); 1639 /* append */ (function (sb) { return sb.str = sb.str.concat(shapeXML_1); })(shapes_1); 1640 /* append */ (function (sb) { return sb.str = sb.str.concat("\",\"w\":"); })(shapes_1); 1641 /* append */ (function (sb) { return sb.str = sb.str.concat(size.width); })(shapes_1); 1642 /* append */ (function (sb) { return sb.str = sb.str.concat(",\"h\":"); })(shapes_1); 1643 /* append */ (function (sb) { return sb.str = sb.str.concat(size.height); })(shapes_1); 1644 /* append */ (function (sb) { return sb.str = sb.str.concat(",\"title\":"); })(shapes_1); 1645 var shapeName_1 = master.getName(); 1646 if (shapeName_1 == null) 1647 { 1648 shapeName_1 = ""; 1649 } 1650 shapeName_1 = mxUtils.htmlEntities(JSON.stringify(shapeName_1)); 1651 /* append */ (function (sb) { return sb.str = sb.str.concat(shapeName_1); })(shapes_1); 1652 /* append */ (function (sb) { return sb.str = sb.str.concat("}"); })(shapes_1); 1653 comma_1 = ","; 1654 } 1655 } 1656 }; 1657 var this_1 = _this; 1658 for (var index128 = 0; index128 < array129.length; index128++) { 1659 _loop_1(index128); 1660 } 1661 } 1662 /* append */ (function (sb) { return sb.str = sb.str.concat(shapes_1); })(library); 1663 } 1664 /* append */ (function (sb) { return sb.str = sb.str.concat("]</mxlibrary>"); })(library); 1665 if (callback) 1666 { 1667 try 1668 { 1669 callback(library.str); 1670 } 1671 catch(e) 1672 { 1673 if (onerror != null) 1674 { 1675 onerror(e); 1676 } 1677 else 1678 { 1679 callback(""); 1680 } 1681 } 1682 } 1683 }, charset); 1684 }; 1685 mxVssxCodec.prototype.normalizeGeo = function (cell) { 1686 var geo = cell.getGeometry(); 1687 geo.x = (0); 1688 geo.y = (0); 1689 var srcP = geo.sourcePoint; 1690 if (cell.isEdge() && srcP != null) { 1691 this.transPoint(geo.targetPoint, srcP); 1692 this.transPoint(geo.offset, srcP); 1693 var points = geo.points; 1694 if (points != null) { 1695 for (var index132 = 0; index132 < points.length; index132++) { 1696 var p = points[index132]; 1697 { 1698 this.transPoint(p, srcP); 1699 } 1700 } 1701 } 1702 this.transPoint(srcP, srcP); 1703 } 1704 return geo; 1705 }; 1706 1707 mxVssxCodec.prototype.normalizeGraph = function (graph) 1708 { 1709 //Find minX/Y, maxX/Y 1710 var minX, minY, maxX, maxY; 1711 1712 function getDimMinMax(pt) 1713 { 1714 if (pt != null) 1715 { 1716 if (minX == null) 1717 { 1718 minX = pt.x; minY = pt.y; maxX = pt.x + (pt.width || 0); maxY = pt.y + (pt.height || 0); 1719 } 1720 else 1721 { 1722 minX = Math.min(pt.x, minX); 1723 minY = Math.min(pt.y, minY); 1724 maxX = Math.max(pt.x + (pt.width || 0), maxX); 1725 maxY = Math.max(pt.y + (pt.height || 0), maxY); 1726 } 1727 } 1728 }; 1729 1730 for (var id in graph.model.cells) 1731 { 1732 var cell = graph.model.cells[id]; 1733 var geo = cell.geometry; 1734 1735 if (geo != null && cell.parent.id == 1) 1736 { 1737 if (cell.vertex) 1738 { 1739 getDimMinMax(geo); 1740 } 1741 else 1742 { 1743 getDimMinMax(geo.sourcePoint); 1744 getDimMinMax(geo.targetPoint); 1745 var points = geo.points; 1746 1747 for (var i = 0; points != null && i < points.length; i++) 1748 { 1749 getDimMinMax(points[i]); 1750 } 1751 } 1752 } 1753 } 1754 1755 //Remove minX, minY from all geo and fix edges also 1756 var srcP = {x: minX, y: minY}; 1757 1758 for (var id in graph.model.cells) 1759 { 1760 var cell = graph.model.cells[id]; 1761 var geo = cell.geometry; 1762 1763 if (geo != null && cell.parent.id == 1) 1764 { 1765 geo.x -= minX; 1766 geo.y -= minY; 1767 1768 if (cell.isEdge()) 1769 { 1770 this.transPoint(geo.sourcePoint, srcP); 1771 this.transPoint(geo.targetPoint, srcP); 1772 this.transPoint(geo.offset, srcP); 1773 var points = geo.points; 1774 1775 for (var i = 0; points != null && i < points.length; i++) 1776 { 1777 this.transPoint(points[i], srcP); 1778 } 1779 } 1780 } 1781 } 1782 1783 return {width: maxX - minX, height: maxY - minY} 1784 }; 1785 1786 mxVssxCodec.prototype.transPoint = function (p, srcP) { 1787 if (p != null) { 1788 p.x = (p.x - srcP.x); 1789 p.y = (p.y - srcP.y); 1790 } 1791 }; 1792 /** 1793 * 1794 * @param {com.mxgraph.io.mxGraph} graph 1795 * @param {com.mxgraph.io.vsdx.mxVsdxPage} page 1796 * @return {string} 1797 */ 1798 mxVssxCodec.prototype.processPage = function (graph, page) { 1799 var model = graph.getModel(); 1800 var shapes = { str: "", toString: function () { return this.str; } }; 1801 var comma = ""; 1802 { 1803 var this_2 = this; 1804 for (var id in model.cells) { 1805 var c = model.cells[id]; 1806 { 1807 if (graph.getDefaultParent() === model.getParent(c)) { 1808 /* append */ (function (sb) { return sb.str = sb.str.concat(comma); })(shapes); 1809 /* append */ (function (sb) { return sb.str = sb.str.concat("{\"xml\":\""); })(shapes); 1810 var shapeGraph = this_2.createMxGraph(); 1811 shapeGraph.addCell(c); 1812 this_2.sanitiseGraph(shapeGraph); 1813 if (shapeGraph.getModel().getChildCount(shapeGraph.getDefaultParent()) === 0) 1814 return "continue"; 1815 var geo_2 = this_2.normalizeGeo(c); 1816 var shapeXML_2 = _super.prototype.processPage.call(this_2, shapeGraph, null); 1817 /* append */ (function (sb) { return sb.str = sb.str.concat(shapeXML_2); })(shapes); 1818 /* append */ (function (sb) { return sb.str = sb.str.concat("\",\"w\":"); })(shapes); 1819 /* append */ (function (sb) { return sb.str = sb.str.concat(geo_2.width); })(shapes); 1820 /* append */ (function (sb) { return sb.str = sb.str.concat(",\"h\":"); })(shapes); 1821 /* append */ (function (sb) { return sb.str = sb.str.concat(geo_2.height); })(shapes); 1822 /* append */ (function (sb) { return sb.str = sb.str.concat(",\"title\":\""); })(shapes); 1823 var style = model.getStyle(c); 1824 var name_1 = ""; 1825 if (style != null) { 1826 var p = style.indexOf(com.mxgraph.io.vsdx.mxVsdxConstants.VSDX_ID); 1827 if (p >= 0) { 1828 p += com.mxgraph.io.vsdx.mxVsdxConstants.VSDX_ID.length + 1; 1829 var id = parseInt(style.substring(p, style.indexOf(";", p))); 1830 var vsdxShape = (function (m, k) { if (m.entries == null) 1831 m.entries = []; for (var i = 0; i < m.entries.length; i++) 1832 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 1833 return m.entries[i].value; 1834 } return null; })(this_2.vertexShapeMap, new com.mxgraph.io.vsdx.ShapePageId(page.getId(), id)); 1835 if (vsdxShape != null) 1836 name_1 = vsdxShape.getName(); 1837 } 1838 } 1839 /* append */ (function (sb) { return sb.str = sb.str.concat(name_1); })(shapes); 1840 /* append */ (function (sb) { return sb.str = sb.str.concat("\"}"); })(shapes); 1841 comma = ","; 1842 } 1843 } 1844 }; 1845 } 1846 if (shapes.str.length > 0) 1847 this.RESPONSE_DIAGRAM_START = ","; 1848 else 1849 this.RESPONSE_DIAGRAM_START = ""; 1850 return shapes.str; 1851 }; 1852 return mxVssxCodec; 1853 }(com.mxgraph.io.mxVsdxCodec)); 1854 io.mxVssxCodec = mxVssxCodec; 1855 mxVssxCodec["__class"] = "com.mxgraph.io.mxVssxCodec"; 1856 })(io = mxgraph.io || (mxgraph.io = {})); 1857 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 1858})(com || (com = {})); 1859(function (com) { 1860 var mxgraph; 1861 (function (mxgraph) { 1862 var io; 1863 (function (io) { 1864 var vsdx; 1865 (function (vsdx) { 1866 var geometry; 1867 (function (geometry) { 1868 var Row = (function () { 1869 function Row(index, x, y) { 1870 this.x = null; 1871 this.y = null; 1872 this.a = null; 1873 this.b = null; 1874 this.c = null; 1875 this.d = null; 1876 this.formulaA = null; 1877 this.formulaE = null; 1878 this.index = 0; 1879 this.index = index; 1880 this.x = x; 1881 this.y = y; 1882 } 1883 Row.prototype.getX = function () { 1884 return this.x; 1885 }; 1886 Row.prototype.getY = function () { 1887 return this.y; 1888 }; 1889 Row.prototype.getA = function () { 1890 return this.a; 1891 }; 1892 Row.prototype.getB = function () { 1893 return this.b; 1894 }; 1895 Row.prototype.getC = function () { 1896 return this.c; 1897 }; 1898 Row.prototype.getD = function () { 1899 return this.d; 1900 }; 1901 Row.prototype.getFormulaA = function () { 1902 return this.formulaA; 1903 }; 1904 Row.prototype.getFormulaE = function () { 1905 return this.formulaE; 1906 }; 1907 Row.prototype.getIndex = function () { 1908 return this.index; 1909 }; 1910 return Row; 1911 }()); 1912 geometry.Row = Row; 1913 Row["__class"] = "com.mxgraph.io.vsdx.geometry.Row"; 1914 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 1915 })(vsdx = io.vsdx || (io.vsdx = {})); 1916 })(io = mxgraph.io || (mxgraph.io = {})); 1917 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 1918})(com || (com = {})); 1919(function (com) { 1920 var mxgraph; 1921 (function (mxgraph) { 1922 var io; 1923 (function (io) { 1924 var vsdx; 1925 (function (vsdx) { 1926 var geometry; 1927 (function (geometry) { 1928 var RowFactory = (function () { 1929 function RowFactory() { 1930 } 1931 /*private*/ RowFactory.getIndex = function (elem) { 1932 try { 1933 return parseInt(elem.getAttribute("IX")) || 1; 1934 } 1935 catch (e) { 1936 return 1; 1937 } 1938 ; 1939 }; 1940 /*private*/ RowFactory.getDoubleVal = function (val) { 1941 try { 1942 if (val != null && !(val.length === 0)) { 1943 var fVal = parseFloat(val); 1944 1945 if (isFinite(fVal)) 1946 return fVal; 1947 } 1948 } 1949 catch (e) { 1950 } 1951 ; 1952 return null; 1953 }; 1954 RowFactory.getRowObj = function (elem, pRows) { 1955 var rowType = elem.getAttribute("T"); 1956 var index = RowFactory.getIndex(elem); 1957 var del = elem.getAttribute("Del"); 1958 if (!(function (o1, o2) { if (o1 && o1.equals) { 1959 return o1.equals(o2); 1960 } 1961 else { 1962 return o1 === o2; 1963 } })(del, "1")) { 1964 var parentObj = null; 1965 if (index <= pRows.length) { 1966 parentObj = pRows[index - 1]; 1967 } 1968 var x = null; 1969 var y = null; 1970 var a = null; 1971 var b = null; 1972 var c = null; 1973 var d = null; 1974 var formulaE = null; 1975 var formulaA = null; 1976 if (parentObj != null) { 1977 x = parentObj.x; 1978 y = parentObj.y; 1979 a = parentObj.getA(); 1980 b = parentObj.getB(); 1981 c = parentObj.getC(); 1982 d = parentObj.getD(); 1983 formulaA = parentObj.getFormulaA(); 1984 formulaE = parentObj.getFormulaE(); 1985 } 1986 var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(elem); 1987 for (var index121 = 0; index121 < cells.length; index121++) { 1988 var cell = cells[index121]; 1989 { 1990 var name_1 = cell.getAttribute("N"); 1991 var val = cell.getAttribute("V"); 1992 switch ((name_1)) { 1993 case "X": 1994 x = RowFactory.getDoubleVal(val); 1995 break; 1996 case "Y": 1997 y = RowFactory.getDoubleVal(val); 1998 break; 1999 case "A": 2000 a = RowFactory.getDoubleVal(val); 2001 formulaA = cell.getAttribute("V"); 2002 break; 2003 case "B": 2004 b = RowFactory.getDoubleVal(val); 2005 break; 2006 case "C": 2007 c = RowFactory.getDoubleVal(val); 2008 break; 2009 case "D": 2010 d = RowFactory.getDoubleVal(val); 2011 break; 2012 case "E": 2013 formulaE = val; 2014 break; 2015 } 2016 } 2017 } 2018 switch ((rowType)) { 2019 case "MoveTo": 2020 return new com.mxgraph.io.vsdx.geometry.MoveTo(index, x, y); 2021 case "LineTo": 2022 return new com.mxgraph.io.vsdx.geometry.LineTo(index, x, y); 2023 case "ArcTo": 2024 return new com.mxgraph.io.vsdx.geometry.ArcTo(index, x, y, a); 2025 case "Ellipse": 2026 return new com.mxgraph.io.vsdx.geometry.Ellipse(index, x, y, a, b, c, d); 2027 case "EllipticalArcTo": 2028 return new com.mxgraph.io.vsdx.geometry.EllipticalArcTo(index, x, y, a, b, c, d); 2029 case "InfiniteLine": 2030 return new com.mxgraph.io.vsdx.geometry.InfiniteLine(index, x, y, a, b); 2031 case "NURBSTo": 2032 return new com.mxgraph.io.vsdx.geometry.NURBSTo(index, x, y, a, b, c, d, formulaE); 2033 case "PolylineTo": 2034 return new com.mxgraph.io.vsdx.geometry.PolylineTo(index, x, y, formulaA); 2035 case "RelCubBezTo": 2036 return new com.mxgraph.io.vsdx.geometry.RelCubBezTo(index, x, y, a, b, c, d); 2037 case "RelEllipticalArcTo": 2038 return new com.mxgraph.io.vsdx.geometry.RelEllipticalArcTo(index, x, y, a, b, c, d); 2039 case "RelLineTo": 2040 return new com.mxgraph.io.vsdx.geometry.RelLineTo(index, x, y); 2041 case "RelMoveTo": 2042 return new com.mxgraph.io.vsdx.geometry.RelMoveTo(index, x, y); 2043 case "RelQuadBezTo": 2044 return new com.mxgraph.io.vsdx.geometry.RelQuadBezTo(index, x, y, a, b); 2045 case "SplineKnot": 2046 return new com.mxgraph.io.vsdx.geometry.SplineKnot(index, x, y, a); 2047 case "SplineStart": 2048 return new com.mxgraph.io.vsdx.geometry.SplineStart(index, x, y, a, b, c, d); 2049 } 2050 } 2051 return new com.mxgraph.io.vsdx.geometry.DelRow(index); 2052 }; 2053 return RowFactory; 2054 }()); 2055 geometry.RowFactory = RowFactory; 2056 RowFactory["__class"] = "com.mxgraph.io.vsdx.geometry.RowFactory"; 2057 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 2058 })(vsdx = io.vsdx || (io.vsdx = {})); 2059 })(io = mxgraph.io || (mxgraph.io = {})); 2060 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 2061})(com || (com = {})); 2062(function (com) { 2063 var mxgraph; 2064 (function (mxgraph) { 2065 var io; 2066 (function (io) { 2067 var vsdx; 2068 (function (vsdx) { 2069 /** 2070 * This is a singleton class that stores various global properties to document.<br/> 2071 * The properties are: 2072 * <ul> 2073 * <li> 2074 * document's colors 2075 * </li> 2076 * <li> 2077 * document's fonts 2078 * </li> 2079 * <li> 2080 * default text style 2081 * </li> 2082 * <li> 2083 * default line style 2084 * </li> 2085 * <li> 2086 * default fill style 2087 * </li> 2088 * </ul> 2089 * @class 2090 */ 2091 var mxPropertiesManager = (function () { 2092 function mxPropertiesManager() { 2093 /** 2094 * Map with the document's colors.<br/> 2095 * The key is the index number and the value is the hex representation of the color. 2096 */ 2097 /*private*/ this.colorElementMap = ({}); 2098 /** 2099 * Map with the document's fonts.<br/> 2100 * The key is the ID and the value is the name of the font. 2101 */ 2102 /*private*/ this.fontElementMap = ({}); 2103 } 2104 mxPropertiesManager.__static_initialize = function () { if (!mxPropertiesManager.__static_initialized) { 2105 mxPropertiesManager.__static_initialized = true; 2106 mxPropertiesManager.__static_initializer_0(); 2107 } }; 2108 mxPropertiesManager.defaultColors_$LI$ = function () { mxPropertiesManager.__static_initialize(); if (mxPropertiesManager.defaultColors == null) 2109 mxPropertiesManager.defaultColors = ({}); return mxPropertiesManager.defaultColors; }; 2110 ; 2111 mxPropertiesManager.__static_initializer_0 = function () { 2112 /* put */ (mxPropertiesManager.defaultColors_$LI$()["0"] = "#000000"); 2113 /* put */ (mxPropertiesManager.defaultColors_$LI$()["1"] = "#FFFFFF"); 2114 /* put */ (mxPropertiesManager.defaultColors_$LI$()["2"] = "#FF0000"); 2115 /* put */ (mxPropertiesManager.defaultColors_$LI$()["3"] = "#00FF00"); 2116 /* put */ (mxPropertiesManager.defaultColors_$LI$()["4"] = "#0000FF"); 2117 /* put */ (mxPropertiesManager.defaultColors_$LI$()["5"] = "#FFFF00"); 2118 /* put */ (mxPropertiesManager.defaultColors_$LI$()["6"] = "#FF00FF"); 2119 /* put */ (mxPropertiesManager.defaultColors_$LI$()["7"] = "#00FFFF"); 2120 /* put */ (mxPropertiesManager.defaultColors_$LI$()["8"] = "#800000"); 2121 /* put */ (mxPropertiesManager.defaultColors_$LI$()["9"] = "#008000"); 2122 /* put */ (mxPropertiesManager.defaultColors_$LI$()["10"] = "#000080"); 2123 /* put */ (mxPropertiesManager.defaultColors_$LI$()["11"] = "#808000"); 2124 /* put */ (mxPropertiesManager.defaultColors_$LI$()["12"] = "#800080"); 2125 /* put */ (mxPropertiesManager.defaultColors_$LI$()["13"] = "#008080"); 2126 /* put */ (mxPropertiesManager.defaultColors_$LI$()["14"] = "#C0C0C0"); 2127 /* put */ (mxPropertiesManager.defaultColors_$LI$()["15"] = "#E6E6E6"); 2128 /* put */ (mxPropertiesManager.defaultColors_$LI$()["16"] = "#CDCDCD"); 2129 /* put */ (mxPropertiesManager.defaultColors_$LI$()["17"] = "#B3B3B3"); 2130 /* put */ (mxPropertiesManager.defaultColors_$LI$()["18"] = "#9A9A9A"); 2131 /* put */ (mxPropertiesManager.defaultColors_$LI$()["19"] = "#808080"); 2132 /* put */ (mxPropertiesManager.defaultColors_$LI$()["20"] = "#666666"); 2133 /* put */ (mxPropertiesManager.defaultColors_$LI$()["21"] = "#4D4D4D"); 2134 /* put */ (mxPropertiesManager.defaultColors_$LI$()["22"] = "#333333"); 2135 /* put */ (mxPropertiesManager.defaultColors_$LI$()["23"] = "#1A1A1A"); 2136 }; 2137 /** 2138 * Loads the properties of the document. 2139 * @param doc Document with the properties. 2140 * @param {*} elem 2141 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 2142 */ 2143 mxPropertiesManager.prototype.initialise = function (elem, model) { 2144 if (elem != null) { 2145 var vdxColors = elem.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.COLORS); 2146 if (vdxColors.length > 0) { 2147 var colors = vdxColors.item(0); 2148 var colorList = colors.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.COLOR_ENTRY); 2149 var colorLength = colorList.length; 2150 for (var i = 0; i < colorLength; i++) { 2151 var color = colorList.item(i); 2152 var colorId = color.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.INDEX); 2153 var colorValue = color.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.RGB); 2154 /* put */ (this.colorElementMap[colorId] = colorValue); 2155 } 2156 ; 2157 } 2158 var vdxFonts = elem.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.FACE_NAMES); 2159 if (vdxFonts.length > 0) { 2160 var fonts = vdxFonts.item(0); 2161 var fontList = fonts.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.FACE_NAME); 2162 var fontLength = fontList.length; 2163 for (var i = 0; i < fontLength; i++) { 2164 var font = fontList.item(i); 2165 var fontId = font.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID); 2166 var fontValue = font.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FONT_NAME); 2167 /* put */ (this.fontElementMap[fontId] = fontValue); 2168 } 2169 ; 2170 } 2171 } 2172 }; 2173 /** 2174 * Returns the color of index indicated in 'ix'. 2175 * @param {string} ix Index of the color. 2176 * @return {string} Hexadecimal representation of the color. 2177 */ 2178 mxPropertiesManager.prototype.getColor = function (ix) { 2179 var color = (function (m, k) { return m[k] ? m[k] : null; })(this.colorElementMap, ix); 2180 if (color == null) { 2181 color = (function (m, k) { return m[k] ? m[k] : null; })(mxPropertiesManager.defaultColors_$LI$(), ix); 2182 if (color == null) { 2183 return ""; 2184 } 2185 } 2186 return color; 2187 }; 2188 /** 2189 * Returns the font of id indicated in 'id' 2190 * @param {string} id font's ID 2191 * @return {string} Name of the font. 2192 */ 2193 mxPropertiesManager.prototype.getFont = function (id) { 2194 var font = (function (m, k) { return m[k] ? m[k] : null; })(this.fontElementMap, id); 2195 if (font == null) { 2196 return ""; 2197 } 2198 else { 2199 return font; 2200 } 2201 }; 2202 return mxPropertiesManager; 2203 }()); 2204 mxPropertiesManager.__static_initialized = false; 2205 vsdx.mxPropertiesManager = mxPropertiesManager; 2206 mxPropertiesManager["__class"] = "com.mxgraph.io.vsdx.mxPropertiesManager"; 2207 })(vsdx = io.vsdx || (io.vsdx = {})); 2208 })(io = mxgraph.io || (mxgraph.io = {})); 2209 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 2210})(com || (com = {})); 2211(function (com) { 2212 var mxgraph; 2213 (function (mxgraph) { 2214 var io; 2215 (function (io) { 2216 var vsdx; 2217 (function (vsdx) { 2218 /** 2219 * Wrapper for connect element 2220 * See https://msdn.microsoft.com/en-us/library/office/ff768299%28v=office.14%29.aspx 2221 * @param {*} connectElem 2222 * @class 2223 */ 2224 var mxVsdxConnect = (function () { 2225 function mxVsdxConnect(connectElem) { 2226 /** 2227 * ID of edge 2228 */ 2229 this.fromSheet = null; 2230 /** 2231 * ID of source 2232 */ 2233 this.sourceToSheet = null; 2234 /** 2235 * Where connection is made to source 2236 */ 2237 this.sourceToPart = -1; 2238 /** 2239 * ID of target 2240 */ 2241 this.targetToSheet = null; 2242 /** 2243 * Where connection is made to target 2244 */ 2245 this.targetToPart = -1; 2246 this.fromCell = null; 2247 this.endShape = null; 2248 var fromSheet = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FROM_SHEET); 2249 this.fromSheet = (fromSheet != null && !(fromSheet.length === 0)) ? parseFloat(fromSheet) : -1; 2250 var fromCell = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FROM_CELL); 2251 this.addFromCell(connectElem, fromCell); 2252 } 2253 mxVsdxConnect.prototype.addFromCell = function (connectElem, fromCell) { 2254 var toSheet = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TO_SHEET); 2255 var source = true; 2256 if (fromCell != null && (function (o1, o2) { if (o1 && o1.equals) { 2257 return o1.equals(o2); 2258 } 2259 else { 2260 return o1 === o2; 2261 } })(fromCell, com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_X)) { 2262 this.sourceToSheet = (toSheet != null && !(toSheet.length === 0)) ? parseFloat(toSheet) : -1; 2263 source = true; 2264 } 2265 else if (fromCell != null && (function (o1, o2) { if (o1 && o1.equals) { 2266 return o1.equals(o2); 2267 } 2268 else { 2269 return o1 === o2; 2270 } })(fromCell, com.mxgraph.io.vsdx.mxVsdxConstants.END_X)) { 2271 this.targetToSheet = (toSheet != null && !(toSheet.length === 0)) ? parseFloat(toSheet) : -1; 2272 source = false; 2273 } 2274 else if (this.sourceToSheet == null) { 2275 this.sourceToSheet = (toSheet != null && !(toSheet.length === 0)) ? parseFloat(toSheet) : -1; 2276 source = true; 2277 } 2278 else if (this.targetToSheet == null) { 2279 this.targetToSheet = (toSheet != null && !(toSheet.length === 0)) ? parseFloat(toSheet) : -1; 2280 source = false; 2281 } 2282 this.findToPart(connectElem, source); 2283 }; 2284 mxVsdxConnect.prototype.findToPart = function (connectElem, source) { 2285 var toPartString = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TO_PART); 2286 var toPart = (toPartString != null && !(toPartString.length === 0)) ? parseFloat(toPartString) : -1; 2287 if (source) { 2288 this.sourceToPart = toPart; 2289 } 2290 else { 2291 this.targetToPart = toPart; 2292 } 2293 }; 2294 mxVsdxConnect.prototype.getFromSheet = function () { 2295 return this.fromSheet; 2296 }; 2297 mxVsdxConnect.prototype.getSourceToSheet = function () { 2298 return this.sourceToSheet; 2299 }; 2300 mxVsdxConnect.prototype.getTargetToSheet = function () { 2301 return this.targetToSheet; 2302 }; 2303 mxVsdxConnect.prototype.getSourceToPart = function () { 2304 return this.sourceToPart; 2305 }; 2306 mxVsdxConnect.prototype.getTargetToPart = function () { 2307 return this.targetToPart; 2308 }; 2309 /** 2310 * 2311 * @param {*} connectElem 2312 */ 2313 mxVsdxConnect.prototype.addConnect = function (connectElem) { 2314 this.endShape = connectElem; 2315 var fromCell = connectElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FROM_CELL); 2316 this.addFromCell(connectElem, fromCell); 2317 }; 2318 return mxVsdxConnect; 2319 }()); 2320 vsdx.mxVsdxConnect = mxVsdxConnect; 2321 mxVsdxConnect["__class"] = "com.mxgraph.io.vsdx.mxVsdxConnect"; 2322 })(vsdx = io.vsdx || (io.vsdx = {})); 2323 })(io = mxgraph.io || (mxgraph.io = {})); 2324 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 2325})(com || (com = {})); 2326(function (com) { 2327 var mxgraph; 2328 (function (mxgraph) { 2329 var io; 2330 (function (io) { 2331 var vsdx; 2332 (function (vsdx) { 2333 /** 2334 * This class contains constants used in the Import of .vdx documents. 2335 * @class 2336 */ 2337 var mxVsdxConstants = (function () { 2338 function mxVsdxConstants() { 2339 } 2340 mxVsdxConstants.SET_VALUES_$LI$ = function () { if (mxVsdxConstants.SET_VALUES == null) 2341 mxVsdxConstants.SET_VALUES = ["a", "b"]; return mxVsdxConstants.SET_VALUES; }; 2342 ; 2343 mxVsdxConstants.MY_SET_$LI$ = function () { if (mxVsdxConstants.MY_SET == null) 2344 mxVsdxConstants.MY_SET = (mxVsdxConstants.SET_VALUES_$LI$().slice(0).slice(0)); return mxVsdxConstants.MY_SET; }; 2345 ; 2346 return mxVsdxConstants; 2347 }()); 2348 mxVsdxConstants.ANGLE = "Angle"; 2349 mxVsdxConstants.ARC_TO = "ArcTo"; 2350 mxVsdxConstants.BACKGROUND = "Background"; 2351 mxVsdxConstants.BACK_PAGE = "BackPage"; 2352 mxVsdxConstants.BEGIN_ARROW = "BeginArrow"; 2353 mxVsdxConstants.BEGIN_ARROW_SIZE = "BeginArrowSize"; 2354 mxVsdxConstants.BEGIN_X = "BeginX"; 2355 mxVsdxConstants.BEGIN_Y = "BeginY"; 2356 mxVsdxConstants.BOTTOM_MARGIN = "BottomMargin"; 2357 mxVsdxConstants.BULLET = "Bullet"; 2358 mxVsdxConstants.CASE = "Case"; 2359 mxVsdxConstants.CHARACTER = "Character"; 2360 mxVsdxConstants.COLOR = "Color"; 2361 mxVsdxConstants.COLOR_ENTRY = "ColorEntry"; 2362 mxVsdxConstants.COLORS = "Colors"; 2363 /** 2364 * Specifies the color transparency used for characters in a text run. 2365 * The value is normalized such that a value of 1 corresponds to 100 percent. 2366 * A value of zero specifies that the color is completely opaque; 2367 * a value of one specifies that the color is completely transparent. 2368 */ 2369 mxVsdxConstants.COLOR_TRANS = "ColorTrans"; 2370 mxVsdxConstants.CONNECT = "Connect"; 2371 mxVsdxConstants.CONNECTS = "Connects"; 2372 mxVsdxConstants.CONNECTION = "Connection"; 2373 mxVsdxConstants.CONTROL = "Control"; 2374 mxVsdxConstants.DELETED = "Del"; 2375 mxVsdxConstants.DOCUMENT_SHEET = "DocumentSheet"; 2376 mxVsdxConstants.ELLIPSE = "Ellipse"; 2377 mxVsdxConstants.ELLIPTICAL_ARC_TO = "EllipticalArcTo"; 2378 mxVsdxConstants.END_ARROW = "EndArrow"; 2379 mxVsdxConstants.END_ARROW_SIZE = "EndArrowSize"; 2380 mxVsdxConstants.END_X = "EndX"; 2381 mxVsdxConstants.END_Y = "EndY"; 2382 mxVsdxConstants.FACE_NAME = "FaceName"; 2383 mxVsdxConstants.FACE_NAMES = "FaceNames"; 2384 mxVsdxConstants.FALSE = "0"; 2385 mxVsdxConstants.FILL = "Fill"; 2386 mxVsdxConstants.FILL_BKGND = "FillBkgnd"; 2387 mxVsdxConstants.FILL_BKGND_TRANS = "FillBkgndTrans"; 2388 mxVsdxConstants.FILL_FOREGND = "FillForegnd"; 2389 mxVsdxConstants.FILL_FOREGND_TRANS = "FillForegndTrans"; 2390 mxVsdxConstants.FILL_PATTERN = "FillPattern"; 2391 mxVsdxConstants.FILL_STYLE = "FillStyle"; 2392 mxVsdxConstants.FILL_GRADIENT_ENABLED = "FillGradientEnabled"; 2393 mxVsdxConstants.FLAGS = "Flags"; 2394 mxVsdxConstants.FLIP_X = "FlipX"; 2395 mxVsdxConstants.FLIP_Y = "FlipY"; 2396 mxVsdxConstants.FONT = "Font"; 2397 mxVsdxConstants.FONT_NAME = "Name"; 2398 mxVsdxConstants.FOREIGN = "Foreign"; 2399 mxVsdxConstants.FROM_CELL = "FromCell"; 2400 mxVsdxConstants.FROM_SHEET = "FromSheet"; 2401 mxVsdxConstants.GEOM = "Geom"; 2402 mxVsdxConstants.HEIGHT = "Height"; 2403 mxVsdxConstants.HORIZONTAL_ALIGN = "HorzAlign"; 2404 mxVsdxConstants.ID = "ID"; 2405 mxVsdxConstants.INDENT_FIRST = "IndFirst"; 2406 mxVsdxConstants.INDENT_LEFT = "IndLeft"; 2407 mxVsdxConstants.INDENT_RIGHT = "IndRight"; 2408 mxVsdxConstants.INDEX = "IX"; 2409 mxVsdxConstants.LEFT_MARGIN = "LeftMargin"; 2410 mxVsdxConstants.LETTER_SPACE = "Letterspace"; 2411 mxVsdxConstants.LINE = "Line"; 2412 mxVsdxConstants.LINE_COLOR = "LineColor"; 2413 mxVsdxConstants.LINE_COLOR_TRANS = "LineColorTrans"; 2414 mxVsdxConstants.LINE_PATTERN = "LinePattern"; 2415 mxVsdxConstants.LINE_STYLE = "LineStyle"; 2416 mxVsdxConstants.LINE_TO = "LineTo"; 2417 mxVsdxConstants.LINE_WEIGHT = "LineWeight"; 2418 mxVsdxConstants.LOC_PIN_X = "LocPinX"; 2419 mxVsdxConstants.LOC_PIN_Y = "LocPinY"; 2420 mxVsdxConstants.MASTER = "Master"; 2421 mxVsdxConstants.MASTER_SHAPE = "MasterShape"; 2422 mxVsdxConstants.MASTERS = "Masters"; 2423 mxVsdxConstants.MOVE_TO = "MoveTo"; 2424 mxVsdxConstants.NAME = "Name"; 2425 mxVsdxConstants.NAME_U = "NameU"; 2426 mxVsdxConstants.NO_LINE = "NoLine"; 2427 mxVsdxConstants.NURBS_TO = "NURBSTo"; 2428 mxVsdxConstants.PAGE = "Page"; 2429 mxVsdxConstants.PAGE_HEIGHT = "PageHeight"; 2430 mxVsdxConstants.PAGE_WIDTH = "PageWidth"; 2431 mxVsdxConstants.PAGES = "Pages"; 2432 mxVsdxConstants.PARAGRAPH = "Paragraph"; 2433 mxVsdxConstants.PIN_X = "PinX"; 2434 mxVsdxConstants.PIN_Y = "PinY"; 2435 mxVsdxConstants.POS = "Pos"; 2436 mxVsdxConstants.RGB = "RGB"; 2437 mxVsdxConstants.RIGHT_MARGIN = "RightMargin"; 2438 mxVsdxConstants.ROUNDING = "Rounding"; 2439 mxVsdxConstants.RTL_TEXT = "RTLText"; 2440 mxVsdxConstants.SIZE = "Size"; 2441 mxVsdxConstants.SHAPE = "Shape"; 2442 mxVsdxConstants.SHAPES = "Shapes"; 2443 mxVsdxConstants.SHAPE_SHDW_SHOW = "ShapeShdwShow"; 2444 mxVsdxConstants.SHDW_PATTERN = "ShdwPattern"; 2445 mxVsdxConstants.SPACE_AFTER = "SpAfter"; 2446 mxVsdxConstants.SPACE_BEFORE = "SpBefore"; 2447 mxVsdxConstants.SPACE_LINE = "SpLine"; 2448 mxVsdxConstants.STRIKETHRU = "Strikethru"; 2449 mxVsdxConstants.STYLE = "Style"; 2450 mxVsdxConstants.STYLE_SHEET = "StyleSheet"; 2451 mxVsdxConstants.STYLE_SHEETS = "StyleSheets"; 2452 mxVsdxConstants.TEXT = "Text"; 2453 mxVsdxConstants.TEXT_BKGND = "TextBkgnd"; 2454 mxVsdxConstants.TEXT_BLOCK = "TextBlock"; 2455 mxVsdxConstants.TEXT_STYLE = "TextStyle"; 2456 mxVsdxConstants.TO_PART = "ToPart"; 2457 mxVsdxConstants.TO_SHEET = "ToSheet"; 2458 mxVsdxConstants.TOP_MARGIN = "TopMargin"; 2459 mxVsdxConstants.TRUE = "1"; 2460 mxVsdxConstants.TXT_ANGLE = "TxtAngle"; 2461 mxVsdxConstants.TXT_HEIGHT = "TxtHeight"; 2462 mxVsdxConstants.TXT_LOC_PIN_X = "TxtLocPinX"; 2463 mxVsdxConstants.TXT_LOC_PIN_Y = "TxtLocPinY"; 2464 mxVsdxConstants.TXT_PIN_X = "TxtPinX"; 2465 mxVsdxConstants.TXT_PIN_Y = "TxtPinY"; 2466 mxVsdxConstants.TXT_WIDTH = "TxtWidth"; 2467 mxVsdxConstants.TYPE = "Type"; 2468 mxVsdxConstants.TYPE_GROUP = "Group"; 2469 mxVsdxConstants.TYPE_SHAPE = "Shape"; 2470 mxVsdxConstants.UNIQUE_ID = "UniqueID"; 2471 mxVsdxConstants.VERTICAL_ALIGN = "VerticalAlign"; 2472 mxVsdxConstants.WIDTH = "Width"; 2473 mxVsdxConstants.X_CON = "XCon"; 2474 mxVsdxConstants.X_DYN = "XDyn"; 2475 mxVsdxConstants.X = "X"; 2476 mxVsdxConstants.Y_CON = "YCon"; 2477 mxVsdxConstants.Y_DYN = "YDyn"; 2478 mxVsdxConstants.Y = "Y"; 2479 mxVsdxConstants.HIDE_TEXT = "HideText"; 2480 mxVsdxConstants.VSDX_ID = "vsdxID"; 2481 mxVsdxConstants.CONNECT_TO_PART_WHOLE_SHAPE = 3; 2482 vsdx.mxVsdxConstants = mxVsdxConstants; 2483 mxVsdxConstants["__class"] = "com.mxgraph.io.vsdx.mxVsdxConstants"; 2484 })(vsdx = io.vsdx || (io.vsdx = {})); 2485 })(io = mxgraph.io || (mxgraph.io = {})); 2486 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 2487})(com || (com = {})); 2488(function (com) { 2489 var mxgraph; 2490 (function (mxgraph) { 2491 var io; 2492 (function (io) { 2493 var vsdx; 2494 (function (vsdx) { 2495 var mxVsdxGeometry = (function () { 2496 function mxVsdxGeometry(elem, parentGeo) { 2497 var _this = this; 2498 /*private*/ this.noFill = false; 2499 /*private*/ this.noLine = false; 2500 /*private*/ this.noShow = false; 2501 /*private*/ this.noSnap = false; 2502 /*private*/ this.noQuickDrag = false; 2503 /*private*/ this.rows = null; 2504 if (((elem != null && elem.nodeType == 1) || elem === null) && ((parentGeo != null && (parentGeo instanceof Array)) || parentGeo === null)) { 2505 var __args = Array.prototype.slice.call(arguments); 2506 this.index = 0; 2507 this.noFill = false; 2508 this.noLine = false; 2509 this.noShow = false; 2510 this.noSnap = false; 2511 this.noQuickDrag = false; 2512 this.rows = null; 2513 this.index = 0; 2514 (function () { 2515 _this.index = _this.getIndex$org_w3c_dom_Element(elem); 2516 if (parentGeo != null && _this.index < parentGeo.length) { 2517 _this.inheritGeo(/* get */ parentGeo[_this.index]); 2518 } 2519 _this.processGeoElem(elem); 2520 })(); 2521 } 2522 else if (((elem != null && (elem.nodeType == 1)) || elem === null) && parentGeo === undefined) { 2523 var __args = Array.prototype.slice.call(arguments); 2524 this.index = 0; 2525 this.noFill = false; 2526 this.noLine = false; 2527 this.noShow = false; 2528 this.noSnap = false; 2529 this.noQuickDrag = false; 2530 this.rows = null; 2531 this.index = 0; 2532 (function () { 2533 _this.index = _this.getIndex$org_w3c_dom_Element(elem); 2534 _this.processGeoElem(elem); 2535 })(); 2536 } 2537 else 2538 throw new Error('invalid overload'); 2539 } 2540 mxVsdxGeometry.prototype.getIndex$org_w3c_dom_Element = function (elem) { 2541 try { 2542 return parseInt(elem.getAttribute("IX")) || 0; 2543 } 2544 catch (e) { 2545 return 0; 2546 } 2547 ; 2548 }; 2549 mxVsdxGeometry.prototype.getIndex = function (elem) { 2550 if (((elem != null && (elem.nodeType == 1)) || elem === null)) { 2551 return this.getIndex$org_w3c_dom_Element(elem); 2552 } 2553 else if (elem === undefined) { 2554 return this.getIndex$(); 2555 } 2556 else 2557 throw new Error('invalid overload'); 2558 }; 2559 /*private*/ mxVsdxGeometry.prototype.processGeoElem = function (elem) { 2560 var cellElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(elem, "Cell"); 2561 var rowElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(elem, "Row"); 2562 if (this.rows == null) { 2563 this.rows = ([]); 2564 for (var i = 0; i < rowElems.length; i++) { 2565 /* add */ (this.rows.push(null)); 2566 } 2567 ; 2568 } 2569 for (var index122 = 0; index122 < cellElems.length; index122++) { 2570 var cellElem = cellElems[index122]; 2571 { 2572 var name_2 = cellElem.getAttribute("N"); 2573 var val = cellElem.getAttribute("V"); 2574 switch ((name_2)) { 2575 case "NoFill": 2576 this.noFill = (function (o1, o2) { if (o1 && o1.equals) { 2577 return o1.equals(o2); 2578 } 2579 else { 2580 return o1 === o2; 2581 } })("1", val); 2582 break; 2583 case "NoLine": 2584 this.noLine = (function (o1, o2) { if (o1 && o1.equals) { 2585 return o1.equals(o2); 2586 } 2587 else { 2588 return o1 === o2; 2589 } })("1", val); 2590 break; 2591 case "NoShow": 2592 this.noShow = (function (o1, o2) { if (o1 && o1.equals) { 2593 return o1.equals(o2); 2594 } 2595 else { 2596 return o1 === o2; 2597 } })("1", val); 2598 break; 2599 case "NoSnap": 2600 this.noSnap = (function (o1, o2) { if (o1 && o1.equals) { 2601 return o1.equals(o2); 2602 } 2603 else { 2604 return o1 === o2; 2605 } })("1", val); 2606 break; 2607 case "NoQuickDrag": 2608 this.noQuickDrag = (function (o1, o2) { if (o1 && o1.equals) { 2609 return o1.equals(o2); 2610 } 2611 else { 2612 return o1 === o2; 2613 } })("1", val); 2614 break; 2615 } 2616 } 2617 } 2618 var rowsLen = this.rows.length; 2619 var sortNeeded = false; 2620 for (var index123 = 0; index123 < rowElems.length; index123++) { 2621 var rowElem = rowElems[index123]; 2622 { 2623 var row = com.mxgraph.io.vsdx.geometry.RowFactory.getRowObj(rowElem, this.rows); 2624 if (row.getIndex() > rowsLen) { 2625 /* add */ (this.rows.push(row)); 2626 sortNeeded = true; 2627 } 2628 else { 2629 /* set */ (this.rows[row.getIndex() - 1] = row); 2630 } 2631 } 2632 } 2633 if (sortNeeded) { 2634 /* sort */ (function (l, c) { if (c.compare) 2635 l.sort(function (e1, e2) { return c.compare(e1, e2); }); 2636 else 2637 l.sort(c); })(this.rows, new mxVsdxGeometry.mxVsdxGeometry$0(this)); 2638 } 2639 }; 2640 /*private*/ mxVsdxGeometry.prototype.inheritGeo = function (parent) { 2641 this.noFill = parent.noFill; 2642 this.noLine = parent.noLine; 2643 this.noShow = parent.noShow; 2644 this.noSnap = parent.noSnap; 2645 this.noQuickDrag = parent.noQuickDrag; 2646 this.rows = ([]); 2647 /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(this.rows, parent.rows); 2648 }; 2649 mxVsdxGeometry.prototype.getIndex$ = function () { 2650 return this.index; 2651 }; 2652 mxVsdxGeometry.prototype.isNoFill = function () { 2653 return this.noFill; 2654 }; 2655 mxVsdxGeometry.prototype.isNoLine = function () { 2656 return this.noLine; 2657 }; 2658 mxVsdxGeometry.prototype.isNoShow = function () { 2659 return this.noShow; 2660 }; 2661 mxVsdxGeometry.prototype.isNoSnap = function () { 2662 return this.noSnap; 2663 }; 2664 mxVsdxGeometry.prototype.isNoQuickDrag = function () { 2665 return this.noQuickDrag; 2666 }; 2667 mxVsdxGeometry.prototype.getRows = function () { 2668 return this.rows; 2669 }; 2670 mxVsdxGeometry.prototype.getPathXML = function (p, shape) { 2671 if (this.noShow) 2672 return ""; 2673 var geomElemParsed = { str: "", toString: function () { return this.str; } }; 2674 var _loop_1 = function (index124) { 2675 var row = this_1.rows[index124]; 2676 { 2677 /* append */ 2678 (function (sb) 2679 { 2680 //Some files has null rows 2681 return sb.str = sb.str.concat(row != null? row.handle(p, shape) : ''); 2682 })(geomElemParsed); 2683 } 2684 }; 2685 var this_1 = this; 2686 for (var index124 = 0; index124 < this.rows.length; index124++) { 2687 _loop_1(index124); 2688 } 2689 return geomElemParsed.str; 2690 }; 2691 return mxVsdxGeometry; 2692 }()); 2693 vsdx.mxVsdxGeometry = mxVsdxGeometry; 2694 mxVsdxGeometry["__class"] = "com.mxgraph.io.vsdx.mxVsdxGeometry"; 2695 (function (mxVsdxGeometry) { 2696 var mxVsdxGeometry$0 = (function () { 2697 function mxVsdxGeometry$0(__parent) { 2698 this.__parent = __parent; 2699 } 2700 /** 2701 * 2702 * @param {com.mxgraph.io.vsdx.geometry.Row} r1 2703 * @param {com.mxgraph.io.vsdx.geometry.Row} r2 2704 * @return {number} 2705 */ 2706 mxVsdxGeometry$0.prototype.compare = function (r1, r2) { 2707 //Some files has null rows 2708 var r1i = r1 != null? r1.getIndex() : 0; 2709 var r2i = r2 != null? r2.getIndex() : 0; 2710 2711 return r1i - r2i; 2712 }; 2713 return mxVsdxGeometry$0; 2714 }()); 2715 mxVsdxGeometry.mxVsdxGeometry$0 = mxVsdxGeometry$0; 2716 mxVsdxGeometry$0["__interfaces"] = ["java.util.Comparator"]; 2717 })(mxVsdxGeometry = vsdx.mxVsdxGeometry || (vsdx.mxVsdxGeometry = {})); 2718 })(vsdx = io.vsdx || (io.vsdx = {})); 2719 })(io = mxgraph.io || (mxgraph.io = {})); 2720 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 2721})(com || (com = {})); 2722(function (com) { 2723 var mxgraph; 2724 (function (mxgraph) { 2725 var io; 2726 (function (io) { 2727 var vsdx; 2728 (function (vsdx) { 2729 var mxVsdxGeometryList = (function () { 2730 function mxVsdxGeometryList(parentGeoList) { 2731 /*private*/ this.geomList = ([]); 2732 /*private*/ this.parentGeomList = null; 2733 /*private*/ this.sortNeeded = false; 2734 if (parentGeoList != null) { 2735 this.parentGeomList = parentGeoList.geomList; 2736 /* addAll */ (function (l1, l2) { return l1.push.apply(l1, l2); })(this.geomList, parentGeoList.geomList); 2737 } 2738 } 2739 mxVsdxGeometryList.prototype.addGeometry = function (geoElem) { 2740 var geo = new com.mxgraph.io.vsdx.mxVsdxGeometry(geoElem, this.parentGeomList); 2741 if (geo.getIndex() < this.geomList.length) { 2742 /* set */ (this.geomList[geo.getIndex()] = geo); 2743 } 2744 else { 2745 /* add */ (this.geomList.push(geo)); 2746 this.sortNeeded = true; 2747 } 2748 }; 2749 /*private*/ mxVsdxGeometryList.prototype.sort = function () { 2750 if (this.sortNeeded) { 2751 /* sort */ (function (l, c) { if (c.compare) 2752 l.sort(function (e1, e2) { return c.compare(e1, e2); }); 2753 else 2754 l.sort(c); })(this.geomList, new mxVsdxGeometryList.mxVsdxGeometryList$0(this)); 2755 this.sortNeeded = false; 2756 } 2757 }; 2758 mxVsdxGeometryList.prototype.isNoShow = function () { 2759 for (var index125 = 0; index125 < this.geomList.length; index125++) { 2760 var geo = this.geomList[index125]; 2761 { 2762 if (!geo.isNoShow()) 2763 return false; 2764 } 2765 } 2766 return true; 2767 }; 2768 mxVsdxGeometryList.prototype.isNoFill = function () { 2769 for (var index126 = 0; index126 < this.geomList.length; index126++) { 2770 var geo = this.geomList[index126]; 2771 { 2772 if (!(geo.isNoShow() || geo.isNoFill())) 2773 return false; 2774 } 2775 } 2776 return true; 2777 }; 2778 mxVsdxGeometryList.prototype.isNoLine = function () { 2779 for (var index127 = 0; index127 < this.geomList.length; index127++) { 2780 var geo = this.geomList[index127]; 2781 { 2782 if (!(geo.isNoShow() || geo.isNoLine())) 2783 return false; 2784 } 2785 } 2786 return true; 2787 }; 2788 mxVsdxGeometryList.prototype.hasGeom = function () { 2789 return !(this.geomList.length == 0); 2790 }; 2791 2792 mxVsdxGeometryList.prototype.getGeoCount = function () { 2793 var count = 0; 2794 2795 for (var i = 0; i < this.geomList.length; i++) 2796 { 2797 if (!this.geomList[i].isNoShow()) 2798 count++; 2799 } 2800 2801 return count; 2802 }; 2803 /*private*/ mxVsdxGeometryList.prototype.rotatedPoint = function (pt, cos, sin) { 2804 var x1 = pt.x * cos - pt.y * sin; 2805 var y1 = pt.y * cos + pt.x * sin; 2806 pt.x = (x1); 2807 pt.y = (y1); 2808 }; 2809 /** 2810 * Returns the list of routing points of a edge shape. 2811 * @param {number} parentHeight Height of the parent of the shape. 2812 * @return {mxPoint[]} List of mxPoint that represents the routing points. 2813 * @param {mxPoint} startPoint 2814 * @param {number} rotation 2815 */ 2816 mxVsdxGeometryList.prototype.getRoutingPoints = function (parentHeight, startPoint, rotation) { 2817 this.sort(); 2818 var points = ([]); 2819 /* add */ (points.push(startPoint.clone())); 2820 var offsetX = 0; 2821 var offsetY = 0; 2822 for (var index128 = 0; index128 < this.geomList.length; index128++) { 2823 var geo = this.geomList[index128]; 2824 { 2825 if (!geo.isNoShow()) { 2826 var rows = geo.getRows(); 2827 for (var index129 = 0; index129 < rows.length; index129++) { 2828 var row = rows[index129]; 2829 { 2830 //FIXME We don't support a moveTo inside the edge path 2831 if (index129 == 0 && row != null && row instanceof com.mxgraph.io.vsdx.geometry.MoveTo) { 2832 offsetX = row.x != null ? row.x : 0; 2833 offsetY = row.y != null ? row.y : 0; 2834 } 2835 else if (row != null && row instanceof com.mxgraph.io.vsdx.geometry.LineTo) { 2836 var x = row.x != null ? row.x : 0; 2837 var y = row.y != null ? row.y : 0; 2838 var p = new mxPoint(x, y); 2839 if (rotation !== 0) { 2840 rotation = (function (x) { return x * Math.PI / 180; })(360 - rotation); 2841 this.rotatedPoint(p, Math.cos(rotation), Math.sin(rotation)); 2842 } 2843 x = (p.x - offsetX) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 2844 x += startPoint.x; 2845 y = ((p.y - offsetY) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$()) * -1; 2846 y += startPoint.y; 2847 x = Math.round(x * 100.0) / 100.0; 2848 y = Math.round(y * 100.0) / 100.0; 2849 p.x = (x); 2850 p.y = (y); 2851 /* add */ (points.push(p)); 2852 } 2853 } 2854 } 2855 } 2856 } 2857 } 2858 return points; 2859 }; 2860 mxVsdxGeometryList.prototype.getShapeXML = function (shape) { 2861 var p = new mxPoint(0, 0); 2862 var parsedGeom = { str: "<shape strokewidth=\"inherit\"><foreground>", toString: function () { return this.str; } }; 2863 var initSize = parsedGeom.str.length; 2864 var lastGeoStyle = -1; 2865 lastGeoStyle = this.processGeo(shape, p, parsedGeom, lastGeoStyle, true); 2866 lastGeoStyle = this.processGeo(shape, p, parsedGeom, lastGeoStyle, false); 2867 if (parsedGeom.str.length === initSize) { 2868 return ""; 2869 } 2870 else { 2871 this.closePath(parsedGeom, lastGeoStyle); 2872 } 2873 /* append */ (function (sb) { return sb.str = sb.str.concat("</foreground></shape>"); })(parsedGeom); 2874 2875 //If the geomertry has no move, it will cause errors in SVG. So, ignore this shape 2876 //A path with no move in the beginning is invalid 2877 //https://www.w3.org/TR/SVG11/paths.html#PathDataMovetoCommands 2878 //https://stackoverflow.com/questions/56275231/do-all-svg-paths-have-to-start-with-a-move 2879 //TODO Find a faster technique, then enable this 2880 /*if (parsedGeom.str.indexOf('<move') < 0) 2881 { 2882 return ''; 2883 }*/ 2884 2885 return parsedGeom.str; 2886 }; 2887 /*private*/ mxVsdxGeometryList.prototype.processGeo = function (shape, p, parsedGeom, lastGeoStyle, withFill) { 2888 var rounding = shape.getRounding(); 2889 var roundingStr = ''; 2890 2891 if (rounding > 0) 2892 { 2893 roundingStr = ' rounded="1" arcSize="' + (rounding * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor) + '" '; 2894 } 2895 2896 var _loop_2 = function (index130) { 2897 var geo = this_2.geomList[index130]; 2898 { 2899 if (withFill === geo.isNoFill()) 2900 return "continue"; 2901 var str_1 = geo.getPathXML(p, shape); 2902 if (!(str_1.length === 0)) { 2903 var geoStyle = this_2.getGeoStyle(geo); 2904 if (lastGeoStyle === -1) { 2905 /* append */ (function (sb) { return sb.str = sb.str.concat("<path" + roundingStr + ">"); })(parsedGeom); 2906 /* append */ (function (sb) { return sb.str = sb.str.concat(str_1); })(parsedGeom); 2907 } 2908 else if (lastGeoStyle !== geoStyle) { 2909 this_2.closePath(parsedGeom, lastGeoStyle); 2910 /* append */ (function (sb) { return sb.str = sb.str.concat("<path" + roundingStr + ">"); })(parsedGeom); 2911 /* append */ (function (sb) { return sb.str = sb.str.concat(str_1); })(parsedGeom); 2912 } 2913 else { 2914 /* append */ (function (sb) { return sb.str = sb.str.concat(str_1); })(parsedGeom); 2915 } 2916 lastGeoStyle = geoStyle; 2917 } 2918 } 2919 }; 2920 var this_2 = this; 2921 for (var index130 = 0; index130 < this.geomList.length; index130++) { 2922 _loop_2(index130); 2923 } 2924 return lastGeoStyle; 2925 }; 2926 /*private*/ mxVsdxGeometryList.prototype.getGeoStyle = function (geo) { 2927 var geoStyle = 0; 2928 if (!geo.isNoLine() && !geo.isNoFill()) { 2929 geoStyle = 1; 2930 } 2931 else if (!geo.isNoFill()) { 2932 geoStyle = 2; 2933 } 2934 else if (!geo.isNoLine()) { 2935 geoStyle = 3; 2936 } 2937 return geoStyle; 2938 }; 2939 /*private*/ mxVsdxGeometryList.prototype.closePath = function (parsedGeom, geoStyle) { 2940 /* append */ (function (sb) { return sb.str = sb.str.concat("</path>"); })(parsedGeom); 2941 if (geoStyle === 1) { 2942 /* append */ (function (sb) { return sb.str = sb.str.concat("<fillstroke/>"); })(parsedGeom); 2943 } 2944 else if (geoStyle === 2) { 2945 /* append */ (function (sb) { return sb.str = sb.str.concat("<fill/>"); })(parsedGeom); 2946 } 2947 else if (geoStyle === 3) { 2948 /* append */ (function (sb) { return sb.str = sb.str.concat("<stroke/>"); })(parsedGeom); 2949 } 2950 }; 2951 return mxVsdxGeometryList; 2952 }()); 2953 vsdx.mxVsdxGeometryList = mxVsdxGeometryList; 2954 mxVsdxGeometryList["__class"] = "com.mxgraph.io.vsdx.mxVsdxGeometryList"; 2955 (function (mxVsdxGeometryList) { 2956 var mxVsdxGeometryList$0 = (function () { 2957 function mxVsdxGeometryList$0(__parent) { 2958 this.__parent = __parent; 2959 } 2960 /** 2961 * 2962 * @param {com.mxgraph.io.vsdx.mxVsdxGeometry} g1 2963 * @param {com.mxgraph.io.vsdx.mxVsdxGeometry} g2 2964 * @return {number} 2965 */ 2966 mxVsdxGeometryList$0.prototype.compare = function (g1, g2) { 2967 return g1.getIndex() - g2.getIndex(); 2968 }; 2969 return mxVsdxGeometryList$0; 2970 }()); 2971 mxVsdxGeometryList.mxVsdxGeometryList$0 = mxVsdxGeometryList$0; 2972 mxVsdxGeometryList$0["__interfaces"] = ["java.util.Comparator"]; 2973 })(mxVsdxGeometryList = vsdx.mxVsdxGeometryList || (vsdx.mxVsdxGeometryList = {})); 2974 })(vsdx = io.vsdx || (io.vsdx = {})); 2975 })(io = mxgraph.io || (mxgraph.io = {})); 2976 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 2977})(com || (com = {})); 2978(function (com) { 2979 var mxgraph; 2980 (function (mxgraph) { 2981 var io; 2982 (function (io) { 2983 var vsdx; 2984 (function (vsdx) { 2985 /** 2986 * Create a new instance of mxMasterElement and retrieves all the shapes contained 2987 * in the Master element. 2988 * @param {*} m Master Element to be wrapped. 2989 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 2990 * @class 2991 */ 2992 var mxVsdxMaster = (function () { 2993 function mxVsdxMaster(m, model) { 2994 /** 2995 * Unique ID of the element within its parent element 2996 */ 2997 this.Id = null; 2998 this.masterShape = null; 2999 this.childShapes = ({}); 3000 this.master = null; 3001 this.master = m; 3002 this.Id = m.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID) || ""; 3003 this.processMasterShapes(model); 3004 } 3005 /** 3006 * Retrieves and wraps all the shapes contained in the 'shape' param.<br/> 3007 * This method is recursive, it retrieves the subshapes of the shapes too. 3008 * @param shape Shape from which the subshapes are retrieved. 3009 * @return {void} Map with the shapes wrapped in instances of mxMasterShape. 3010 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 3011 */ 3012 mxVsdxMaster.prototype.processMasterShapes = function (model) { 3013 var child = this.master.firstChild; 3014 while ((child != null)) { 3015 if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3016 return o1.equals(o2); 3017 } 3018 else { 3019 return o1 === o2; 3020 } })(child.nodeName, "Rel")) { 3021 var relElem = model.getRelationship(child.getAttribute("r:id"), com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/masters/_rels/masters.xml.rels"); 3022 var target = relElem.getAttribute("Target"); 3023 var type = relElem.getAttribute("Type"); 3024 var masterDoc = null; 3025 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")) { 3026 masterDoc = model.getXmlDoc(com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/masters/" + target); 3027 } 3028 if (masterDoc != null) { 3029 var masterChild = masterDoc.firstChild; 3030 while ((masterChild != null)) { 3031 if ((masterChild != null && (masterChild.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3032 return o1.equals(o2); 3033 } 3034 else { 3035 return o1 === o2; 3036 } })(masterChild.nodeName, "MasterContents")) { 3037 this.processMasterShape(masterChild, model); 3038 break; 3039 } 3040 masterChild = masterChild.nextSibling; 3041 } 3042 ; 3043 } 3044 } 3045 else if (child.nodeType == 1 && child.nodeName == "PageSheet") 3046 { 3047 this.pageSheet = {}; 3048 var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(child, "Cell"); 3049 3050 for (var i = 0; i < cells.length; i++) 3051 { 3052 this.pageSheet[cells[i].getAttribute("N")] = cells[i]; 3053 } 3054 } 3055 child = child.nextSibling; 3056 } 3057 ; 3058 }; 3059 /** 3060 * Retrieves and wraps all the shapes contained in the 'shape' param.<br/> 3061 * This method is recursive, it retrieves the subshapes of the shapes too. 3062 * @param shape Shape from which the subshapes are retrieved. 3063 * @return {void} Map with the shapes wrapped in instances of mxMasterShape. 3064 * @param {*} shapeElem 3065 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 3066 */ 3067 mxVsdxMaster.prototype.processMasterShape = function (shapeElem, model, internal) 3068 { 3069 if (!internal) 3070 { 3071 this.firstLevelShapes = []; 3072 } 3073 3074 var shapeChild = shapeElem.firstChild; 3075 while ((shapeChild != null)) { 3076 if ((shapeChild != null && (shapeChild.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3077 return o1.equals(o2); 3078 } 3079 else { 3080 return o1 === o2; 3081 } })(shapeChild.nodeName, "Shapes")) { 3082 var shapesChild = shapeChild.firstChild; 3083 while ((shapesChild != null)) { 3084 if ((shapesChild != null && (shapesChild.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3085 return o1.equals(o2); 3086 } 3087 else { 3088 return o1 === o2; 3089 } })(shapesChild.nodeName, "Shape")) { 3090 var shape = shapesChild; 3091 var shapeId = shape.getAttribute("ID"); 3092 var masterShape = new com.mxgraph.io.vsdx.Shape(shape, model); 3093 this.masterShape = (this.masterShape == null) ? masterShape : this.masterShape; 3094 /* put */ (this.childShapes[shapeId] = masterShape); 3095 3096 if (!internal) 3097 { 3098 this.firstLevelShapes.push(masterShape); 3099 } 3100 3101 this.processMasterShape(shape, model, true); 3102 } 3103 shapesChild = shapesChild.nextSibling; 3104 } 3105 ; 3106 } 3107 else if (shapeChild != null && shapeChild.nodeType == 1 && shapeChild.nodeName == "Connects") 3108 { 3109 this.connects = {}; 3110 var connectsChild = shapeChild.firstChild; 3111 3112 while (connectsChild != null) 3113 { 3114 if (connectsChild != null && connectsChild.nodeType == 1 && connectsChild.nodeName == "Connect") 3115 { 3116 var connectElem = connectsChild; 3117 var connect = new com.mxgraph.io.vsdx.mxVsdxConnect(connectElem); 3118 this.connects[connect.getFromSheet()] = connect; 3119 } 3120 3121 connectsChild = connectsChild.nextSibling; 3122 } 3123 } 3124 3125 shapeChild = shapeChild.nextSibling; 3126 } 3127 ; 3128 }; 3129 /** 3130 * Returns the first shape in the Master 3131 * @return {com.mxgraph.io.vsdx.Shape} First shape in the Master wrapped in a instance of mxMasterShape 3132 */ 3133 mxVsdxMaster.prototype.getMasterShape = function () { 3134 return this.masterShape; 3135 }; 3136 /** 3137 * Returns the shape in the master element with ID = 'id'. 3138 * @param {string} id Shape's ID 3139 * @return {com.mxgraph.io.vsdx.Shape} The shape in the master element with ID = 'id' wrapped in a instance of mxMasterShape 3140 */ 3141 mxVsdxMaster.prototype.getSubShape = function (id) { 3142 return (function (m, k) { return m[k] ? m[k] : null; })(this.childShapes, id); 3143 }; 3144 /** 3145 * Returns the NameU attribute. 3146 * @return {string} Value of the NameU attribute. 3147 */ 3148 mxVsdxMaster.prototype.getNameU = function () { 3149 return this.master.getAttribute("NameU") || ""; 3150 }; 3151 /** 3152 * Returns the NameU attribute. 3153 * @return {string} Value of the NameU attribute. 3154 */ 3155 mxVsdxMaster.prototype.getName = function () { 3156 return this.master.getAttribute("Name") || ""; 3157 }; 3158 /** 3159 * Returns the UniqueID attribute. 3160 * @return {string} Value of the UniqueID attribute. 3161 */ 3162 mxVsdxMaster.prototype.getUniqueID = function () { 3163 var uniqueID = ""; 3164 if (this.master.hasAttribute("UniqueID")) { 3165 uniqueID = this.master.getAttribute("UniqueID"); 3166 } 3167 return uniqueID; 3168 }; 3169 mxVsdxMaster.prototype.getId = function () { 3170 return this.Id; 3171 }; 3172 mxVsdxMaster.prototype.getMasterElement = function () { 3173 return this.master; 3174 }; 3175 return mxVsdxMaster; 3176 }()); 3177 vsdx.mxVsdxMaster = mxVsdxMaster; 3178 mxVsdxMaster["__class"] = "com.mxgraph.io.vsdx.mxVsdxMaster"; 3179 })(vsdx = io.vsdx || (io.vsdx = {})); 3180 })(io = mxgraph.io || (mxgraph.io = {})); 3181 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 3182})(com || (com = {})); 3183(function (com) { 3184 var mxgraph; 3185 (function (mxgraph) { 3186 var io; 3187 (function (io) { 3188 var vsdx; 3189 (function (vsdx) { 3190 /** 3191 * 3192 * A model representing vsdx files. As well as being a programmatic model, the XML DOMs of the unzipped 3193 * files are held to enable round-tripping 3194 * @param {*} doc 3195 * @param {*} docData 3196 * @param {*} mediaData 3197 * @class 3198 */ 3199 var mxVsdxModel = (function () { 3200 function mxVsdxModel(doc, docData, mediaData) { 3201 /** 3202 * A map of Documents created by reading the XML files, indexed by the path to those files 3203 */ 3204 this.xmlDocs = null; 3205 /** 3206 * Collection of media files encoded in Base64, indexed by the path to those files 3207 */ 3208 this.media = null; 3209 /** 3210 * Map of page objects indexed by their ID. 3211 */ 3212 this.pages = null; 3213 /** 3214 * Map of master objects indexed by their ID. Before you think you're being clever by making 3215 * the index an Integer as for pages, don't, there are reasons. 3216 */ 3217 this.masters = ({}); 3218 /** 3219 * Map stylesheets indexed by their ID 3220 */ 3221 this.stylesheets = ({}); 3222 /** 3223 * Map themes indexed by their index 3224 */ 3225 this.themes = ({}); 3226 this.rootElement = null; 3227 this.pm = null; 3228 this.xmlDocs = docData; 3229 this.media = mediaData; 3230 var childNode = doc.firstChild; 3231 while ((childNode != null)) { 3232 if ((childNode != null && (childNode.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3233 return o1.equals(o2); 3234 } 3235 else { 3236 return o1 === o2; 3237 } })(childNode.tagName.toLowerCase(), com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "document")) { 3238 this.rootElement = childNode; 3239 break; 3240 } 3241 childNode = childNode.nextSibling; 3242 } 3243 ; 3244 this.pm = new com.mxgraph.io.vsdx.mxPropertiesManager(); 3245 this.pm.initialise(this.rootElement, this); 3246 this.initStylesheets(); 3247 this.initThemes(); 3248 this.initMasters(); 3249 this.initPages(); 3250 } 3251 /** 3252 * Initialize theme objects from the XML files 3253 * @private 3254 */ 3255 /*private*/ mxVsdxModel.prototype.initThemes = function () { 3256 if (this.xmlDocs != null) { 3257 var more = true; 3258 var index = 1; 3259 while ((more)) { 3260 var path = com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/theme/theme" + index + ".xml"; 3261 var themeDoc = (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path); 3262 if (themeDoc != null) { 3263 var child = themeDoc.firstChild; 3264 while ((child != null)) { 3265 if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3266 return o1.equals(o2); 3267 } 3268 else { 3269 return o1 === o2; 3270 } })(child.tagName, "a:theme")) { 3271 var theme_1 = new com.mxgraph.io.vsdx.mxVsdxTheme(child); 3272 if (theme_1.getThemeIndex() < 0) { 3273 theme_1.processTheme(); 3274 } 3275 var existingTheme = (function (m, k) { if (m.entries == null) 3276 m.entries = []; for (var i = 0; i < m.entries.length; i++) 3277 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 3278 return m.entries[i].value; 3279 } return null; })(this.themes, theme_1.getThemeIndex()); 3280 if (existingTheme == null || !existingTheme.isPure()) { 3281 /* put */ (function (m, k, v) { if (m.entries == null) 3282 m.entries = []; for (var i = 0; i < m.entries.length; i++) 3283 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 3284 m.entries[i].value = v; 3285 return; 3286 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.themes, theme_1.getThemeIndex(), theme_1); 3287 } 3288 break; 3289 } 3290 child = child.nextSibling; 3291 } 3292 ; 3293 index++; 3294 } 3295 else { 3296 more = false; 3297 } 3298 } 3299 ; 3300 } 3301 }; 3302 /** 3303 * Load the map with the stylesheets elements in the document.<br/> 3304 * The masters are wrapped for instances of mxStyleSheet. 3305 * @param doc Document with the stylesheets. 3306 */ 3307 mxVsdxModel.prototype.initStylesheets = function () { 3308 var vdxSheets = this.rootElement.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.STYLE_SHEETS); 3309 if (vdxSheets.length > 0) { 3310 var sheets_1 = vdxSheets.item(0); 3311 var sheetList = sheets_1.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.STYLE_SHEET); 3312 var sheetLength = sheetList.length; 3313 for (var i = 0; i < sheetLength; i++) { 3314 var sheet = sheetList.item(i); 3315 var sheetId = sheet.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID); 3316 var sheetElement = new com.mxgraph.io.vsdx.Style(sheet, this); 3317 /* put */ (this.stylesheets[sheetId] = sheetElement); 3318 } 3319 ; 3320 } 3321 var sheets = (function (obj) { return Object.keys(obj).map(function (key) { return obj[key]; }); })(this.stylesheets); 3322 var iter = (function (a) { var i = 0; return { next: function () { return i < a.length ? a[i++] : null; }, hasNext: function () { return i < a.length; } }; })(sheets); 3323 while ((iter.hasNext())) { 3324 var sheet = iter.next(); 3325 sheet.stylesheetRefs(this); 3326 } 3327 ; 3328 }; 3329 /** 3330 * Initialize master objects from the XML files 3331 */ 3332 mxVsdxModel.prototype.initMasters = function () { 3333 if (this.xmlDocs != null) { 3334 var path = com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/masters/masters.xml"; 3335 var masterDoc = (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path); 3336 if (masterDoc != null) { 3337 var child = masterDoc.firstChild; 3338 while ((child != null)) { 3339 if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3340 return o1.equals(o2); 3341 } 3342 else { 3343 return o1 === o2; 3344 } })(child.tagName, com.mxgraph.io.vsdx.mxVsdxConstants.MASTERS)) { 3345 var grandChild = child.firstChild; 3346 while ((grandChild != null)) { 3347 if ((grandChild != null && (grandChild.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3348 return o1.equals(o2); 3349 } 3350 else { 3351 return o1 === o2; 3352 } })(grandChild.tagName, "Master")) { 3353 var masterElement = grandChild; 3354 var master = new com.mxgraph.io.vsdx.mxVsdxMaster(masterElement, this); 3355 /* put */ (this.masters[master.getId()] = master); 3356 } 3357 grandChild = grandChild.nextSibling; 3358 } 3359 ; 3360 break; 3361 } 3362 child = child.nextSibling; 3363 } 3364 ; 3365 } 3366 } 3367 }; 3368 /** 3369 * Initialize page objects from the XML files 3370 */ 3371 mxVsdxModel.prototype.initPages = function () { 3372 if (this.xmlDocs != null) { 3373 var path = com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/pages/pages.xml"; 3374 var pageDoc = (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path); 3375 if (pageDoc != null) { 3376 var child = pageDoc.firstChild; 3377 while ((child != null)) { 3378 if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3379 return o1.equals(o2); 3380 } 3381 else { 3382 return o1 === o2; 3383 } })(child.tagName, com.mxgraph.io.vsdx.mxVsdxConstants.PAGES)) { 3384 var pages = child; 3385 var pageList = pages.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.PAGE); 3386 if (pageList != null && pageList.length > 0) { 3387 this.pages = ({}); 3388 var backgroundMap = ({}); 3389 var pageListLen = pageList.length; 3390 for (var i = 0; i < pageListLen; i++) { 3391 var pageEle = pageList.item(i); 3392 var page = this.createPage(pageEle); 3393 if (page.isBackground()) { 3394 /* put */ (function (m, k, v) { if (m.entries == null) 3395 m.entries = []; for (var i_1 = 0; i_1 < m.entries.length; i_1++) 3396 if (m.entries[i_1].key.equals != null && m.entries[i_1].key.equals(k) || m.entries[i_1].key === k) { 3397 m.entries[i_1].value = v; 3398 return; 3399 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(backgroundMap, page.getId(), page); 3400 } 3401 /* put */ (function (m, k, v) { if (m.entries == null) 3402 m.entries = []; for (var i_2 = 0; i_2 < m.entries.length; i_2++) 3403 if (m.entries[i_2].key.equals != null && m.entries[i_2].key.equals(k) || m.entries[i_2].key === k) { 3404 m.entries[i_2].value = v; 3405 return; 3406 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.pages, page.getId(), page); 3407 } 3408 ; 3409 { 3410 var array132 = (function (m) { if (m.entries == null) 3411 m.entries = []; return m.entries; })(this.pages); 3412 for (var index131 = 0; index131 < array132.length; index131++) { 3413 var entry = array132[index131]; 3414 { 3415 var page = entry.getValue(); 3416 var backId = page.getBackPageId(); 3417 if (backId != null) { 3418 var background = (function (m, k) { if (m.entries == null) 3419 m.entries = []; for (var i = 0; i < m.entries.length; i++) 3420 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 3421 return m.entries[i].value; 3422 } return null; })(backgroundMap, backId); 3423 page.setBackPage(background); 3424 } 3425 } 3426 } 3427 } 3428 } 3429 break; 3430 } 3431 child = child.nextSibling; 3432 } 3433 ; 3434 } 3435 } 3436 }; 3437 mxVsdxModel.prototype.getPages = function () { 3438 return this.pages; 3439 }; 3440 mxVsdxModel.prototype.getThemes = function () { 3441 return this.themes; 3442 }; 3443 mxVsdxModel.prototype.getRelationship = function (rid, path) { 3444 var relsDoc = (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path); 3445 if (relsDoc == null || rid == null || (rid.length === 0)) { 3446 return null; 3447 } 3448 var rels = relsDoc.getElementsByTagName("Relationship"); 3449 for (var i = 0; i < rels.length; i++) { 3450 var currElem = rels.item(i); 3451 var id = currElem.getAttribute("Id"); 3452 if ((function (o1, o2) { if (o1 && o1.equals) { 3453 return o1.equals(o2); 3454 } 3455 else { 3456 return o1 === o2; 3457 } })(id, rid)) { 3458 return currElem; 3459 } 3460 } 3461 ; 3462 return null; 3463 }; 3464 mxVsdxModel.prototype.getMaster = function (masterId) { 3465 return (function (m, k) { return m[k] ? m[k] : null; })(this.masters, masterId); 3466 }; 3467 mxVsdxModel.prototype.createPage = function (pageEle) { 3468 return new com.mxgraph.io.vsdx.mxVsdxPage(pageEle, this); 3469 }; 3470 mxVsdxModel.prototype.getPropertiesManager = function () { 3471 return this.pm; 3472 }; 3473 mxVsdxModel.prototype.setPropertiesManager = function (pm) { 3474 this.pm = pm; 3475 }; 3476 mxVsdxModel.prototype.getMasterShapes = function () { 3477 return this.masters; 3478 }; 3479 mxVsdxModel.prototype.setMasterShapes = function (mm) { 3480 this.masters = mm; 3481 }; 3482 /** 3483 * Returns the wrapper of the stylesheet element with id indicated by 'id' 3484 * @param {string} id StyleSheet's ID. 3485 * @return {com.mxgraph.io.vsdx.Style} StyleSheet element with id = 'id' wrapped in an instance of mxStyleSheet. 3486 */ 3487 mxVsdxModel.prototype.getStylesheet = function (id) { 3488 return (function (m, k) { return m[k] ? m[k] : null; })(this.stylesheets, id); 3489 }; 3490 mxVsdxModel.prototype.getXmlDoc = function (path) { 3491 return (function (m, k) { return m[k] ? m[k] : null; })(this.xmlDocs, path); 3492 }; 3493 mxVsdxModel.prototype.getMedia = function (path) { 3494 return (function (m, k) { return m[k] ? m[k] : null; })(this.media, path); 3495 }; 3496 return mxVsdxModel; 3497 }()); 3498 vsdx.mxVsdxModel = mxVsdxModel; 3499 mxVsdxModel["__class"] = "com.mxgraph.io.vsdx.mxVsdxModel"; 3500 })(vsdx = io.vsdx || (io.vsdx = {})); 3501 })(io = mxgraph.io || (mxgraph.io = {})); 3502 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 3503})(com || (com = {})); 3504(function (com) { 3505 var mxgraph; 3506 (function (mxgraph) { 3507 var io; 3508 (function (io) { 3509 var vsdx; 3510 (function (vsdx) { 3511 var mxVsdxPage = (function () { 3512 function mxVsdxPage(pageElem, model) { 3513 /** 3514 * Unique ID of the element within its parent element 3515 */ 3516 this.Id = null; 3517 /** 3518 * Name of the page taken from the "name" attribute of the page element 3519 */ 3520 this.pageName = null; 3521 this.__isBackground = false; 3522 this.backPageId = null; 3523 this.backPage = null; 3524 this.pageElement = null; 3525 this.pageSheet = null; 3526 this.model = null; 3527 this.shapes = ({}); 3528 this.connects = ({}); 3529 this.cellElements = ({}); 3530 this.model = model; 3531 this.pageElement = pageElem; 3532 this.layers = []; 3533 var backGround = pageElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.BACKGROUND); 3534 this.__isBackground = (backGround != null && (function (o1, o2) { if (o1 && o1.equals) { 3535 return o1.equals(o2); 3536 } 3537 else { 3538 return o1 === o2; 3539 } })(backGround, com.mxgraph.io.vsdx.mxVsdxConstants.TRUE)) ? true : false; 3540 var back = pageElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.BACK_PAGE); 3541 if (back != null && back.length > 0) { 3542 this.backPageId = parseFloat(back); 3543 } 3544 this.Id = parseFloat(pageElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID)); 3545 this.pageName = pageElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME) || ""; 3546 var pageSheets = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(pageElem, "PageSheet"); 3547 if (pageSheets.length > 0) { 3548 var pageSheet = pageSheets[0]; 3549 var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(pageSheet, "Cell"); 3550 for (var index133 = 0; index133 < cells.length; index133++) { 3551 var cellElem = cells[index133]; 3552 { 3553 var n = cellElem.getAttribute("N"); 3554 /* put */ (this.cellElements[n] = cellElem); 3555 } 3556 } 3557 3558 var sections = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(pageSheet, "Section"); 3559 for (var i134 = 0; i134 < sections.length; i134++) 3560 { 3561 var secElem = sections[i134]; 3562 var n = secElem.getAttribute("N"); 3563 3564 if (n == "Layer") 3565 { 3566 var layers = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(secElem, "Row"); 3567 3568 for (var i135 = 0; i135 < layers.length; i135++) 3569 { 3570 var layerAtts = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(layers[i135], "Cell"); 3571 var layerObj = {}; 3572 3573 for (var i136 = 0; i136 < layerAtts.length; i136++) 3574 { 3575 layerObj[layerAtts[i136].getAttribute("N")] = layerAtts[i136].getAttribute("V"); 3576 } 3577 this.layers[parseInt(layers[i135].getAttribute("IX"))] = layerObj; 3578 } 3579 } 3580 } 3581 } 3582 this.parseNodes(pageElem, model, "pages"); 3583 } 3584 /** 3585 * Parses the child nodes of the given element 3586 * @param {*} pageElem the parent whose children to parse 3587 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model the model of the vsdx file 3588 * @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. 3589 */ 3590 mxVsdxPage.prototype.parseNodes = function (pageElem, model, pageName) { 3591 var pageChild = pageElem.firstChild; 3592 while ((pageChild != null)) { 3593 if (pageChild != null && (pageChild.nodeType == 1)) { 3594 var pageChildElem = pageChild; 3595 var childName = pageChildElem.nodeName; 3596 if ((function (o1, o2) { if (o1 && o1.equals) { 3597 return o1.equals(o2); 3598 } 3599 else { 3600 return o1 === o2; 3601 } })(childName, "Rel")) { 3602 this.resolveRel(pageChildElem, model, pageName); 3603 } 3604 else if ((function (o1, o2) { if (o1 && o1.equals) { 3605 return o1.equals(o2); 3606 } 3607 else { 3608 return o1 === o2; 3609 } })(childName, "Shapes")) { 3610 this.shapes = this.parseShapes(pageChildElem, null, false); 3611 } 3612 else if ((function (o1, o2) { if (o1 && o1.equals) { 3613 return o1.equals(o2); 3614 } 3615 else { 3616 return o1 === o2; 3617 } })(childName, "Connects")) { 3618 var connectList = pageChildElem.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.CONNECT); 3619 var connectNode = (connectList != null && connectList.length > 0) ? connectList.item(0) : null; 3620 while ((connectNode != null)) { 3621 if (connectNode != null && (connectNode.nodeType == 1)) { 3622 var connectElem = connectNode; 3623 var connect = new com.mxgraph.io.vsdx.mxVsdxConnect(connectElem); 3624 var fromSheet = connect.getFromSheet(); 3625 var previousConnect = (fromSheet != null && fromSheet > -1) ? (function (m, k) { if (m.entries == null) 3626 m.entries = []; for (var i = 0; i < m.entries.length; i++) 3627 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 3628 return m.entries[i].value; 3629 } return null; })(this.connects, fromSheet) : null; 3630 if (previousConnect != null) { 3631 previousConnect.addConnect(connectElem); 3632 } 3633 else { 3634 /* put */ (function (m, k, v) { if (m.entries == null) 3635 m.entries = []; for (var i = 0; i < m.entries.length; i++) 3636 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 3637 m.entries[i].value = v; 3638 return; 3639 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(this.connects, connect.getFromSheet(), connect); 3640 } 3641 } 3642 connectNode = connectNode.nextSibling; 3643 } 3644 ; 3645 } 3646 else if ((function (o1, o2) { if (o1 && o1.equals) { 3647 return o1.equals(o2); 3648 } 3649 else { 3650 return o1 === o2; 3651 } })(childName, "PageSheet")) { 3652 this.pageSheet = pageChildElem; 3653 } 3654 } 3655 pageChild = pageChild.nextSibling; 3656 } 3657 ; 3658 }; 3659 /** 3660 * 3661 * @param {*} relNode 3662 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 3663 * @param {string} pageName 3664 */ 3665 mxVsdxPage.prototype.resolveRel = function (relNode, model, pageName) { 3666 var relElem = model.getRelationship(relNode.getAttribute("r:id"), com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/pages/_rels/" + pageName + ".xml.rels"); 3667 var target = relElem.getAttribute("Target"); 3668 var type = relElem.getAttribute("Type"); 3669 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")) { 3670 var pageDoc = null; 3671 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")) { 3672 pageDoc = model.getXmlDoc(com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/pages/" + target); 3673 } 3674 if (pageDoc != null) { 3675 var child = pageDoc.firstChild; 3676 while ((child != null)) { 3677 if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 3678 return o1.equals(o2); 3679 } 3680 else { 3681 return o1 === o2; 3682 } })(child.tagName, "PageContents")) { 3683 var index = target.indexOf('.'); 3684 if (index !== -1) { 3685 this.parseNodes(child, model, target.substring(0, index)); 3686 } 3687 break; 3688 } 3689 child = child.nextSibling; 3690 } 3691 ; 3692 } 3693 } 3694 }; 3695 mxVsdxPage.prototype.parseShapes = function (shapesElement, master, recurse) { 3696 var shapes = ({}); 3697 var shapeList = shapesElement.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.SHAPE); 3698 var shapeNode = (shapeList != null && shapeList.length > 0) ? shapeList.item(0) : null; 3699 while ((shapeNode != null)) { 3700 if (shapeNode != null && (shapeNode.nodeType == 1)) { 3701 var shapeElem = shapeNode; 3702 var masterTmp = master; 3703 if (masterTmp == null) { 3704 var masterId = shapeElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER); 3705 if (masterId != null && !(function (o1, o2) { if (o1 && o1.equals) { 3706 return o1.equals(o2); 3707 } 3708 else { 3709 return o1 === o2; 3710 } })(masterId, "")) { 3711 masterTmp = this.model.getMaster(masterId); 3712 } 3713 } 3714 var isEdge = this.isEdge(shapeElem); 3715 if (!isEdge && masterTmp != null) { 3716 var masterId = shapeElem.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER_SHAPE); 3717 var elem = masterTmp.getMasterElement(); 3718 if (masterId != null && !(function (o1, o2) { if (o1 && o1.equals) { 3719 return o1.equals(o2); 3720 } 3721 else { 3722 return o1 === o2; 3723 } })(masterId, "")) { 3724 var subShape = masterTmp.getSubShape(masterId) 3725 //Some files has non-existing master sub-shapes 3726 elem = subShape != null? subShape.getShape() : elem; 3727 } 3728 isEdge = this.isEdge(elem); 3729 } 3730 var shape = this.createCell(shapeElem, !isEdge, masterTmp); 3731 /* put */ (function (m, k, v) { if (m.entries == null) 3732 m.entries = []; for (var i = 0; i < m.entries.length; i++) 3733 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 3734 m.entries[i].value = v; 3735 return; 3736 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(shapes, shape.getId(), shape); 3737 } 3738 shapeNode = shapeNode.nextSibling; 3739 } 3740 ; 3741 return shapes; 3742 }; 3743 mxVsdxPage.prototype.createCell = function (shapeElem, vertex, masterTmp) { 3744 return new com.mxgraph.io.vsdx.VsdxShape(this, shapeElem, vertex, this.model.getMasterShapes(), masterTmp, this.model); 3745 }; 3746 mxVsdxPage.prototype.isEdge = function (shape) { 3747 if (shape != null) { 3748 var children = shape.childNodes; 3749 if (children != null) { 3750 var childNode = children.item(0); 3751 while ((childNode != null)) { 3752 if (childNode != null && (childNode.nodeType == 1)) { 3753 var childElem = childNode; 3754 if ((function (o1, o2) { if (o1 && o1.equals) { 3755 return o1.equals(o2); 3756 } 3757 else { 3758 return o1 === o2; 3759 } })(childElem.nodeName, "Cell")) { 3760 var n = childElem.getAttribute("N"); 3761 if ((function (o1, o2) { if (o1 && o1.equals) { 3762 return o1.equals(o2); 3763 } 3764 else { 3765 return o1 === o2; 3766 } })(n, "BeginX") || (function (o1, o2) { if (o1 && o1.equals) { 3767 return o1.equals(o2); 3768 } 3769 else { 3770 return o1 === o2; 3771 } })(n, "BeginY") || (function (o1, o2) { if (o1 && o1.equals) { 3772 return o1.equals(o2); 3773 } 3774 else { 3775 return o1 === o2; 3776 } })(n, "EndY") || (function (o1, o2) { if (o1 && o1.equals) { 3777 return o1.equals(o2); 3778 } 3779 else { 3780 return o1 === o2; 3781 } })(n, "EndX")) { 3782 return true; 3783 } 3784 } 3785 } 3786 childNode = childNode.nextSibling; 3787 } 3788 ; 3789 } 3790 } 3791 return false; 3792 }; 3793 /** 3794 * Returns the width and height of a Page expressed as an mxPoint. 3795 * @return {mxPoint} mxPoint that represents the dimensions of the page 3796 */ 3797 mxVsdxPage.prototype.getPageDimensions = function () { 3798 var pageH = 0; 3799 var pageW = 0; 3800 var height = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, "PageHeight"); 3801 var width = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, "PageWidth"); 3802 if (height != null) { 3803 pageH = parseFloat(height.getAttribute("V")) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 3804 pageH = Math.round(pageH * 100.0) / 100.0; 3805 } 3806 if (width != null) { 3807 pageW = parseFloat(width.getAttribute("V")) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 3808 pageW = Math.round(pageW * 100.0) / 100.0; 3809 } 3810 return new mxPoint(pageW, pageH); 3811 }; 3812 /** 3813 * Returns the drawing scale attribute of this page 3814 * @return {number} the DrawingScale 3815 */ 3816 mxVsdxPage.prototype.getDrawingScale = function () { 3817 var scale = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, "DrawingScale"); 3818 if (scale != null) { 3819 return parseFloat(scale.getAttribute("V")) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 3820 } 3821 return 1; 3822 }; 3823 /** 3824 * Returns the page scale attribute of this page 3825 * @return {number} the PageScale 3826 */ 3827 mxVsdxPage.prototype.getPageScale = function () { 3828 var scale = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, "PageScale"); 3829 if (scale != null) { 3830 return parseFloat(scale.getAttribute("V")) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 3831 } 3832 return 1; 3833 }; 3834 mxVsdxPage.prototype.getCellValue = function (cellName) { 3835 var cell = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, cellName); 3836 if (cell != null) { 3837 return cell.getAttribute("V") || ""; 3838 } 3839 return null; 3840 }; 3841 mxVsdxPage.prototype.getCellIntValue = function (cellName, defVal) { 3842 var val = this.getCellValue(cellName); 3843 if (val != null) { 3844 return parseInt(val); 3845 } 3846 return defVal; 3847 }; 3848 /** 3849 * Returns the ID of the page 3850 * @return {number} the ID of the page 3851 */ 3852 mxVsdxPage.prototype.getId = function () { 3853 return this.Id; 3854 }; 3855 mxVsdxPage.prototype.getPageName = function () { 3856 return this.pageName; 3857 }; 3858 mxVsdxPage.prototype.getShapes = function () { 3859 return this.shapes; 3860 }; 3861 mxVsdxPage.prototype.getLayers = function () { 3862 return this.layers; 3863 }; 3864 mxVsdxPage.prototype.getConnects = function () { 3865 return this.connects; 3866 }; 3867 mxVsdxPage.prototype.isBackground = function () { 3868 return this.__isBackground; 3869 }; 3870 /** 3871 * Returns the background page ID, if any 3872 * @return {number} the ID of any background page or null for no background page 3873 */ 3874 mxVsdxPage.prototype.getBackPageId = function () { 3875 return this.backPageId; 3876 }; 3877 mxVsdxPage.prototype.setBackPage = function (page) { 3878 this.backPage = page; 3879 }; 3880 mxVsdxPage.prototype.getBackPage = function () { 3881 return this.backPage; 3882 }; 3883 return mxVsdxPage; 3884 }()); 3885 vsdx.mxVsdxPage = mxVsdxPage; 3886 mxVsdxPage["__class"] = "com.mxgraph.io.vsdx.mxVsdxPage"; 3887 })(vsdx = io.vsdx || (io.vsdx = {})); 3888 })(io = mxgraph.io || (mxgraph.io = {})); 3889 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 3890})(com || (com = {})); 3891(function (com) { 3892 var mxgraph; 3893 (function (mxgraph) { 3894 var io; 3895 (function (io) { 3896 var vsdx; 3897 (function (vsdx) { 3898 var mxVsdxTheme = (function () { 3899 function mxVsdxTheme(theme) { 3900 /*private*/ this.themeIndex = -1; 3901 /*private*/ this.themeVariant = 0; 3902 /*private*/ this.baseColors = ({}); 3903 /*private*/ this.variantsColors = (function (dims) { var allocate = function (dims) { if (dims.length == 0) { 3904 return undefined; 3905 } 3906 else { 3907 var array = []; 3908 for (var i = 0; i < dims[0]; i++) { 3909 array.push(allocate(dims.slice(1))); 3910 } 3911 return array; 3912 } }; return allocate(dims); })([4, 7]); 3913 /*private*/ this.isMonotoneVariant = new Array(4); 3914 /*private*/ this.defaultClr = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255); 3915 /*private*/ this.defaultLineClr = new com.mxgraph.io.vsdx.theme.Color(0, 0, 0); 3916 /*private*/ this.defaultLineStyle = new com.mxgraph.io.vsdx.theme.LineStyle(); 3917 /*private*/ this.fillStyles = ([]); 3918 /*private*/ this.connFillStyles = ([]); 3919 /*private*/ this.lineStyles = ([]); 3920 /*private*/ this.connLineStyles = ([]); 3921 /*private*/ this.lineStylesExt = ([]); 3922 /*private*/ this.connLineStylesExt = ([]); 3923 /*private*/ this.connFontColors = ([]); 3924 /*private*/ this.connFontStyles = ([]); 3925 /*private*/ this.fontColors = ([]); 3926 /*private*/ this.fontStyles = ([]); 3927 /*private*/ this.variantEmbellishment = [0, 0, 0, 0]; 3928 /*private*/ this.variantFillIdx = (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.variantLineIdx = (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.variantEffectIdx = (function (dims) { var allocate = function (dims) { if (dims.length == 0) { 3949 return 0; 3950 } 3951 else { 3952 var array = []; 3953 for (var i = 0; i < dims[0]; i++) { 3954 array.push(allocate(dims.slice(1))); 3955 } 3956 return array; 3957 } }; return allocate(dims); })([4, 4]); 3958 /*private*/ this.variantFontIdx = (function (dims) { var allocate = function (dims) { if (dims.length == 0) { 3959 return 0; 3960 } 3961 else { 3962 var array = []; 3963 for (var i = 0; i < dims[0]; i++) { 3964 array.push(allocate(dims.slice(1))); 3965 } 3966 return array; 3967 } }; return allocate(dims); })([4, 4]); 3968 /*private*/ this.isProcessed = false; 3969 /*private*/ this.__isPure = true; 3970 this.theme = null; 3971 this.bkgndColor = null; 3972 this.name = null; 3973 this.theme = theme; 3974 this.name = theme.getAttribute("name") || ""; 3975 var themeId = (function (m, k) { return m[k] ? m[k] : null; })(mxVsdxTheme.themesIds_$LI$(), this.name); 3976 if (themeId != null) { 3977 this.themeIndex = themeId; 3978 } 3979 } 3980 mxVsdxTheme.__static_initialize = function () { if (!mxVsdxTheme.__static_initialized) { 3981 mxVsdxTheme.__static_initialized = true; 3982 mxVsdxTheme.__static_initializer_0(); 3983 mxVsdxTheme.__static_initializer_1(); 3984 } }; 3985 mxVsdxTheme.themesIds_$LI$ = function () { mxVsdxTheme.__static_initialize(); if (mxVsdxTheme.themesIds == null) 3986 mxVsdxTheme.themesIds = ({}); return mxVsdxTheme.themesIds; }; 3987 ; 3988 mxVsdxTheme.__static_initializer_0 = function () { 3989 /* put */ (mxVsdxTheme.themesIds_$LI$()["Office"] = 33); 3990 /* put */ (mxVsdxTheme.themesIds_$LI$()["Linear"] = 34); 3991 /* put */ (mxVsdxTheme.themesIds_$LI$()["Zephyr"] = 35); 3992 /* put */ (mxVsdxTheme.themesIds_$LI$()["Integral"] = 36); 3993 /* put */ (mxVsdxTheme.themesIds_$LI$()["Simple"] = 37); 3994 /* put */ (mxVsdxTheme.themesIds_$LI$()["Whisp"] = 38); 3995 /* put */ (mxVsdxTheme.themesIds_$LI$()["Daybreak"] = 39); 3996 /* put */ (mxVsdxTheme.themesIds_$LI$()["Parallel"] = 40); 3997 /* put */ (mxVsdxTheme.themesIds_$LI$()["Sequence"] = 41); 3998 /* put */ (mxVsdxTheme.themesIds_$LI$()["Slice"] = 42); 3999 /* put */ (mxVsdxTheme.themesIds_$LI$()["Ion"] = 43); 4000 /* put */ (mxVsdxTheme.themesIds_$LI$()["Retrospect"] = 44); 4001 /* put */ (mxVsdxTheme.themesIds_$LI$()["Organic"] = 45); 4002 /* put */ (mxVsdxTheme.themesIds_$LI$()["Bubble"] = 46); 4003 /* put */ (mxVsdxTheme.themesIds_$LI$()["Clouds"] = 47); 4004 /* put */ (mxVsdxTheme.themesIds_$LI$()["Gemstone"] = 48); 4005 /* put */ (mxVsdxTheme.themesIds_$LI$()["Lines"] = 49); 4006 /* put */ (mxVsdxTheme.themesIds_$LI$()["Facet"] = 50); 4007 /* put */ (mxVsdxTheme.themesIds_$LI$()["Prominence"] = 51); 4008 /* put */ (mxVsdxTheme.themesIds_$LI$()["Smoke"] = 52); 4009 /* put */ (mxVsdxTheme.themesIds_$LI$()["Radiance"] = 53); 4010 /* put */ (mxVsdxTheme.themesIds_$LI$()["Shade"] = 54); 4011 /* put */ (mxVsdxTheme.themesIds_$LI$()["Pencil"] = 55); 4012 /* put */ (mxVsdxTheme.themesIds_$LI$()["Pen"] = 56); 4013 /* put */ (mxVsdxTheme.themesIds_$LI$()["Marker"] = 57); 4014 /* put */ (mxVsdxTheme.themesIds_$LI$()["Whiteboard"] = 58); 4015 }; 4016 mxVsdxTheme.colorIds_$LI$ = function () { mxVsdxTheme.__static_initialize(); if (mxVsdxTheme.colorIds == null) 4017 mxVsdxTheme.colorIds = ({}); return mxVsdxTheme.colorIds; }; 4018 ; 4019 mxVsdxTheme.__static_initializer_1 = function () { 4020 /* put */ (function (m, k, v) { if (m.entries == null) 4021 m.entries = []; for (var i = 0; i < m.entries.length; i++) 4022 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 4023 m.entries[i].value = v; 4024 return; 4025 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 0, "dk1"); 4026 /* put */ (function (m, k, v) { if (m.entries == null) 4027 m.entries = []; for (var i = 0; i < m.entries.length; i++) 4028 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 4029 m.entries[i].value = v; 4030 return; 4031 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 1, "lt1"); 4032 /* put */ (function (m, k, v) { if (m.entries == null) 4033 m.entries = []; for (var i = 0; i < m.entries.length; i++) 4034 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 4035 m.entries[i].value = v; 4036 return; 4037 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 2, "accent1"); 4038 /* put */ (function (m, k, v) { if (m.entries == null) 4039 m.entries = []; for (var i = 0; i < m.entries.length; i++) 4040 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 4041 m.entries[i].value = v; 4042 return; 4043 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 3, "accent2"); 4044 /* put */ (function (m, k, v) { if (m.entries == null) 4045 m.entries = []; for (var i = 0; i < m.entries.length; i++) 4046 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 4047 m.entries[i].value = v; 4048 return; 4049 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 4, "accent3"); 4050 /* put */ (function (m, k, v) { if (m.entries == null) 4051 m.entries = []; for (var i = 0; i < m.entries.length; i++) 4052 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 4053 m.entries[i].value = v; 4054 return; 4055 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 5, "accent4"); 4056 /* put */ (function (m, k, v) { if (m.entries == null) 4057 m.entries = []; for (var i = 0; i < m.entries.length; i++) 4058 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 4059 m.entries[i].value = v; 4060 return; 4061 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 6, "accent5"); 4062 /* put */ (function (m, k, v) { if (m.entries == null) 4063 m.entries = []; for (var i = 0; i < m.entries.length; i++) 4064 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 4065 m.entries[i].value = v; 4066 return; 4067 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(mxVsdxTheme.colorIds_$LI$(), 7, "accent6"); 4068 }; 4069 mxVsdxTheme.prototype.getThemeIndex = function () { 4070 return this.themeIndex; 4071 }; 4072 mxVsdxTheme.prototype.setVariant = function (variant) { 4073 this.themeVariant = variant; 4074 }; 4075 mxVsdxTheme.prototype.isPure = function () { 4076 return this.__isPure; 4077 }; 4078 mxVsdxTheme.prototype.processTheme = function () { 4079 if (this.isProcessed) 4080 return; 4081 try { 4082 var child = this.theme.firstChild; 4083 while ((child != null)) { 4084 if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 4085 return o1.equals(o2); 4086 } 4087 else { 4088 return o1 === o2; 4089 } })(child.nodeName, "a:themeElements")) { 4090 var child2 = child.firstChild; 4091 while ((child2 != null)) { 4092 if (child2 != null && (child2.nodeType == 1)) { 4093 var elem = child2; 4094 var nodeName = elem.nodeName; 4095 if ((function (o1, o2) { if (o1 && o1.equals) { 4096 return o1.equals(o2); 4097 } 4098 else { 4099 return o1 === o2; 4100 } })(nodeName, "a:clrScheme")) { 4101 if (!(function (o1, o2) { if (o1 && o1.equals) { 4102 return o1.equals(o2); 4103 } 4104 else { 4105 return o1 === o2; 4106 } })(this.name, elem.getAttribute("name"))) { 4107 this.__isPure = false; 4108 } 4109 this.processColors(elem); 4110 } 4111 else if ((function (o1, o2) { if (o1 && o1.equals) { 4112 return o1.equals(o2); 4113 } 4114 else { 4115 return o1 === o2; 4116 } })(nodeName, "a:fontScheme")) { 4117 if (!(function (o1, o2) { if (o1 && o1.equals) { 4118 return o1.equals(o2); 4119 } 4120 else { 4121 return o1 === o2; 4122 } })(this.name, elem.getAttribute("name"))) { 4123 this.__isPure = false; 4124 } 4125 this.processFonts(elem); 4126 } 4127 else if ((function (o1, o2) { if (o1 && o1.equals) { 4128 return o1.equals(o2); 4129 } 4130 else { 4131 return o1 === o2; 4132 } })(nodeName, "a:fmtScheme")) { 4133 if (!(function (o1, o2) { if (o1 && o1.equals) { 4134 return o1.equals(o2); 4135 } 4136 else { 4137 return o1 === o2; 4138 } })(this.name, elem.getAttribute("name"))) { 4139 this.__isPure = false; 4140 } 4141 this.processFormats(elem); 4142 } 4143 else if ((function (o1, o2) { if (o1 && o1.equals) { 4144 return o1.equals(o2); 4145 } 4146 else { 4147 return o1 === o2; 4148 } })(nodeName, "a:extLst")) { 4149 this.processExtras(elem); 4150 } 4151 } 4152 child2 = child2.nextSibling; 4153 } 4154 ; 4155 } 4156 child = child.nextSibling; 4157 } 4158 ; 4159 } 4160 catch (e) { 4161 console.error(e.message, e); 4162 } 4163 ; 4164 this.isProcessed = true; 4165 }; 4166 /*private*/ mxVsdxTheme.prototype.processExtras = function (element) { 4167 var exts = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(element); 4168 for (var index134 = 0; index134 < exts.length; index134++) { 4169 var ext = exts[index134]; 4170 { 4171 var vt = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(ext); 4172 switch ((vt.nodeName)) { 4173 case "vt:fmtConnectorScheme": 4174 if (!(function (o1, o2) { if (o1 && o1.equals) { 4175 return o1.equals(o2); 4176 } 4177 else { 4178 return o1 === o2; 4179 } })(this.name, vt.getAttribute("name"))) { 4180 this.__isPure = false; 4181 } 4182 var connSchemes = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(vt); 4183 for (var index135 = 0; index135 < connSchemes.length; index135++) { 4184 var scheme = connSchemes[index135]; 4185 { 4186 var name_3 = scheme.nodeName; 4187 switch ((name_3)) { 4188 case "a:fillStyleLst": 4189 var fillStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(scheme); 4190 for (var index136 = 0; index136 < fillStyleElems.length; index136++) { 4191 var fillStyle = fillStyleElems[index136]; 4192 { 4193 /* add */ (this.connFillStyles.push(com.mxgraph.io.vsdx.theme.FillStyleFactory.getFillStyle(fillStyle))); 4194 } 4195 } 4196 break; 4197 case "a:lnStyleLst": 4198 var lineStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(scheme); 4199 for (var index137 = 0; index137 < lineStyleElems.length; index137++) { 4200 var lineStyle = lineStyleElems[index137]; 4201 { 4202 /* add */ (this.connLineStyles.push(new com.mxgraph.io.vsdx.theme.LineStyle(lineStyle))); 4203 } 4204 } 4205 break; 4206 } 4207 } 4208 } 4209 break; 4210 case "vt:lineStyles": 4211 var styles = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(vt); 4212 for (var index138 = 0; index138 < styles.length; index138++) { 4213 var style = styles[index138]; 4214 { 4215 var name_4 = style.nodeName; 4216 switch ((name_4)) { 4217 case "vt:fmtConnectorSchemeLineStyles": 4218 var connStylesElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(style); 4219 for (var index139 = 0; index139 < connStylesElems.length; index139++) { 4220 var connStyle = connStylesElems[index139]; 4221 { 4222 /* add */ (this.connLineStylesExt.push(new com.mxgraph.io.vsdx.theme.LineStyleExt(connStyle))); 4223 } 4224 } 4225 break; 4226 case "vt:fmtSchemeLineStyles": 4227 var schemeStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(style); 4228 for (var index140 = 0; index140 < schemeStyleElems.length; index140++) { 4229 var schemeStyle = schemeStyleElems[index140]; 4230 { 4231 /* add */ (this.lineStylesExt.push(new com.mxgraph.io.vsdx.theme.LineStyleExt(schemeStyle))); 4232 } 4233 } 4234 break; 4235 } 4236 } 4237 } 4238 break; 4239 case "vt:fontStylesGroup": 4240 var fontStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(vt); 4241 for (var index141 = 0; index141 < fontStyleElems.length; index141++) { 4242 var fontStyle = fontStyleElems[index141]; 4243 { 4244 var name_5 = fontStyle.nodeName; 4245 switch ((name_5)) { 4246 case "vt:connectorFontStyles": 4247 this.fillFontStyles(fontStyle, this.connFontColors, this.connFontStyles); 4248 break; 4249 case "vt:fontStyles": 4250 this.fillFontStyles(fontStyle, this.fontColors, this.fontStyles); 4251 break; 4252 } 4253 } 4254 } 4255 break; 4256 case "vt:variationStyleSchemeLst": 4257 var varStyleSchemes = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(vt); 4258 var i = 0; 4259 for (var index142 = 0; index142 < varStyleSchemes.length; index142++) { 4260 var varStyleScheme = varStyleSchemes[index142]; 4261 { 4262 this.variantEmbellishment[i] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyleScheme, "embellishment"); 4263 var varStyles = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(varStyleScheme); 4264 var j = 0; 4265 for (var index143 = 0; index143 < varStyles.length; index143++) { 4266 var varStyle = varStyles[index143]; 4267 { 4268 this.variantFillIdx[i][j] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyle, "fillIdx"); 4269 this.variantLineIdx[i][j] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyle, "lineIdx"); 4270 this.variantEffectIdx[i][j] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyle, "effectIdx"); 4271 this.variantFontIdx[i][j] = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(varStyle, "fontIdx"); 4272 j++; 4273 } 4274 } 4275 i++; 4276 } 4277 } 4278 break; 4279 } 4280 } 4281 } 4282 }; 4283 /*private*/ mxVsdxTheme.prototype.fillFontStyles = function (fontStyle, fontColors, fontStyles) { 4284 var fontProps = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(fontStyle); 4285 for (var index144 = 0; index144 < fontProps.length; index144++) { 4286 var fontProp = fontProps[index144]; 4287 { 4288 /* add */ (fontStyles.push(com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(fontProp, "style"))); 4289 var color = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(fontProp); 4290 if (color != null) 4291 (fontColors.push(com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color)))); 4292 } 4293 } 4294 }; 4295 /*private*/ mxVsdxTheme.prototype.processFormats = function (element) { 4296 var styles = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(element); 4297 for (var index145 = 0; index145 < styles.length; index145++) { 4298 var style = styles[index145]; 4299 { 4300 var name_6 = style.nodeName; 4301 switch ((name_6)) { 4302 case "a:fillStyleLst": 4303 var fillStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(style); 4304 for (var index146 = 0; index146 < fillStyleElems.length; index146++) { 4305 var fillStyle = fillStyleElems[index146]; 4306 { 4307 /* add */ (this.fillStyles.push(com.mxgraph.io.vsdx.theme.FillStyleFactory.getFillStyle(fillStyle))); 4308 } 4309 } 4310 break; 4311 case "a:lnStyleLst": 4312 var lineStyleElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(style); 4313 for (var index147 = 0; index147 < lineStyleElems.length; index147++) { 4314 var lineStyle = lineStyleElems[index147]; 4315 { 4316 /* add */ (this.lineStyles.push(new com.mxgraph.io.vsdx.theme.LineStyle(lineStyle))); 4317 } 4318 } 4319 break; 4320 case "a:effectStyleLst": 4321 break; 4322 case "a:bgFillStyleLst": 4323 break; 4324 } 4325 } 4326 } 4327 }; 4328 /*private*/ mxVsdxTheme.prototype.processFonts = function (element) { 4329 }; 4330 /*private*/ mxVsdxTheme.prototype.processColors = function (element) { 4331 var child = element.firstChild; 4332 while ((child != null)) { 4333 if (child != null && (child.nodeType == 1)) { 4334 var elem = child; 4335 var nodeName = elem.nodeName; 4336 var children = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(elem); 4337 if ((function (o1, o2) { if (o1 && o1.equals) { 4338 return o1.equals(o2); 4339 } 4340 else { 4341 return o1 === o2; 4342 } })(nodeName, "a:extLst")) { 4343 if (children.length === 3) { 4344 if (this.themeIndex < 0) { 4345 this.extractThemeIndex(/* get */ children[0]); 4346 } 4347 this.addBkgndColor(/* get */ children[1]); 4348 this.addVariantColors(/* get */ children[2]); 4349 } 4350 } 4351 else { 4352 var clrName = nodeName.substring(2); 4353 if (children.length > 0) { 4354 this.addBasicColor(clrName, /* get */ children[0]); 4355 } 4356 } 4357 } 4358 child = child.nextSibling; 4359 } 4360 ; 4361 }; 4362 /*private*/ mxVsdxTheme.prototype.addVariantColors = function (element) { 4363 var parent = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(element); 4364 if (parent != null) { 4365 var variants = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(parent); 4366 var i = 0; 4367 for (var index148 = 0; index148 < variants.length; index148++) { 4368 var variant = variants[index148]; 4369 { 4370 this.addVariantColorsSet(i++, variant); 4371 } 4372 } 4373 } 4374 }; 4375 /*private*/ mxVsdxTheme.prototype.addVariantColorsSet = function (index, variant) { 4376 var colors = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(variant); 4377 this.isMonotoneVariant[index] = variant.hasAttribute("monotone"); 4378 for (var index149 = 0; index149 < colors.length; index149++) { 4379 var color = colors[index149]; 4380 { 4381 var name_7 = color.nodeName; 4382 switch ((name_7)) { 4383 case "vt:varColor1": 4384 this.variantsColors[index][0] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color)); 4385 break; 4386 case "vt:varColor2": 4387 this.variantsColors[index][1] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color)); 4388 break; 4389 case "vt:varColor3": 4390 this.variantsColors[index][2] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color)); 4391 break; 4392 case "vt:varColor4": 4393 this.variantsColors[index][3] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color)); 4394 break; 4395 case "vt:varColor5": 4396 this.variantsColors[index][4] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color)); 4397 break; 4398 case "vt:varColor6": 4399 this.variantsColors[index][5] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color)); 4400 break; 4401 case "vt:varColor7": 4402 this.variantsColors[index][6] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(color)); 4403 break; 4404 } 4405 } 4406 } 4407 }; 4408 /*private*/ mxVsdxTheme.prototype.addBkgndColor = function (element) { 4409 var elem = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(element); 4410 if (elem != null) { 4411 this.bkgndColor = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(elem)); 4412 } 4413 }; 4414 /*private*/ mxVsdxTheme.prototype.extractThemeIndex = function (element) { 4415 var elem = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(element); 4416 if (elem != null) { 4417 this.themeIndex = parseInt(elem.getAttribute("schemeEnum")); 4418 } 4419 }; 4420 /*private*/ mxVsdxTheme.prototype.addBasicColor = function (clrName, element) { 4421 /* put */ (this.baseColors[clrName] = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(element)); 4422 }; 4423 mxVsdxTheme.prototype.getSchemeColor = function (val) { 4424 this.processTheme(); 4425 var color = (function (m, k) { return m[k] ? m[k] : null; })(this.baseColors, val); 4426 return color != null ? color.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(this) : this.defaultClr; 4427 }; 4428 mxVsdxTheme.prototype.getStyleColor = function (styleColor) { 4429 this.processTheme(); 4430 if (styleColor < 8) { 4431 var color = (function (m, k) { return m[k] ? m[k] : null; })(this.baseColors, /* get */ (function (m, k) { if (m.entries == null) 4432 m.entries = []; for (var i = 0; i < m.entries.length; i++) 4433 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 4434 return m.entries[i].value; 4435 } return null; })(mxVsdxTheme.colorIds_$LI$(), styleColor)); 4436 if (color != null) { 4437 return color.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(this); 4438 } 4439 } 4440 else if (styleColor === 8) { 4441 if (this.bkgndColor != null) { 4442 return this.bkgndColor.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(this); 4443 } 4444 } 4445 else { 4446 var color = null; 4447 var clrIndex = 0; 4448 if (styleColor >= 200) { 4449 clrIndex = styleColor - 200; 4450 } 4451 else if (styleColor >= 100) { 4452 clrIndex = styleColor - 100; 4453 } 4454 if (clrIndex >= 0 && clrIndex <= 6) { 4455 color = this.variantsColors[this.themeVariant][clrIndex]; 4456 } 4457 if (color != null) { 4458 return color.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(this); 4459 } 4460 } 4461 return this.defaultClr; 4462 }; 4463 mxVsdxTheme.prototype.getFillGraientColor = function (quickStyleVals) { 4464 return this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean(quickStyleVals, true); 4465 }; 4466 mxVsdxTheme.prototype.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) { 4467 return this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean(quickStyleVals, false); 4468 }; 4469 mxVsdxTheme.prototype.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean = function (quickStyleVals, getGradient) { 4470 this.processTheme(); 4471 var fillColorStyle = quickStyleVals.getQuickStyleFillColor(); 4472 var fillStyle = null; 4473 switch ((quickStyleVals.getQuickStyleFillMatrix())) { 4474 case 1: 4475 case 2: 4476 case 3: 4477 case 4: 4478 case 5: 4479 case 6: 4480 fillStyle = this.fillStyles[quickStyleVals.getQuickStyleFillMatrix() - 1]; 4481 break; 4482 case 100: 4483 case 101: 4484 case 102: 4485 case 103: 4486 if (this.isMonotoneVariant[this.themeVariant]) 4487 fillColorStyle = 100; 4488 var index = quickStyleVals.getQuickStyleFillMatrix() - 100; 4489 fillStyle = this.fillStyles[this.variantFillIdx[this.themeVariant][index] - 1]; 4490 break; 4491 } 4492 var retColor; 4493 if (fillStyle != null) { 4494 if (getGradient) { 4495 retColor = (fillStyle != null && fillStyle instanceof com.mxgraph.io.vsdx.theme.GradFill) ? fillStyle.applyStyle(fillColorStyle, this).getGradientClr() : null; 4496 } 4497 else { 4498 retColor = fillStyle.applyStyle(fillColorStyle, this); 4499 } 4500 } 4501 else { 4502 if (getGradient) { 4503 retColor = null; 4504 } 4505 else { 4506 retColor = this.getStyleColor(fillColorStyle); 4507 } 4508 } 4509 var styleVariation = quickStyleVals.getQuickStyleVariation(); 4510 4511 //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 4512 if (retColor != null && (styleVariation & 8) > 0) 4513 { 4514 var bkgHSLClr = this.getStyleColor(8).toHsl(); 4515 var lineClr = this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4516 var lineHSLClr = lineClr.toHsl(); 4517 var fillHSLClr = retColor.toHsl(); 4518 4519 4520 if (Math.abs(bkgHSLClr.getLum() - fillHSLClr.getLum()) >= 0.1666) 4521 { 4522 //nothing 4523 } 4524 else if (bkgHSLClr.getLum() <= 0.7292) 4525 { 4526 retColor = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255); 4527 } 4528 else if (Math.abs(bkgHSLClr.getLum() - lineHSLClr.getLum()) > Math.abs(bkgHSLClr.getLum() - fillHSLClr.getLum())) 4529 { 4530 retColor = lineClr; 4531 } 4532 } 4533 return retColor; 4534 }; 4535 mxVsdxTheme.prototype.getFillColor = function (quickStyleVals, getGradient) { 4536 if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((typeof getGradient === 'boolean') || getGradient === null)) { 4537 return this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$boolean(quickStyleVals, getGradient); 4538 } 4539 else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && getGradient === undefined) { 4540 return this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4541 } 4542 else 4543 throw new Error('invalid overload'); 4544 }; 4545 /*private*/ mxVsdxTheme.prototype.getLineStyle = function (quickStyleLineMatrix, lineStyles) { 4546 this.processTheme(); 4547 var lineStyle = null; 4548 switch ((quickStyleLineMatrix)) { 4549 case 1: 4550 case 2: 4551 case 3: 4552 case 4: 4553 case 5: 4554 case 6: 4555 lineStyle = lineStyles[quickStyleLineMatrix - 1]; 4556 break; 4557 case 100: 4558 case 101: 4559 case 102: 4560 case 103: 4561 var index = quickStyleLineMatrix - 100; 4562 if (lineStyles === this.lineStyles) { 4563 lineStyle = this.lineStyles[this.variantLineIdx[this.themeVariant][index] - 1]; 4564 } 4565 else { 4566 lineStyle = this.defaultLineStyle; 4567 } 4568 break; 4569 } 4570 return lineStyle; 4571 }; 4572 /*private*/ mxVsdxTheme.prototype.getLineStyleExt = function (quickStyleLineMatrix, lineStylesExt) { 4573 this.processTheme(); 4574 var lineStyleExt = null; 4575 switch ((quickStyleLineMatrix)) { 4576 case 0: 4577 case 1: 4578 case 2: 4579 case 3: 4580 case 4: 4581 case 5: 4582 case 6: 4583 lineStyleExt = lineStylesExt[quickStyleLineMatrix]; 4584 break; 4585 } 4586 return lineStyleExt; 4587 }; 4588 mxVsdxTheme.prototype.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList = function (quickStyleVals, lineStyles) { 4589 this.processTheme(); 4590 var lineColorStyle = quickStyleVals.getQuickStyleLineColor(); 4591 var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles); 4592 switch ((quickStyleVals.getQuickStyleLineMatrix())) { 4593 case 100: 4594 case 101: 4595 case 102: 4596 case 103: 4597 if (this.isMonotoneVariant[this.themeVariant]) 4598 lineColorStyle = 100; 4599 break; 4600 } 4601 var lineClr; 4602 if (lineStyle != null) { 4603 lineClr = lineStyle.getLineColor(lineColorStyle, this); 4604 } 4605 else { 4606 lineClr = this.getStyleColor(lineColorStyle); 4607 } 4608 var styleVariation = quickStyleVals.getQuickStyleVariation(); 4609 4610 //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 4611 if ((styleVariation & 4) > 0) 4612 { 4613 var bkgHSLClr = this.getStyleColor(8).toHsl(); 4614 var fillColor = this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4615 var fillHSLClr = fillColor.toHsl(); 4616 var lineHSLClr = lineClr.toHsl(); 4617 4618 if (Math.abs(bkgHSLClr.getLum() - lineHSLClr.getLum()) >= 0.1666) 4619 { 4620 //nothing 4621 } 4622 else if (bkgHSLClr.getLum() <= 0.7292) 4623 { 4624 lineClr = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255); 4625 } 4626 else if (Math.abs(bkgHSLClr.getLum() - fillHSLClr.getLum()) > Math.abs(bkgHSLClr.getLum() - lineHSLClr.getLum())) 4627 { 4628 lineClr = fillColor; 4629 } 4630 } 4631 return lineClr; 4632 }; 4633 mxVsdxTheme.prototype.getLineColor = function (quickStyleVals, lineStyles) { 4634 if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((lineStyles != null && (lineStyles instanceof Array)) || lineStyles === null)) { 4635 return this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, lineStyles); 4636 } 4637 else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && lineStyles === undefined) { 4638 return this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4639 } 4640 else 4641 throw new Error('invalid overload'); 4642 }; 4643 mxVsdxTheme.prototype.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) { 4644 return this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.lineStyles); 4645 }; 4646 mxVsdxTheme.prototype.getConnLineColor = function (quickStyleVals) { 4647 return this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.connLineStyles); 4648 }; 4649 mxVsdxTheme.prototype.getDefaultLineClr = function () { 4650 return this.defaultLineClr; 4651 }; 4652 mxVsdxTheme.prototype.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList = function (quickStyleVals, lineStylesExt, lineStyles) { 4653 var lineStyleExt = this.getLineStyleExt(quickStyleVals.getQuickStyleLineMatrix(), lineStylesExt); 4654 if (lineStyleExt != null) { 4655 return lineStyleExt.isDashed(); 4656 } 4657 else { 4658 var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles); 4659 return lineStyle != null ? lineStyle.isDashed() : false; 4660 } 4661 }; 4662 mxVsdxTheme.prototype.isLineDashed = function (quickStyleVals, lineStylesExt, lineStyles) { 4663 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)) { 4664 return this.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, lineStylesExt, lineStyles); 4665 } 4666 else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && lineStylesExt === undefined && lineStyles === undefined) { 4667 return this.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4668 } 4669 else 4670 throw new Error('invalid overload'); 4671 }; 4672 mxVsdxTheme.prototype.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) { 4673 return this.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, this.lineStylesExt, this.lineStyles); 4674 }; 4675 mxVsdxTheme.prototype.isConnLineDashed = function (quickStyleVals) { 4676 return this.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, this.connLineStylesExt, this.connLineStyles); 4677 }; 4678 mxVsdxTheme.prototype.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList = function (quickStyleVals, lineStylesExt, lineStyles) { 4679 var lineStyleExt = this.getLineStyleExt(quickStyleVals.getQuickStyleLineMatrix(), lineStylesExt); 4680 if (lineStyleExt != null) { 4681 return lineStyleExt.getLineDashPattern(); 4682 } 4683 else { 4684 var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles); 4685 return lineStyle != null ? lineStyle.getLineDashPattern() : null; 4686 } 4687 }; 4688 mxVsdxTheme.prototype.getLineDashPattern = function (quickStyleVals, lineStylesExt, lineStyles) { 4689 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)) { 4690 return this.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, lineStylesExt, lineStyles); 4691 } 4692 else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && lineStylesExt === undefined && lineStyles === undefined) { 4693 return this.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4694 } 4695 else 4696 throw new Error('invalid overload'); 4697 }; 4698 mxVsdxTheme.prototype.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) { 4699 return this.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, this.lineStylesExt, this.lineStyles); 4700 }; 4701 mxVsdxTheme.prototype.getConnLineDashPattern = function (quickStyleVals) { 4702 return this.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList$java_util_ArrayList(quickStyleVals, this.connLineStylesExt, this.connLineStyles); 4703 }; 4704 /*private*/ mxVsdxTheme.prototype.getArrowSize = function (quickStyleVals, isStart, lineStylesExt, lineStyles) { 4705 var lineStyleExt = this.getLineStyleExt(quickStyleVals.getQuickStyleLineMatrix(), lineStylesExt); 4706 if (lineStyleExt != null) { 4707 return isStart ? lineStyleExt.getStartSize() : lineStyleExt.getEndSize(); 4708 } 4709 else { 4710 var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles); 4711 return lineStyle != null ? (isStart ? lineStyle.getStartSize() : lineStyle.getEndSize()) : 4; 4712 } 4713 }; 4714 mxVsdxTheme.prototype.getStartSize = function (quickStyleVals) { 4715 return this.getArrowSize(quickStyleVals, true, this.lineStylesExt, this.lineStyles); 4716 }; 4717 mxVsdxTheme.prototype.getConnStartSize = function (quickStyleVals) { 4718 return this.getArrowSize(quickStyleVals, true, this.connLineStylesExt, this.connLineStyles); 4719 }; 4720 mxVsdxTheme.prototype.getEndSize = function (quickStyleVals) { 4721 return this.getArrowSize(quickStyleVals, false, this.lineStylesExt, this.lineStyles); 4722 }; 4723 mxVsdxTheme.prototype.getConnEndSize = function (quickStyleVals) { 4724 return this.getArrowSize(quickStyleVals, false, this.connLineStylesExt, this.connLineStyles); 4725 }; 4726 mxVsdxTheme.prototype.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList = function (quickStyleVals, fontColors) { 4727 this.processTheme(); 4728 var fontColorStyle = quickStyleVals.getQuickStyleFontColor(); 4729 var fontColor = null; 4730 switch ((quickStyleVals.getQuickStyleFontMatrix())) { 4731 case 1: 4732 case 2: 4733 case 3: 4734 case 4: 4735 case 5: 4736 case 6: 4737 fontColor = fontColors[quickStyleVals.getQuickStyleFontMatrix() - 1]; 4738 break; 4739 case 100: 4740 case 101: 4741 case 102: 4742 case 103: 4743 if (this.isMonotoneVariant[this.themeVariant]) 4744 fontColorStyle = 100; 4745 var index = quickStyleVals.getQuickStyleFontMatrix() - 100; 4746 if (fontColors !== this.fontColors) { 4747 fontColor = (function (m, k) { return m[k] ? m[k] : null; })(this.baseColors, "dk1"); 4748 } 4749 else { 4750 fontColor = fontColors[this.variantFontIdx[this.themeVariant][index] - 1]; 4751 } 4752 break; 4753 } 4754 var txtColor; 4755 if (fontColor != null) { 4756 txtColor = fontColor.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(fontColorStyle, this); 4757 } 4758 else { 4759 txtColor = this.getStyleColor(fontColorStyle); 4760 } 4761 var styleVariation = quickStyleVals.getQuickStyleVariation(); 4762 4763 //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 4764 if ((styleVariation & 2) > 0) 4765 { 4766 var bkgHSLClr = this.getStyleColor(8).toHsl(); 4767 var txtHSLClr = txtColor.toHsl(); 4768 var fillColor = this.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4769 var fillHSLClr = fillColor.toHsl(); 4770 var lineClr = this.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4771 var lineHSLClr = lineClr.toHsl(); 4772 4773 if (Math.abs(bkgHSLClr.getLum() - txtHSLClr.getLum()) >= 0.1666) 4774 { 4775 //nothing 4776 } 4777 else if (bkgHSLClr.getLum() <= 0.7292) 4778 { 4779 txtColor = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255); 4780 } 4781 else 4782 { 4783 var lineDiff = Math.abs(bkgHSLClr.getLum() - lineHSLClr.getLum()); 4784 var fillDiff = Math.abs(bkgHSLClr.getLum() - fillHSLClr.getLum()); 4785 var txtDiff = Math.abs(bkgHSLClr.getLum() - txtHSLClr.getLum()); 4786 var max = Math.max(lineDiff, fillDiff, txtDiff); 4787 4788 if (max == lineDiff) 4789 { 4790 txtColor = lineClr; 4791 } 4792 else if (max == fillDiff) 4793 { 4794 txtColor = fillColor; 4795 } 4796 } 4797 } 4798 4799 return txtColor; 4800 }; 4801 mxVsdxTheme.prototype.getFontColor = function (quickStyleVals, fontColors) { 4802 if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((fontColors != null && (fontColors instanceof Array)) || fontColors === null)) { 4803 return this.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, fontColors); 4804 } 4805 else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && fontColors === undefined) { 4806 return this.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4807 } 4808 else 4809 throw new Error('invalid overload'); 4810 }; 4811 mxVsdxTheme.prototype.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) { 4812 return this.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.fontColors); 4813 }; 4814 mxVsdxTheme.prototype.getConnFontColor = function (quickStyleVals) { 4815 return this.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.connFontColors); 4816 }; 4817 /*private*/ mxVsdxTheme.prototype.getArrowType = function (quickStyleVals, isStart, lineStylesExt, lineStyles) { 4818 var lineStyleExt = this.getLineStyleExt(quickStyleVals.getQuickStyleLineMatrix(), lineStylesExt); 4819 if (lineStyleExt != null) { 4820 return isStart ? lineStyleExt.getStart() : lineStyleExt.getEnd(); 4821 } 4822 else { 4823 var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles); 4824 return lineStyle != null ? (isStart ? lineStyle.getStart() : lineStyle.getEnd()) : 0; 4825 } 4826 }; 4827 mxVsdxTheme.prototype.getEdgeMarker = function (isStart, quickStyleVals) { 4828 return this.getArrowType(quickStyleVals, isStart, this.lineStylesExt, this.lineStyles); 4829 }; 4830 mxVsdxTheme.prototype.getConnEdgeMarker = function (isStart, quickStyleVals) { 4831 return this.getArrowType(quickStyleVals, isStart, this.connLineStylesExt, this.connLineStyles); 4832 }; 4833 mxVsdxTheme.prototype.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList = function (quickStyleVals, lineStyles) { 4834 var lineStyle = this.getLineStyle(quickStyleVals.getQuickStyleLineMatrix(), lineStyles); 4835 return lineStyle != null ? lineStyle.getLineWidth() : 0; 4836 }; 4837 mxVsdxTheme.prototype.getLineWidth = function (quickStyleVals, lineStyles) { 4838 if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && ((lineStyles != null && (lineStyles instanceof Array)) || lineStyles === null)) { 4839 return this.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, lineStyles); 4840 } 4841 else if (((quickStyleVals != null && quickStyleVals instanceof com.mxgraph.io.vsdx.theme.QuickStyleVals) || quickStyleVals === null) && lineStyles === undefined) { 4842 return this.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals(quickStyleVals); 4843 } 4844 else 4845 throw new Error('invalid overload'); 4846 }; 4847 mxVsdxTheme.prototype.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals = function (quickStyleVals) { 4848 return this.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.lineStyles); 4849 }; 4850 mxVsdxTheme.prototype.getConnLineWidth = function (quickStyleVals) { 4851 return this.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals$java_util_ArrayList(quickStyleVals, this.connLineStyles); 4852 }; 4853 return mxVsdxTheme; 4854 }()); 4855 mxVsdxTheme.__static_initialized = false; 4856 vsdx.mxVsdxTheme = mxVsdxTheme; 4857 mxVsdxTheme["__class"] = "com.mxgraph.io.vsdx.mxVsdxTheme"; 4858 })(vsdx = io.vsdx || (io.vsdx = {})); 4859 })(io = mxgraph.io || (mxgraph.io = {})); 4860 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 4861})(com || (com = {})); 4862(function (com) { 4863 var mxgraph; 4864 (function (mxgraph) { 4865 var io; 4866 (function (io) { 4867 var vsdx; 4868 (function (vsdx) { 4869 /** 4870 * General utilities for .vdx format support 4871 * @class 4872 */ 4873 var mxVsdxUtils = (function () { 4874 function mxVsdxUtils() { 4875 } 4876 mxVsdxUtils.conversionFactor_$LI$ = function () { if (mxVsdxUtils.conversionFactor == null) 4877 mxVsdxUtils.conversionFactor = mxVsdxUtils.screenCoordinatesPerCm * mxVsdxUtils.CENTIMETERS_PER_INCHES; return mxVsdxUtils.conversionFactor; }; 4878 ; 4879 /** 4880 * Returns a collection of direct child Elements that match the specified tag name 4881 * @param {*} parent the parent whose direct children will be processed 4882 * @param {string} name the child tag name to match 4883 * @return {*[]} a collection of matching Elements 4884 */ 4885 mxVsdxUtils.getDirectChildNamedElements = function (parent, name) { 4886 var result = ([]); 4887 for (var child = parent.firstChild; child != null; child = child.nextSibling) { 4888 if ((child != null && (child.nodeType == 1)) && (function (o1, o2) { if (o1 && o1.equals) { 4889 return o1.equals(o2); 4890 } 4891 else { 4892 return o1 === o2; 4893 } })(name, child.nodeName)) { 4894 /* add */ (result.push(child)); 4895 } 4896 } 4897 ; 4898 return result; 4899 }; 4900 /** 4901 * Returns a collection of direct child Elements 4902 * @param {*} parent the parent whose direct children will be processed 4903 * @return {*[]} a collection of all child Elements 4904 */ 4905 mxVsdxUtils.getDirectChildElements = function (parent) { 4906 var result = ([]); 4907 for (var child = parent.firstChild; child != null; child = child.nextSibling) { 4908 if (child != null && (child.nodeType == 1)) { 4909 /* add */ (result.push(child)); 4910 } 4911 } 4912 ; 4913 return result; 4914 }; 4915 /** 4916 * Returns the first direct child Element 4917 * @param {*} parent the parent whose direct first child will be processed 4918 * @return {*} the first child Element 4919 */ 4920 mxVsdxUtils.getDirectFirstChildElement = function (parent) { 4921 for (var child = parent.firstChild; child != null; child = child.nextSibling) { 4922 if (child != null && (child.nodeType == 1)) { 4923 return child; 4924 } 4925 } 4926 ; 4927 return null; 4928 }; 4929 mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String$int = function (elem, attName, defVal) { 4930 try { 4931 var val = elem.getAttribute(attName); 4932 if (val != null) { 4933 return parseInt(val); 4934 } 4935 } 4936 catch (e) { 4937 } 4938 ; 4939 return defVal; 4940 }; 4941 /** 4942 * Return the value of an integer attribute or the default value 4943 * @param {*} elem Element 4944 * @param {string} attName Attribute name 4945 * @param {number} defVal default value 4946 * @return {number} the parsed attribute value or the default value 4947 */ 4948 mxVsdxUtils.getIntAttr = function (elem, attName, defVal) { 4949 if (((elem != null && (elem.nodeType == 1)) || elem === null) && ((typeof attName === 'string') || attName === null) && ((typeof defVal === 'number') || defVal === null)) { 4950 return com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String$int(elem, attName, defVal); 4951 } 4952 else if (((elem != null && (elem.nodeType == 1)) || elem === null) && ((typeof attName === 'string') || attName === null) && defVal === undefined) { 4953 return com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(elem, attName); 4954 } 4955 else 4956 throw new Error('invalid overload'); 4957 }; 4958 mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String = function (elem, attName) { 4959 return mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String$int(elem, attName, 0); 4960 }; 4961 /** 4962 * Returns the string that represents the content of a given style map. 4963 * @param {*} styleMap Map with the styles values 4964 * @return {string} string that represents the style. 4965 * @param {string} asig 4966 */ 4967 mxVsdxUtils.getStyleString = function (styleMap, asig) { 4968 var style = ""; 4969 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)); 4970 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)); 4971 while ((kit.hasNext())) { 4972 var key = kit.next(); 4973 var value = it.next(); 4974 if (!(function (o1, o2) { if (o1 && o1.equals) { 4975 return o1.equals(o2); 4976 } 4977 else { 4978 return o1 === o2; 4979 } })(key, mxConstants.STYLE_SHAPE) || (!(function (str, searchString, position) { 4980 if (position === void 0) { position = 0; } 4981 return str.substr(position, searchString.length) === searchString; 4982 })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(styleMap, key), "image") && !(function (str, searchString, position) { 4983 if (position === void 0) { position = 0; } 4984 return str.substr(position, searchString.length) === searchString; 4985 })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(styleMap, key), "rounded="))) { 4986 try { 4987 style = style + key + asig; 4988 } 4989 catch (e) { 4990 console.error("mxVsdxUtils.getStyleString," + e + ",style.length=" + style.length + ",key.length=" + key.length + ",asig.length=" + asig.length); 4991 } 4992 ; 4993 } 4994 style = style + value + ";"; 4995 } 4996 ; 4997 return style; 4998 }; 4999 /** 5000 * Returns a text surrounded by tags html. 5001 * @param {string} text Text to be surrounded. 5002 * @param {string} tag Name of the tag. 5003 * @return {string} < tag > text < /tag > 5004 */ 5005 mxVsdxUtils.surroundByTags = function (text, tag) { 5006 return "<" + tag + ">" + text + "</" + tag + ">"; 5007 }; 5008 /** 5009 * Converts the ampersand, quote, prime, less-than and greater-than 5010 * characters to their corresponding HTML entities in the given string. 5011 * 5012 * Note: this is the same method of mxUtils but we cannot use it as it is not compatible with google app engine 5013 * @param {string} text 5014 * @return {string} 5015 */ 5016 mxVsdxUtils.htmlEntities = function (text) { 5017 return text.replace(new RegExp("&", 'g'), "&").replace(new RegExp("\"", 'g'), """).replace(new RegExp("\'", 'g'), "′").replace(new RegExp("<", 'g'), "<").replace(new RegExp(">", 'g'), ">"); 5018 }; 5019 /** 5020 * Converts the initial letter of each word in text to uppercase 5021 * @param {string} text Text to be transformed. 5022 * @return {string} Text with initial capitals. 5023 */ 5024 mxVsdxUtils.toInitialCapital = function (text) { 5025 var words = text.split(" "); 5026 var ret = ""; 5027 for (var index150 = 0; index150 < words.length; index150++) { 5028 var word = words[index150]; 5029 { 5030 var begin = word.substring(0, 1); 5031 word = word.substring(1); 5032 begin = begin.toUpperCase(); 5033 ret += begin + word; 5034 } 5035 } 5036 return ret.substring(0, ret.length); 5037 }; 5038 /** 5039 * Trnsforms each lower case letter in text to small capital. 5040 * @param {string} text Text to be transformed. 5041 * @param {string} size Size of the original text. 5042 * @return {string} Text in small capitals. 5043 */ 5044 mxVsdxUtils.toSmallCaps = function (text, size) { 5045 var ret = ""; 5046 if (!(function (o1, o2) { if (o1 && o1.equals) { 5047 return o1.equals(o2); 5048 } 5049 else { 5050 return o1 === o2; 5051 } })(size, ret)) { 5052 var a = 'a'; 5053 var z = 'z'; 5054 var letters = (text).split(''); 5055 for (var index151 = 0; index151 < letters.length; index151++) { 5056 var c = letters[index151]; 5057 { 5058 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)) { 5059 var s = new String(c).toString(); 5060 s = s.toUpperCase(); 5061 ret += "<font style=\"font-size:" + parseFloat(size) / 1.28 + "px\">" + s + "</font>"; 5062 } 5063 else { 5064 ret += c; 5065 } 5066 } 5067 } 5068 } 5069 else { 5070 ret = text; 5071 } 5072 return ret; 5073 }; 5074 /** 5075 * Create a style map from a String with style definitions. 5076 * @param {string} style Definition of the style. 5077 * @param {string} asig Asignation simbol used in 'style'. 5078 * @return {*} Map with the style properties. 5079 */ 5080 mxVsdxUtils.getStyleMap = function (style, asig) { 5081 var styleMap = ({}); 5082 var entries = style.split(";"); 5083 for (var index152 = 0; index152 < entries.length; index152++) { 5084 var entry = entries[index152]; 5085 { 5086 var index = entry.indexOf(asig); 5087 var key = entry.substring(0, index); 5088 var value = entry.substring(index + 1); 5089 /* put */ (styleMap[key] = value); 5090 } 5091 } 5092 return styleMap; 5093 }; 5094 mxVsdxUtils.isInsideTriangle = function (x, y, ax, ay, bx, by, cx, cy) { 5095 function sign (p1x, p1y, p2x, p2y, p3x, p3y) 5096 { 5097 return (p1x - p3x) * (p2y - p3y) - (p2x - p3x) * (p1y - p3y); 5098 } 5099 5100 var d1 = sign(x, y, ax, ay, bx, by); 5101 var d2 = sign(x, y, bx, by, cx, cy); 5102 var d3 = sign(x, y, cx, cy, ax, ay); 5103 5104 var has_neg = (d1 < 0) || (d2 < 0) || (d3 < 0); 5105 var has_pos = (d1 > 0) || (d2 > 0) || (d3 > 0); 5106 5107 return !(has_neg && has_pos); 5108 }; 5109 return mxVsdxUtils; 5110 }()); 5111 mxVsdxUtils.screenCoordinatesPerCm = 40; 5112 mxVsdxUtils.CENTIMETERS_PER_INCHES = 2.54; 5113 vsdx.mxVsdxUtils = mxVsdxUtils; 5114 mxVsdxUtils["__class"] = "com.mxgraph.io.vsdx.mxVsdxUtils"; 5115 })(vsdx = io.vsdx || (io.vsdx = {})); 5116 })(io = mxgraph.io || (mxgraph.io = {})); 5117 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5118})(com || (com = {})); 5119(function (com) { 5120 var mxgraph; 5121 (function (mxgraph) { 5122 var io; 5123 (function (io) { 5124 var vsdx; 5125 (function (vsdx) { 5126 /** 5127 * Represents a single formatted section of text 5128 * @param {string} val 5129 * @param {string} ch 5130 * @param {string} pg 5131 * @param {string} field 5132 * @class 5133 */ 5134 var Paragraph = (function () { 5135 function Paragraph(val, ch, pg, field) { 5136 this.values = null; 5137 this.charIndices = null; 5138 this.fields = null; 5139 this.paraIndex = null; 5140 this.values = ([]); 5141 /* add */ (this.values.push(val)); 5142 this.charIndices = ([]); 5143 /* add */ (this.charIndices.push(ch)); 5144 this.fields = ([]); 5145 /* add */ (this.fields.push(field)); 5146 this.paraIndex = pg; 5147 } 5148 Paragraph.prototype.addText = function (val, ch, field) { 5149 /* add */ (this.values.push(val)); 5150 /* add */ (this.charIndices.push(ch)); 5151 /* add */ (this.fields.push(field)); 5152 }; 5153 Paragraph.prototype.getParagraphIndex = function () { 5154 return this.paraIndex; 5155 }; 5156 Paragraph.prototype.getValue = function (index) { 5157 return this.values[index]; 5158 }; 5159 Paragraph.prototype.numValues = function () { 5160 return this.values.length; 5161 }; 5162 Paragraph.prototype.getChar = function (index) { 5163 return this.charIndices[index]; 5164 }; 5165 Paragraph.prototype.getField = function (index) { 5166 return this.fields[index]; 5167 }; 5168 return Paragraph; 5169 }()); 5170 vsdx.Paragraph = Paragraph; 5171 Paragraph["__class"] = "com.mxgraph.io.vsdx.Paragraph"; 5172 })(vsdx = io.vsdx || (io.vsdx = {})); 5173 })(io = mxgraph.io || (mxgraph.io = {})); 5174 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5175})(com || (com = {})); 5176(function (com) { 5177 var mxgraph; 5178 (function (mxgraph) { 5179 var io; 5180 (function (io) { 5181 var vsdx; 5182 (function (vsdx) { 5183 /** 5184 * Constructs a new Section 5185 * @param {*} elem the Element to wrap 5186 * @class 5187 */ 5188 var Section = (function () { 5189 function Section(elem) { 5190 /** 5191 * The section element 5192 */ 5193 this.elem = null; 5194 this.elem = elem; 5195 } 5196 /** 5197 * Return the specified cell by key by row index, if it exists 5198 * @param {string} index the row index to search 5199 * @param {string} cellKey the name of the Cell to search for 5200 * @return {*} the Element of the specified Cell, if null if it doesn't exist 5201 */ 5202 Section.prototype.getIndexedCell = function (index, cellKey) { 5203 var rows = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(this.elem, "Row"); 5204 for (var i = 0; i < rows.length; i++) { 5205 var row = rows[i]; 5206 var n = row.getAttribute("IX"); 5207 if ((function (o1, o2) { if (o1 && o1.equals) { 5208 return o1.equals(o2); 5209 } 5210 else { 5211 return o1 === o2; 5212 } })(n, index) || index == null) { 5213 var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(row, "Cell"); 5214 for (var j = 0; j < cells.length; j++) { 5215 var cell = cells[j]; 5216 n = cell.getAttribute("N"); 5217 if ((function (o1, o2) { if (o1 && o1.equals) { 5218 return o1.equals(o2); 5219 } 5220 else { 5221 return o1 === o2; 5222 } })(n, cellKey)) { 5223 return cell; 5224 } 5225 } 5226 ; 5227 } 5228 } 5229 ; 5230 return null; 5231 }; 5232 return Section; 5233 }()); 5234 vsdx.Section = Section; 5235 Section["__class"] = "com.mxgraph.io.vsdx.Section"; 5236 })(vsdx = io.vsdx || (io.vsdx = {})); 5237 })(io = mxgraph.io || (mxgraph.io = {})); 5238 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5239})(com || (com = {})); 5240(function (com) { 5241 var mxgraph; 5242 (function (mxgraph) { 5243 var io; 5244 (function (io) { 5245 var vsdx; 5246 (function (vsdx) { 5247 /** 5248 * Wraps the page and shape ID within that page to create a unique ID 5249 * @param {number} pageNumber 5250 * @param {number} Id 5251 * @class 5252 */ 5253 var ShapePageId = (function () { 5254 function ShapePageId(pageNumber, Id) { 5255 this.pageNumber = 0; 5256 this.Id = 0; 5257 this.pageNumber = pageNumber; 5258 this.Id = Id; 5259 } 5260 ShapePageId.prototype.getId = function () { 5261 return this.Id; 5262 }; 5263 ShapePageId.prototype.getPageNumber = function () { 5264 return this.pageNumber; 5265 }; 5266 /** 5267 * 5268 * @param {*} obj 5269 * @return {boolean} 5270 */ 5271 ShapePageId.prototype.equals = function (obj) { 5272 if (obj == null || this.constructor !== obj.constructor) { 5273 return false; 5274 } 5275 var other = obj; 5276 if (this.pageNumber !== other.pageNumber || this.Id !== other.Id) { 5277 return false; 5278 } 5279 return true; 5280 }; 5281 /** 5282 * 5283 * @return {number} 5284 */ 5285 ShapePageId.prototype.hashCode = function () { 5286 return 100000 * this.pageNumber + this.Id; 5287 }; 5288 return ShapePageId; 5289 }()); 5290 vsdx.ShapePageId = ShapePageId; 5291 ShapePageId["__class"] = "com.mxgraph.io.vsdx.ShapePageId"; 5292 })(vsdx = io.vsdx || (io.vsdx = {})); 5293 })(io = mxgraph.io || (mxgraph.io = {})); 5294 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5295})(com || (com = {})); 5296(function (com) { 5297 var mxgraph; 5298 (function (mxgraph) { 5299 var io; 5300 (function (io) { 5301 var vsdx; 5302 (function (vsdx) { 5303 var theme; 5304 (function (theme) { 5305 var Color = (function () { 5306 function Color(red, green, blue) { 5307 this.red = 0; 5308 this.green = 0; 5309 this.blue = 0; 5310 this.gradientClr = null; 5311 this.red = red; 5312 this.green = green; 5313 this.blue = blue; 5314 } 5315 Color.NONE_$LI$ = function () { if (Color.NONE == null) 5316 Color.NONE = new Color(-1, -1, -1); return Color.NONE; }; 5317 ; 5318 Color.prototype.getRed = function () { 5319 return this.red; 5320 }; 5321 Color.prototype.setRed = function (red) { 5322 this.red = red; 5323 }; 5324 Color.prototype.getGreen = function () { 5325 return this.green; 5326 }; 5327 Color.prototype.setGreen = function (green) { 5328 this.green = green; 5329 }; 5330 Color.prototype.getBlue = function () { 5331 return this.blue; 5332 }; 5333 Color.prototype.setBlue = function (blue) { 5334 this.blue = blue; 5335 }; 5336 Color.prototype.toHsl = function () { 5337 var r = this.getRed() / 255.0; 5338 var g = this.getGreen() / 255.0; 5339 var b = this.getBlue() / 255.0; 5340 var max = Math.max(r, Math.max(g, b)); 5341 var min = Math.min(r, Math.min(g, b)); 5342 var l = (max + min) / 2.0; 5343 var h; 5344 var s; 5345 if (max === min) { 5346 h = s = 0; 5347 } 5348 else { 5349 var d = max - min; 5350 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 5351 if (max === r) { 5352 h = (g - b) / d + (g < b ? 6 : 0); 5353 } 5354 else if (max === g) { 5355 h = (b - r) / d + 2; 5356 } 5357 else { 5358 h = (r - g) / d + 4; 5359 } 5360 h /= 6; 5361 } 5362 return new com.mxgraph.io.vsdx.theme.HSLColor(h, s, l); 5363 }; 5364 Color.prototype.toHsv = function () { 5365 var r = this.getRed() / 255.0; 5366 var g = this.getGreen() / 255.0; 5367 var b = this.getBlue() / 255.0; 5368 var max = Math.max(r, Math.max(g, b)); 5369 var min = Math.min(r, Math.min(g, b)); 5370 var h; 5371 var s; 5372 var v = max; 5373 var d = max - min; 5374 s = max === 0 ? 0 : d / max; 5375 if (max === min) { 5376 h = 0; 5377 } 5378 else { 5379 if (max === r) { 5380 h = (g - b) / d + (g < b ? 6 : 0); 5381 } 5382 else if (max === g) { 5383 h = (b - r) / d + 2; 5384 } 5385 else { 5386 h = (r - g) / d + 4; 5387 } 5388 h /= 6; 5389 } 5390 return new com.mxgraph.io.vsdx.theme.HSVColor(h, s, v); 5391 }; 5392 Color.decodeColorHex = function (hex) { 5393 var color = parseInt(hex, 16); 5394 return new Color((color >> 16) & 255, (color >> 8) & 255, color & 255); 5395 }; 5396 Color.prototype.toHexStr = function () { 5397 var r = this.red.toString(16); 5398 r = r.length == 1 ? '0' + r : r; 5399 var g = this.green.toString(16); 5400 g = g.length == 1 ? '0' + g : g; 5401 var b = this.blue.toString(16); 5402 b = b.length == 1 ? '0' + b : b; 5403 5404 return "#" + r + g + b; 5405 }; 5406 Color.prototype.getGradientClr = function () { 5407 return this.gradientClr; 5408 }; 5409 Color.prototype.setGradientClr = function (gradientClr) { 5410 this.gradientClr = gradientClr; 5411 }; 5412 return Color; 5413 }()); 5414 theme.Color = Color; 5415 Color["__class"] = "com.mxgraph.io.vsdx.theme.Color"; 5416 })(theme = vsdx.theme || (vsdx.theme = {})); 5417 })(vsdx = io.vsdx || (io.vsdx = {})); 5418 })(io = mxgraph.io || (mxgraph.io = {})); 5419 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5420})(com || (com = {})); 5421(function (com) { 5422 var mxgraph; 5423 (function (mxgraph) { 5424 var io; 5425 (function (io) { 5426 var vsdx; 5427 (function (vsdx) { 5428 var theme; 5429 (function (theme) { 5430 var FillStyleFactory = (function () { 5431 function FillStyleFactory() { 5432 } 5433 FillStyleFactory.getFillStyle = function (fillStyle) { 5434 var fillObj = null; 5435 switch ((fillStyle.nodeName)) { 5436 case "a:solidFill": 5437 fillObj = new com.mxgraph.io.vsdx.theme.SolidFillStyle(com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(fillStyle))); 5438 break; 5439 case "a:noFill": 5440 fillObj = new com.mxgraph.io.vsdx.theme.NoFillStyle(); 5441 break; 5442 case "a:gradFill": 5443 fillObj = new com.mxgraph.io.vsdx.theme.GradFill(fillStyle); 5444 break; 5445 case "a:blipFill": 5446 break; 5447 case "a:pattFill": 5448 break; 5449 case "a:grpFill": 5450 break; 5451 } 5452 return fillObj; 5453 }; 5454 return FillStyleFactory; 5455 }()); 5456 theme.FillStyleFactory = FillStyleFactory; 5457 FillStyleFactory["__class"] = "com.mxgraph.io.vsdx.theme.FillStyleFactory"; 5458 })(theme = vsdx.theme || (vsdx.theme = {})); 5459 })(vsdx = io.vsdx || (io.vsdx = {})); 5460 })(io = mxgraph.io || (mxgraph.io = {})); 5461 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5462})(com || (com = {})); 5463(function (com) { 5464 var mxgraph; 5465 (function (mxgraph) { 5466 var io; 5467 (function (io) { 5468 var vsdx; 5469 (function (vsdx) { 5470 var theme; 5471 (function (theme_2) { 5472 var GradFill = (function () { 5473 function GradFill(elem) { 5474 /*private*/ this.color1 = null; 5475 /*private*/ this.color2 = null; 5476 var gsLst = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(elem, "a:gsLst"); 5477 if (gsLst.length > 0) { 5478 var gs = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(/* get */ gsLst[0]); 5479 if (gs.length >= 2) { 5480 this.color2 = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(/* get */ gs[0])); 5481 this.color1 = com.mxgraph.io.vsdx.theme.OoxmlColorFactory.getOoxmlColor(com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(/* get */ gs[gs.length - 1])); 5482 } 5483 } 5484 if (this.color1 == null) { 5485 this.color1 = this.color2 = new com.mxgraph.io.vsdx.theme.SrgbClr("FFFFFF"); 5486 } 5487 } 5488 /** 5489 * 5490 * @param {number} styleValue 5491 * @param {com.mxgraph.io.vsdx.mxVsdxTheme} theme 5492 * @return {com.mxgraph.io.vsdx.theme.Color} 5493 */ 5494 GradFill.prototype.applyStyle = function (styleValue, theme) { 5495 var color = this.color1.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(styleValue, theme); 5496 color.setGradientClr(this.color2.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(styleValue, theme)); 5497 return color; 5498 }; 5499 return GradFill; 5500 }()); 5501 theme_2.GradFill = GradFill; 5502 GradFill["__class"] = "com.mxgraph.io.vsdx.theme.GradFill"; 5503 GradFill["__interfaces"] = ["com.mxgraph.io.vsdx.theme.FillStyle"]; 5504 })(theme = vsdx.theme || (vsdx.theme = {})); 5505 })(vsdx = io.vsdx || (io.vsdx = {})); 5506 })(io = mxgraph.io || (mxgraph.io = {})); 5507 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5508})(com || (com = {})); 5509(function (com) { 5510 var mxgraph; 5511 (function (mxgraph) { 5512 var io; 5513 (function (io) { 5514 var vsdx; 5515 (function (vsdx) { 5516 var theme; 5517 (function (theme) { 5518 var HSLColor = (function () { 5519 function HSLColor(hue, sat, lum) { 5520 this.hue = 0; 5521 this.sat = 0; 5522 this.lum = 0; 5523 this.hue = hue; 5524 this.sat = sat; 5525 this.lum = lum; 5526 } 5527 HSLColor.prototype.getHue = function () { 5528 return this.hue; 5529 }; 5530 HSLColor.prototype.setHue = function (hue) { 5531 this.hue = hue; 5532 }; 5533 HSLColor.prototype.getSat = function () { 5534 return this.sat; 5535 }; 5536 HSLColor.prototype.setSat = function (sat) { 5537 this.sat = sat; 5538 }; 5539 HSLColor.prototype.getLum = function () { 5540 return this.lum; 5541 }; 5542 HSLColor.prototype.setLum = function (lum) { 5543 this.lum = lum; 5544 }; 5545 /*private*/ HSLColor.prototype.hue2rgb = function (p, q, t) { 5546 if (t < 0) 5547 t += 1; 5548 if (t > 1) 5549 t -= 1; 5550 if (t < 1 / 6.0) 5551 return p + (q - p) * 6 * t; 5552 if (t < 0.5) 5553 return q; 5554 if (t < 2 / 3.0) 5555 return p + (q - p) * (2 / 3.0 - t) * 6; 5556 return p; 5557 }; 5558 HSLColor.prototype.toRgb = function () { 5559 var r; 5560 var g; 5561 var b; 5562 var h = this.hue; 5563 var s = this.sat; 5564 var l = this.lum; 5565 if (s === 0) { 5566 r = g = b = l; 5567 } 5568 else { 5569 var q = l < 0.5 ? l * (1 + s) : l + s - l * s; 5570 var p = 2 * l - q; 5571 r = this.hue2rgb(p, q, h + 1 / 3.0); 5572 g = this.hue2rgb(p, q, h); 5573 b = this.hue2rgb(p, q, h - 1 / 3.0); 5574 } 5575 return new com.mxgraph.io.vsdx.theme.Color(((r * 255) | 0), ((g * 255) | 0), ((b * 255) | 0)); 5576 }; 5577 /*private*/ HSLColor.prototype.clamp01 = function (val) { 5578 return Math.min(1, Math.max(0, val)); 5579 }; 5580 HSLColor.prototype.tint = function (amount) { 5581 this.lum *= (1 + (amount / 100.0)); 5582 this.lum = this.clamp01(this.lum); 5583 return this; 5584 }; 5585 HSLColor.prototype.shade = function (amount) { 5586 this.lum *= amount / 100.0; 5587 this.lum = this.clamp01(this.lum); 5588 return this; 5589 }; 5590 HSLColor.prototype.satMod = function (amount) { 5591 this.sat *= amount / 100.0; 5592 this.sat = this.clamp01(this.sat); 5593 return this; 5594 }; 5595 HSLColor.prototype.lumMod = function (amount) { 5596 this.lum *= amount / 100.0; 5597 this.lum = this.clamp01(this.lum); 5598 return this; 5599 }; 5600 return HSLColor; 5601 }()); 5602 theme.HSLColor = HSLColor; 5603 HSLColor["__class"] = "com.mxgraph.io.vsdx.theme.HSLColor"; 5604 })(theme = vsdx.theme || (vsdx.theme = {})); 5605 })(vsdx = io.vsdx || (io.vsdx = {})); 5606 })(io = mxgraph.io || (mxgraph.io = {})); 5607 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5608})(com || (com = {})); 5609(function (com) { 5610 var mxgraph; 5611 (function (mxgraph) { 5612 var io; 5613 (function (io) { 5614 var vsdx; 5615 (function (vsdx) { 5616 var theme; 5617 (function (theme) { 5618 var HSVColor = (function () { 5619 function HSVColor(h, s, v) { 5620 this.h = 0; 5621 this.s = 0; 5622 this.v = 0; 5623 this.h = h; 5624 this.s = s; 5625 this.v = v; 5626 } 5627 HSVColor.prototype.toRgb = function () { 5628 var h = this.h * 6; 5629 var s = this.s; 5630 var l = this.v; 5631 var i = Math.floor(h); 5632 var f = h - i; 5633 var p = this.v * (1 - s); 5634 var q = this.v * (1 - f * s); 5635 var t = this.v * (1 - (1 - f) * s); 5636 var mod = (i | 0) % 6; 5637 var rArr = [this.v, q, p, p, t, this.v]; 5638 var gArr = [t, this.v, this.v, q, p, p]; 5639 var bArr = [p, p, t, this.v, this.v, q]; 5640 var r = rArr[mod]; 5641 var g = gArr[mod]; 5642 var b = bArr[mod]; 5643 return new com.mxgraph.io.vsdx.theme.Color(((r * 255) | 0), ((g * 255) | 0), ((b * 255) | 0)); 5644 }; 5645 /*private*/ HSVColor.prototype.clamp01 = function (val) { 5646 return Math.min(1, Math.max(0, val)); 5647 }; 5648 HSVColor.prototype.tint = function (amount) { 5649 this.v *= (1 + (amount / 100.0)); 5650 this.v = this.clamp01(this.v); 5651 return this; 5652 }; 5653 HSVColor.prototype.shade = function (amount) { 5654 this.v *= amount / 100.0; 5655 this.v = this.clamp01(this.v); 5656 return this; 5657 }; 5658 HSVColor.prototype.satMod = function (amount) { 5659 this.s *= amount / 100.0; 5660 this.s = this.clamp01(this.s); 5661 return this; 5662 }; 5663 HSVColor.prototype.lumMod = function (amount) { 5664 this.v *= amount / 100.0; 5665 this.v = this.clamp01(this.v); 5666 return this; 5667 }; 5668 HSVColor.prototype.hueMod = function (amount) { 5669 this.h *= amount / 100.0; 5670 this.h = this.clamp01(this.h); 5671 return this; 5672 }; 5673 return HSVColor; 5674 }()); 5675 theme.HSVColor = HSVColor; 5676 HSVColor["__class"] = "com.mxgraph.io.vsdx.theme.HSVColor"; 5677 })(theme = vsdx.theme || (vsdx.theme = {})); 5678 })(vsdx = io.vsdx || (io.vsdx = {})); 5679 })(io = mxgraph.io || (mxgraph.io = {})); 5680 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5681})(com || (com = {})); 5682(function (com) { 5683 var mxgraph; 5684 (function (mxgraph) { 5685 var io; 5686 (function (io) { 5687 var vsdx; 5688 (function (vsdx) { 5689 var theme; 5690 (function (theme_3) { 5691 var LineStyle = (function () { 5692 function LineStyle(elem) { 5693 var _this = this; 5694 /*private*/ this.isLineDashed = false; 5695 /*private*/ this.lineDashPattern = ([]); 5696 /*private*/ this.isRoundJoin = false; 5697 /*private*/ this.isBevelJoin = false; 5698 /*private*/ this.isMiterJoin = false; 5699 if (((elem != null && (elem.nodeType == 1)) || elem === null)) { 5700 var __args = Array.prototype.slice.call(arguments); 5701 this.lineWidth = 0; 5702 this.lineCap = null; 5703 this.lineComp = null; 5704 this.fillStyle = null; 5705 this.headEndType = null; 5706 this.headEndWidth = 0; 5707 this.headEndLen = 0; 5708 this.tailEndType = null; 5709 this.tailEndWidth = 0; 5710 this.tailEndLen = 0; 5711 this.isLineDashed = false; 5712 this.lineDashPattern = ([]); 5713 this.isRoundJoin = false; 5714 this.isBevelJoin = false; 5715 this.isMiterJoin = false; 5716 this.lineWidth = 0; 5717 this.lineCap = null; 5718 this.lineComp = null; 5719 this.fillStyle = null; 5720 this.headEndType = null; 5721 this.headEndWidth = 0; 5722 this.headEndLen = 0; 5723 this.tailEndType = null; 5724 this.tailEndWidth = 0; 5725 this.tailEndLen = 0; 5726 (function () { 5727 _this.lineWidth = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(elem, "w"); 5728 var lineCapAtt = elem.getAttribute("cap"); 5729 if (lineCapAtt != null) { 5730 switch ((lineCapAtt)) { 5731 case "rnd": 5732 _this.lineCap = LineStyle.LineCapType.ROUND; 5733 break; 5734 case "sq": 5735 _this.lineCap = LineStyle.LineCapType.SQUARE; 5736 break; 5737 case "flat": 5738 _this.lineCap = LineStyle.LineCapType.FLAT; 5739 break; 5740 } 5741 } 5742 var lineCompAtt = elem.getAttribute("cmpd"); 5743 if (lineCompAtt != null) { 5744 switch ((lineCompAtt)) { 5745 case "sng": 5746 _this.lineComp = LineStyle.CompoundLineType.SINGLE; 5747 break; 5748 case "dbl": 5749 _this.lineComp = LineStyle.CompoundLineType.DOUBLE; 5750 break; 5751 case "thickThin": 5752 _this.lineComp = LineStyle.CompoundLineType.THICK_THIN_DOUBLE; 5753 break; 5754 case "thinThick": 5755 _this.lineComp = LineStyle.CompoundLineType.THIN_THICK_DOUBLE; 5756 break; 5757 case "tri": 5758 _this.lineComp = LineStyle.CompoundLineType.THIN_THICK_THIN_TRIPLE; 5759 break; 5760 } 5761 } 5762 var subElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(elem); 5763 for (var index153 = 0; index153 < subElems.length; index153++) { 5764 var subElem = subElems[index153]; 5765 { 5766 var name_8 = subElem.nodeName; 5767 switch ((name_8)) { 5768 case "a:noFill": 5769 case "a:solidFill": 5770 case "a:gradFill": 5771 case "a:pattFill": 5772 _this.fillStyle = com.mxgraph.io.vsdx.theme.FillStyleFactory.getFillStyle(subElem); 5773 break; 5774 case "a:prstDash": 5775 var val = subElem.getAttribute("val"); 5776 _this.isLineDashed = true; 5777 switch ((val)) { 5778 case "solid": 5779 _this.isLineDashed = false; 5780 break; 5781 case "sysDot": 5782 case "dot": 5783 /* add */ (_this.lineDashPattern.push(1.0)); 5784 /* add */ (_this.lineDashPattern.push(4.0)); 5785 break; 5786 case "sysDash": 5787 case "dash": 5788 break; 5789 case "lgDash": 5790 /* add */ (_this.lineDashPattern.push(12.0)); 5791 /* add */ (_this.lineDashPattern.push(4.0)); 5792 break; 5793 case "sysDashDot": 5794 case "dashDot": 5795 /* add */ (_this.lineDashPattern.push(8.0)); 5796 /* add */ (_this.lineDashPattern.push(4.0)); 5797 /* add */ (_this.lineDashPattern.push(1.0)); 5798 /* add */ (_this.lineDashPattern.push(4.0)); 5799 break; 5800 case "lgDashDot": 5801 /* add */ (_this.lineDashPattern.push(12.0)); 5802 /* add */ (_this.lineDashPattern.push(4.0)); 5803 /* add */ (_this.lineDashPattern.push(1.0)); 5804 /* add */ (_this.lineDashPattern.push(4.0)); 5805 break; 5806 case "sysDashDotDot": 5807 case "lgDashDotDot": 5808 /* add */ (_this.lineDashPattern.push(12.0)); 5809 /* add */ (_this.lineDashPattern.push(4.0)); 5810 /* add */ (_this.lineDashPattern.push(1.0)); 5811 /* add */ (_this.lineDashPattern.push(4.0)); 5812 /* add */ (_this.lineDashPattern.push(1.0)); 5813 /* add */ (_this.lineDashPattern.push(4.0)); 5814 break; 5815 } 5816 break; 5817 case "a:custDash": 5818 _this.isLineDashed = true; 5819 var dsElems = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(subElem, "a:ds"); 5820 for (var index154 = 0; index154 < dsElems.length; index154++) { 5821 var dsElem = dsElems[index154]; 5822 { 5823 var dashLen = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(dsElem, "d"); 5824 var spaceLen = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(dsElem, "sp"); 5825 /* add */ (_this.lineDashPattern.push(dashLen / 10000.0)); 5826 /* add */ (_this.lineDashPattern.push(spaceLen / 10000.0)); 5827 } 5828 } 5829 break; 5830 case "a:round": 5831 _this.isRoundJoin = true; 5832 break; 5833 case "a:bevel": 5834 _this.isBevelJoin = true; 5835 break; 5836 case "a:miter": 5837 var limit = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "lim"); 5838 _this.isMiterJoin = true; 5839 break; 5840 case "a:headEnd": 5841 _this.headEndType = _this.getLineEndType(subElem); 5842 _this.headEndWidth = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "w"); 5843 _this.headEndLen = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "len"); 5844 break; 5845 case "a:tailEnd": 5846 _this.tailEndType = _this.getLineEndType(subElem); 5847 _this.tailEndWidth = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "w"); 5848 _this.tailEndLen = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(subElem, "len"); 5849 break; 5850 case "a:extLst": 5851 break; 5852 } 5853 } 5854 } 5855 })(); 5856 } 5857 else if (elem === undefined) { 5858 var __args = Array.prototype.slice.call(arguments); 5859 this.lineWidth = 0; 5860 this.lineCap = null; 5861 this.lineComp = null; 5862 this.fillStyle = null; 5863 this.headEndType = null; 5864 this.headEndWidth = 0; 5865 this.headEndLen = 0; 5866 this.tailEndType = null; 5867 this.tailEndWidth = 0; 5868 this.tailEndLen = 0; 5869 this.isLineDashed = false; 5870 this.lineDashPattern = ([]); 5871 this.isRoundJoin = false; 5872 this.isBevelJoin = false; 5873 this.isMiterJoin = false; 5874 this.lineWidth = 0; 5875 this.lineCap = null; 5876 this.lineComp = null; 5877 this.fillStyle = null; 5878 this.headEndType = null; 5879 this.headEndWidth = 0; 5880 this.headEndLen = 0; 5881 this.tailEndType = null; 5882 this.tailEndWidth = 0; 5883 this.tailEndLen = 0; 5884 } 5885 else 5886 throw new Error('invalid overload'); 5887 } 5888 LineStyle.prototype.getLineEndType = function (subElem) { 5889 var type = subElem.getAttribute("type"); 5890 var endType = null; 5891 switch ((type)) { 5892 case "none": 5893 endType = LineStyle.LineEndType.NONE; 5894 break; 5895 case "triangle": 5896 endType = LineStyle.LineEndType.TRIANGLE; 5897 break; 5898 case "stealth": 5899 endType = LineStyle.LineEndType.STEALTH; 5900 break; 5901 case "diamond": 5902 endType = LineStyle.LineEndType.DIAMOND; 5903 break; 5904 case "oval": 5905 endType = LineStyle.LineEndType.OVAL; 5906 break; 5907 case "arrow": 5908 endType = LineStyle.LineEndType.ARROW; 5909 break; 5910 } 5911 return endType; 5912 }; 5913 LineStyle.prototype.getLineColor = function (lineColorStyle, theme) { 5914 if (this.fillStyle != null) 5915 return this.fillStyle.applyStyle(lineColorStyle, theme); 5916 else 5917 return theme.getDefaultLineClr(); 5918 }; 5919 LineStyle.prototype.isDashed = function () { 5920 return this.isLineDashed; 5921 }; 5922 LineStyle.prototype.getLineDashPattern = function () { 5923 return this.lineDashPattern; 5924 }; 5925 LineStyle.prototype.getStartSize = function () { 5926 return 4; 5927 }; 5928 LineStyle.prototype.getEndSize = function () { 5929 return 4; 5930 }; 5931 LineStyle.prototype.getStart = function () { 5932 return 0; 5933 }; 5934 LineStyle.prototype.getEnd = function () { 5935 return 0; 5936 }; 5937 LineStyle.prototype.getLineWidth = function () { 5938 return this.lineWidth; 5939 }; 5940 return LineStyle; 5941 }()); 5942 theme_3.LineStyle = LineStyle; 5943 LineStyle["__class"] = "com.mxgraph.io.vsdx.theme.LineStyle"; 5944 (function (LineStyle) { 5945 var LineCapType; 5946 (function (LineCapType) { 5947 LineCapType[LineCapType["ROUND"] = 0] = "ROUND"; 5948 LineCapType[LineCapType["SQUARE"] = 1] = "SQUARE"; 5949 LineCapType[LineCapType["FLAT"] = 2] = "FLAT"; 5950 })(LineCapType = LineStyle.LineCapType || (LineStyle.LineCapType = {})); 5951 var CompoundLineType; 5952 (function (CompoundLineType) { 5953 CompoundLineType[CompoundLineType["SINGLE"] = 0] = "SINGLE"; 5954 CompoundLineType[CompoundLineType["DOUBLE"] = 1] = "DOUBLE"; 5955 CompoundLineType[CompoundLineType["THICK_THIN_DOUBLE"] = 2] = "THICK_THIN_DOUBLE"; 5956 CompoundLineType[CompoundLineType["THIN_THICK_DOUBLE"] = 3] = "THIN_THICK_DOUBLE"; 5957 CompoundLineType[CompoundLineType["THIN_THICK_THIN_TRIPLE"] = 4] = "THIN_THICK_THIN_TRIPLE"; 5958 })(CompoundLineType = LineStyle.CompoundLineType || (LineStyle.CompoundLineType = {})); 5959 var LineEndType; 5960 (function (LineEndType) { 5961 LineEndType[LineEndType["NONE"] = 0] = "NONE"; 5962 LineEndType[LineEndType["TRIANGLE"] = 1] = "TRIANGLE"; 5963 LineEndType[LineEndType["STEALTH"] = 2] = "STEALTH"; 5964 LineEndType[LineEndType["DIAMOND"] = 3] = "DIAMOND"; 5965 LineEndType[LineEndType["OVAL"] = 4] = "OVAL"; 5966 LineEndType[LineEndType["ARROW"] = 5] = "ARROW"; 5967 })(LineEndType = LineStyle.LineEndType || (LineStyle.LineEndType = {})); 5968 })(LineStyle = theme_3.LineStyle || (theme_3.LineStyle = {})); 5969 })(theme = vsdx.theme || (vsdx.theme = {})); 5970 })(vsdx = io.vsdx || (io.vsdx = {})); 5971 })(io = mxgraph.io || (mxgraph.io = {})); 5972 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 5973})(com || (com = {})); 5974(function (com) { 5975 var mxgraph; 5976 (function (mxgraph) { 5977 var io; 5978 (function (io) { 5979 var vsdx; 5980 (function (vsdx) { 5981 var theme; 5982 (function (theme) { 5983 var LineStyleExt = (function () { 5984 function LineStyleExt(elem) { 5985 /*private*/ this.rndg = 0; 5986 /*private*/ this.start = 0; 5987 /*private*/ this.startSize = 0; 5988 /*private*/ this.end = 0; 5989 /*private*/ this.endSize = 0; 5990 /*private*/ this.pattern = 0; 5991 this.lineDashPattern = null; 5992 var lineEx = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectFirstChildElement(elem); 5993 this.rndg = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "rndg"); 5994 this.start = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "start"); 5995 this.startSize = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "startSize"); 5996 this.end = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "end"); 5997 this.endSize = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "endSize"); 5998 this.pattern = com.mxgraph.io.vsdx.mxVsdxUtils.getIntAttr$org_w3c_dom_Element$java_lang_String(lineEx, "pattern"); 5999 this.lineDashPattern = com.mxgraph.io.vsdx.Style.getLineDashPattern(this.pattern); 6000 } 6001 LineStyleExt.prototype.getRndg = function () { 6002 return this.rndg; 6003 }; 6004 LineStyleExt.prototype.getStart = function () { 6005 return this.start; 6006 }; 6007 LineStyleExt.prototype.getStartSize = function () { 6008 return this.startSize; 6009 }; 6010 LineStyleExt.prototype.getEnd = function () { 6011 return this.end; 6012 }; 6013 LineStyleExt.prototype.getEndSize = function () { 6014 return this.endSize; 6015 }; 6016 LineStyleExt.prototype.isDashed = function () { 6017 return this.pattern > 1; 6018 }; 6019 LineStyleExt.prototype.getLineDashPattern = function () { 6020 return this.lineDashPattern; 6021 }; 6022 return LineStyleExt; 6023 }()); 6024 theme.LineStyleExt = LineStyleExt; 6025 LineStyleExt["__class"] = "com.mxgraph.io.vsdx.theme.LineStyleExt"; 6026 })(theme = vsdx.theme || (vsdx.theme = {})); 6027 })(vsdx = io.vsdx || (io.vsdx = {})); 6028 })(io = mxgraph.io || (mxgraph.io = {})); 6029 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6030})(com || (com = {})); 6031(function (com) { 6032 var mxgraph; 6033 (function (mxgraph) { 6034 var io; 6035 (function (io) { 6036 var vsdx; 6037 (function (vsdx) { 6038 var theme; 6039 (function (theme_4) { 6040 var NoFillStyle = (function () { 6041 function NoFillStyle() { 6042 } 6043 /** 6044 * 6045 * @param {number} styleValue 6046 * @param {com.mxgraph.io.vsdx.mxVsdxTheme} theme 6047 * @return {com.mxgraph.io.vsdx.theme.Color} 6048 */ 6049 NoFillStyle.prototype.applyStyle = function (styleValue, theme) { 6050 return com.mxgraph.io.vsdx.theme.Color.NONE_$LI$(); 6051 }; 6052 return NoFillStyle; 6053 }()); 6054 theme_4.NoFillStyle = NoFillStyle; 6055 NoFillStyle["__class"] = "com.mxgraph.io.vsdx.theme.NoFillStyle"; 6056 NoFillStyle["__interfaces"] = ["com.mxgraph.io.vsdx.theme.FillStyle"]; 6057 })(theme = vsdx.theme || (vsdx.theme = {})); 6058 })(vsdx = io.vsdx || (io.vsdx = {})); 6059 })(io = mxgraph.io || (mxgraph.io = {})); 6060 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6061})(com || (com = {})); 6062(function (com) { 6063 var mxgraph; 6064 (function (mxgraph) { 6065 var io; 6066 (function (io) { 6067 var vsdx; 6068 (function (vsdx) { 6069 var theme; 6070 (function (theme_5) { 6071 var OoxmlColor = (function () { 6072 function OoxmlColor() { 6073 /*private*/ this.tint = 0; 6074 /*private*/ this.shade = 0; 6075 /*private*/ this.comp = 0; 6076 /*private*/ this.inv = 0; 6077 /*private*/ this.gray = 0; 6078 /*private*/ this.alpha = 0; 6079 /*private*/ this.alphaOff = 0; 6080 /*private*/ this.alphaMod = 0; 6081 /*private*/ this.hue = 0; 6082 /*private*/ this.hueOff = 0; 6083 /*private*/ this.hueMod = 0; 6084 /*private*/ this.sat = 0; 6085 /*private*/ this.satOff = 0; 6086 /*private*/ this.satMod = 0; 6087 /*private*/ this.lum = 0; 6088 /*private*/ this.lumOff = 0; 6089 /*private*/ this.lumMod = 0; 6090 /*private*/ this.red = 0; 6091 /*private*/ this.redOff = 0; 6092 /*private*/ this.redMod = 0; 6093 /*private*/ this.green = 0; 6094 /*private*/ this.greenOff = 0; 6095 /*private*/ this.greenMod = 0; 6096 /*private*/ this.blue = 0; 6097 /*private*/ this.blueOff = 0; 6098 /*private*/ this.blueMod = 0; 6099 /*private*/ this.gamma = 0; 6100 /*private*/ this.invGamma = 0; 6101 this.isDynamic = false; 6102 this.isInitialized = false; 6103 this.hasEffects = false; 6104 this.color = null; 6105 } 6106 OoxmlColor.prototype.calcColor = function (styleColor, theme) { 6107 if (this.hasEffects) { 6108 var hsvColor = this.color.toHsv(); 6109 if (this.tint !== 0) { 6110 hsvColor.tint(this.tint); 6111 } 6112 if (this.shade !== 0) { 6113 hsvColor.shade(this.shade); 6114 } 6115 if (this.satMod !== 0) { 6116 hsvColor.satMod(this.satMod); 6117 } 6118 if (this.lumMod !== 0) { 6119 hsvColor.lumMod(this.lumMod); 6120 } 6121 if (this.hueMod !== 0) { 6122 hsvColor.hueMod(this.hueMod); 6123 } 6124 this.color = hsvColor.toRgb(); 6125 } 6126 }; 6127 OoxmlColor.prototype.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme = function (styleColor, theme) { 6128 if (this.isDynamic || !this.isInitialized) { 6129 this.calcColor(styleColor, theme); 6130 this.isInitialized = true; 6131 } 6132 return this.color; 6133 }; 6134 OoxmlColor.prototype.getColor = function (styleColor, theme) { 6135 if (((typeof styleColor === 'number') || styleColor === null) && ((theme != null && theme instanceof com.mxgraph.io.vsdx.mxVsdxTheme) || theme === null)) { 6136 return this.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(styleColor, theme); 6137 } 6138 else if (((styleColor != null && styleColor instanceof com.mxgraph.io.vsdx.mxVsdxTheme) || styleColor === null) && theme === undefined) { 6139 return this.getColor$com_mxgraph_io_vsdx_mxVsdxTheme(styleColor); 6140 } 6141 else 6142 throw new Error('invalid overload'); 6143 }; 6144 OoxmlColor.prototype.getColor$com_mxgraph_io_vsdx_mxVsdxTheme = function (theme) { 6145 return this.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(-1, theme); 6146 }; 6147 OoxmlColor.prototype.setTint = function (tint) { 6148 this.tint = tint; 6149 this.hasEffects = true; 6150 }; 6151 OoxmlColor.prototype.setShade = function (shade) { 6152 this.shade = shade; 6153 this.hasEffects = true; 6154 }; 6155 OoxmlColor.prototype.setComp = function (comp) { 6156 this.comp = comp; 6157 this.hasEffects = true; 6158 }; 6159 OoxmlColor.prototype.setInv = function (inv) { 6160 this.inv = inv; 6161 this.hasEffects = true; 6162 }; 6163 OoxmlColor.prototype.setGray = function (gray) { 6164 this.gray = gray; 6165 this.hasEffects = true; 6166 }; 6167 OoxmlColor.prototype.setAlpha = function (alpha) { 6168 this.alpha = alpha; 6169 this.hasEffects = true; 6170 }; 6171 OoxmlColor.prototype.setAlphaOff = function (alphaOff) { 6172 this.alphaOff = alphaOff; 6173 this.hasEffects = true; 6174 }; 6175 OoxmlColor.prototype.setAlphaMod = function (alphaMod) { 6176 this.alphaMod = alphaMod; 6177 this.hasEffects = true; 6178 }; 6179 OoxmlColor.prototype.setHue = function (hue) { 6180 this.hue = hue; 6181 this.hasEffects = true; 6182 }; 6183 OoxmlColor.prototype.setHueOff = function (hueOff) { 6184 this.hueOff = hueOff; 6185 this.hasEffects = true; 6186 }; 6187 OoxmlColor.prototype.setHueMod = function (hueMod) { 6188 this.hueMod = hueMod; 6189 this.hasEffects = true; 6190 }; 6191 OoxmlColor.prototype.setSat = function (sat) { 6192 this.sat = sat; 6193 this.hasEffects = true; 6194 }; 6195 OoxmlColor.prototype.setSatOff = function (satOff) { 6196 this.satOff = satOff; 6197 this.hasEffects = true; 6198 }; 6199 OoxmlColor.prototype.setSatMod = function (satMod) { 6200 this.satMod = satMod; 6201 this.hasEffects = true; 6202 }; 6203 OoxmlColor.prototype.setLum = function (lum) { 6204 this.lum = lum; 6205 this.hasEffects = true; 6206 }; 6207 OoxmlColor.prototype.setLumOff = function (lumOff) { 6208 this.lumOff = lumOff; 6209 this.hasEffects = true; 6210 }; 6211 OoxmlColor.prototype.setLumMod = function (lumMod) { 6212 this.lumMod = lumMod; 6213 this.hasEffects = true; 6214 }; 6215 OoxmlColor.prototype.setRed = function (red) { 6216 this.red = red; 6217 this.hasEffects = true; 6218 }; 6219 OoxmlColor.prototype.setRedOff = function (redOff) { 6220 this.redOff = redOff; 6221 this.hasEffects = true; 6222 }; 6223 OoxmlColor.prototype.setRedMod = function (redMod) { 6224 this.redMod = redMod; 6225 this.hasEffects = true; 6226 }; 6227 OoxmlColor.prototype.setGreen = function (green) { 6228 this.green = green; 6229 this.hasEffects = true; 6230 }; 6231 OoxmlColor.prototype.setGreenOff = function (greenOff) { 6232 this.greenOff = greenOff; 6233 this.hasEffects = true; 6234 }; 6235 OoxmlColor.prototype.setGreenMod = function (greenMod) { 6236 this.greenMod = greenMod; 6237 this.hasEffects = true; 6238 }; 6239 OoxmlColor.prototype.setBlue = function (blue) { 6240 this.blue = blue; 6241 this.hasEffects = true; 6242 }; 6243 OoxmlColor.prototype.setBlueOff = function (blueOff) { 6244 this.blueOff = blueOff; 6245 this.hasEffects = true; 6246 }; 6247 OoxmlColor.prototype.setBlueMod = function (blueMod) { 6248 this.blueMod = blueMod; 6249 this.hasEffects = true; 6250 }; 6251 OoxmlColor.prototype.setGamma = function (gamma) { 6252 this.gamma = gamma; 6253 this.hasEffects = true; 6254 }; 6255 OoxmlColor.prototype.setInvGamma = function (invGamma) { 6256 this.invGamma = invGamma; 6257 this.hasEffects = true; 6258 }; 6259 return OoxmlColor; 6260 }()); 6261 theme_5.OoxmlColor = OoxmlColor; 6262 OoxmlColor["__class"] = "com.mxgraph.io.vsdx.theme.OoxmlColor"; 6263 })(theme = vsdx.theme || (vsdx.theme = {})); 6264 })(vsdx = io.vsdx || (io.vsdx = {})); 6265 })(io = mxgraph.io || (mxgraph.io = {})); 6266 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6267})(com || (com = {})); 6268(function (com) { 6269 var mxgraph; 6270 (function (mxgraph) { 6271 var io; 6272 (function (io) { 6273 var vsdx; 6274 (function (vsdx) { 6275 var theme; 6276 (function (theme) { 6277 var OoxmlColorFactory = (function () { 6278 function OoxmlColorFactory() { 6279 } 6280 OoxmlColorFactory.getOoxmlColor = function (element) { 6281 var color = null; 6282 var nodeName = element.nodeName; 6283 switch ((nodeName)) { 6284 case "a:scrgbClr": 6285 color = new com.mxgraph.io.vsdx.theme.ScrgbClr(/* parseInt */ parseInt(element.getAttribute("r")), /* parseInt */ parseInt(element.getAttribute("g")), /* parseInt */ parseInt(element.getAttribute("b"))); 6286 break; 6287 case "a:srgbClr": 6288 color = new com.mxgraph.io.vsdx.theme.SrgbClr(element.getAttribute("val")); 6289 break; 6290 case "a:hslClr": 6291 color = new com.mxgraph.io.vsdx.theme.HslClr(/* parseInt */ parseInt(element.getAttribute("hue")), /* parseInt */ parseInt(element.getAttribute("sat")), /* parseInt */ parseInt(element.getAttribute("lum"))); 6292 break; 6293 case "a:sysClr": 6294 color = new com.mxgraph.io.vsdx.theme.SysClr(element.getAttribute("val"), element.getAttribute("lastClr")); 6295 break; 6296 case "a:schemeClr": 6297 color = new com.mxgraph.io.vsdx.theme.SchemeClr(element.getAttribute("val")); 6298 break; 6299 case "a:prstClr": 6300 color = new com.mxgraph.io.vsdx.theme.SrgbClr(element.getAttribute("val")); 6301 break; 6302 } 6303 var effects = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(element); 6304 for (var index155 = 0; index155 < effects.length; index155++) { 6305 var effect = effects[index155]; 6306 { 6307 var effVal = (parseInt(effect.getAttribute("val")) / 1000 | 0); 6308 var effName = effect.nodeName; 6309 switch ((effName)) { 6310 case "a:tint": 6311 color.setTint(effVal); 6312 break; 6313 case "a:shade": 6314 color.setShade(effVal); 6315 break; 6316 case "a:satMod": 6317 color.setSatMod(effVal); 6318 break; 6319 case "a:lumMod": 6320 color.setLumMod(effVal); 6321 break; 6322 case "a:hueMod": 6323 color.setHueMod(effVal); 6324 break; 6325 } 6326 } 6327 } 6328 return color; 6329 }; 6330 return OoxmlColorFactory; 6331 }()); 6332 theme.OoxmlColorFactory = OoxmlColorFactory; 6333 OoxmlColorFactory["__class"] = "com.mxgraph.io.vsdx.theme.OoxmlColorFactory"; 6334 })(theme = vsdx.theme || (vsdx.theme = {})); 6335 })(vsdx = io.vsdx || (io.vsdx = {})); 6336 })(io = mxgraph.io || (mxgraph.io = {})); 6337 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6338})(com || (com = {})); 6339(function (com) { 6340 var mxgraph; 6341 (function (mxgraph) { 6342 var io; 6343 (function (io) { 6344 var vsdx; 6345 (function (vsdx) { 6346 var theme; 6347 (function (theme) { 6348 var QuickStyleVals = (function () { 6349 function QuickStyleVals(quickStyleEffectsMatrix, quickStyleFillColor, quickStyleFillMatrix, quickStyleFontColor, quickStyleFontMatrix, quickStyleLineColor, quickStyleLineMatrix, quickStyleShadowColor, quickStyleType, quickStyleVariation) { 6350 this.quickStyleEffectsMatrix = 0; 6351 this.quickStyleFillColor = 0; 6352 this.quickStyleFillMatrix = 0; 6353 this.quickStyleFontColor = 0; 6354 this.quickStyleFontMatrix = 0; 6355 this.quickStyleLineColor = 0; 6356 this.quickStyleLineMatrix = 0; 6357 this.quickStyleShadowColor = 0; 6358 this.quickStyleType = 0; 6359 this.quickStyleVariation = 0; 6360 this.quickStyleEffectsMatrix = quickStyleEffectsMatrix; 6361 this.quickStyleFillColor = quickStyleFillColor; 6362 this.quickStyleFillMatrix = quickStyleFillMatrix; 6363 this.quickStyleFontColor = quickStyleFontColor; 6364 this.quickStyleFontMatrix = quickStyleFontMatrix; 6365 this.quickStyleLineColor = quickStyleLineColor; 6366 this.quickStyleLineMatrix = quickStyleLineMatrix; 6367 this.quickStyleShadowColor = quickStyleShadowColor; 6368 this.quickStyleType = quickStyleType; 6369 this.quickStyleVariation = quickStyleVariation; 6370 } 6371 QuickStyleVals.prototype.getQuickStyleEffectsMatrix = function () { 6372 return this.quickStyleEffectsMatrix; 6373 }; 6374 QuickStyleVals.prototype.getQuickStyleFillColor = function () { 6375 return this.quickStyleFillColor; 6376 }; 6377 QuickStyleVals.prototype.getQuickStyleFillMatrix = function () { 6378 return this.quickStyleFillMatrix; 6379 }; 6380 QuickStyleVals.prototype.getQuickStyleFontColor = function () { 6381 return this.quickStyleFontColor; 6382 }; 6383 QuickStyleVals.prototype.getQuickStyleFontMatrix = function () { 6384 return this.quickStyleFontMatrix; 6385 }; 6386 QuickStyleVals.prototype.getQuickStyleLineColor = function () { 6387 return this.quickStyleLineColor; 6388 }; 6389 QuickStyleVals.prototype.getQuickStyleLineMatrix = function () { 6390 return this.quickStyleLineMatrix; 6391 }; 6392 QuickStyleVals.prototype.getQuickStyleShadowColor = function () { 6393 return this.quickStyleShadowColor; 6394 }; 6395 QuickStyleVals.prototype.getQuickStyleType = function () { 6396 return this.quickStyleType; 6397 }; 6398 QuickStyleVals.prototype.getQuickStyleVariation = function () { 6399 return this.quickStyleVariation; 6400 }; 6401 QuickStyleVals.prototype.setQuickStyleEffectsMatrix = function (quickStyleEffectsMatrix) { 6402 this.quickStyleEffectsMatrix = quickStyleEffectsMatrix; 6403 }; 6404 QuickStyleVals.prototype.setQuickStyleFillColor = function (quickStyleFillColor) { 6405 this.quickStyleFillColor = quickStyleFillColor; 6406 }; 6407 QuickStyleVals.prototype.setQuickStyleFillMatrix = function (quickStyleFillMatrix) { 6408 this.quickStyleFillMatrix = quickStyleFillMatrix; 6409 }; 6410 QuickStyleVals.prototype.setQuickStyleFontColor = function (quickStyleFontColor) { 6411 this.quickStyleFontColor = quickStyleFontColor; 6412 }; 6413 QuickStyleVals.prototype.setQuickStyleFontMatrix = function (quickStyleFontMatrix) { 6414 this.quickStyleFontMatrix = quickStyleFontMatrix; 6415 }; 6416 QuickStyleVals.prototype.setQuickStyleLineColor = function (quickStyleLineColor) { 6417 this.quickStyleLineColor = quickStyleLineColor; 6418 }; 6419 QuickStyleVals.prototype.setQuickStyleLineMatrix = function (quickStyleLineMatrix) { 6420 this.quickStyleLineMatrix = quickStyleLineMatrix; 6421 }; 6422 QuickStyleVals.prototype.setQuickStyleShadowColor = function (quickStyleShadowColor) { 6423 this.quickStyleShadowColor = quickStyleShadowColor; 6424 }; 6425 QuickStyleVals.prototype.setQuickStyleType = function (quickStyleType) { 6426 this.quickStyleType = quickStyleType; 6427 }; 6428 QuickStyleVals.prototype.setQuickStyleVariation = function (quickStyleVariation) { 6429 this.quickStyleVariation = quickStyleVariation; 6430 }; 6431 return QuickStyleVals; 6432 }()); 6433 theme.QuickStyleVals = QuickStyleVals; 6434 QuickStyleVals["__class"] = "com.mxgraph.io.vsdx.theme.QuickStyleVals"; 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 io; 6444 (function (io) { 6445 var vsdx; 6446 (function (vsdx) { 6447 var theme; 6448 (function (theme_6) { 6449 var SolidFillStyle = (function () { 6450 function SolidFillStyle(color) { 6451 this.color = null; 6452 this.color = color; 6453 } 6454 /** 6455 * 6456 * @param {number} styleValue 6457 * @param {com.mxgraph.io.vsdx.mxVsdxTheme} theme 6458 * @return {com.mxgraph.io.vsdx.theme.Color} 6459 */ 6460 SolidFillStyle.prototype.applyStyle = function (styleValue, theme) { 6461 return this.color.getColor$int$com_mxgraph_io_vsdx_mxVsdxTheme(styleValue, theme); 6462 }; 6463 return SolidFillStyle; 6464 }()); 6465 theme_6.SolidFillStyle = SolidFillStyle; 6466 SolidFillStyle["__class"] = "com.mxgraph.io.vsdx.theme.SolidFillStyle"; 6467 SolidFillStyle["__interfaces"] = ["com.mxgraph.io.vsdx.theme.FillStyle"]; 6468 })(theme = vsdx.theme || (vsdx.theme = {})); 6469 })(vsdx = io.vsdx || (io.vsdx = {})); 6470 })(io = mxgraph.io || (mxgraph.io = {})); 6471 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6472})(com || (com = {})); 6473(function (com) { 6474 var mxgraph; 6475 (function (mxgraph) { 6476 var online; 6477 (function (online) { 6478 var Constants = (function () { 6479 function Constants() { 6480 } 6481 Constants.MAX_AREA_$LI$ = function () { if (Constants.MAX_AREA == null) 6482 Constants.MAX_AREA = 10000 * 10000; return Constants.MAX_AREA; }; 6483 ; 6484 return Constants; 6485 }()); 6486 /** 6487 * Maximum size (in bytes) for request payloads. Default is 52428800 (50MB). 6488 */ 6489 Constants.MAX_REQUEST_SIZE = 52428800; 6490 /** 6491 * The domain where legacy images are stored. 6492 */ 6493 Constants.IMAGE_DOMAIN = "http://img.diagramly.com/"; 6494 online.Constants = Constants; 6495 Constants["__class"] = "com.mxgraph.online.Constants"; 6496 })(online = mxgraph.online || (mxgraph.online = {})); 6497 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6498})(com || (com = {})); 6499(function (com) { 6500 var mxgraph; 6501 (function (mxgraph) { 6502 var online; 6503 (function (online) { 6504 /** 6505 * 6506 * String/byte array encoding/manipulation utilities 6507 * @class 6508 */ 6509 var Utils = (function () { 6510 function Utils() { 6511 } 6512 /** 6513 * Rotates the given point by the given cos and sin. 6514 * @param {mxPoint} pt 6515 * @param {number} cos 6516 * @param {number} sin 6517 * @param {mxPoint} c 6518 * @return {mxPoint} 6519 */ 6520 Utils.getRotatedPoint = function (pt, cos, sin, c) { 6521 var x = pt.x - c.x; 6522 var y = pt.y - c.y; 6523 var x1 = x * cos - y * sin; 6524 var y1 = y * cos + x * sin; 6525 return new mxPoint(x1 + c.x, y1 + c.y); 6526 }; 6527 /** 6528 * Rotates the given geometry (in place) by the given rotation (in degrees). 6529 * @param {mxGeometry} geo 6530 * @param {number} rotation 6531 * @param {number} cx 6532 * @param {number} cy 6533 */ 6534 Utils.rotatedGeometry = function (geo, rotation, cx, cy) { 6535 rotation = (function (x) { return x * Math.PI / 180; })(rotation); 6536 var cos = Math.cos(rotation); 6537 var sin = Math.sin(rotation); 6538 var x = geo.getCenterX() - cx; 6539 var y = geo.getCenterY() - cy; 6540 var x1 = x * cos - y * sin; 6541 var y1 = y * cos + x * sin; 6542 geo.x = (Math.round(x1 + cx - geo.width / 2)); 6543 geo.y = (Math.round(y1 + cy - geo.height / 2)); 6544 }; 6545 return Utils; 6546 }()); 6547 /** 6548 * 6549 */ 6550 Utils.CHARSET_FOR_URL_ENCODING = "ISO-8859-1"; 6551 online.Utils = Utils; 6552 Utils["__class"] = "com.mxgraph.online.Utils"; 6553 })(online = mxgraph.online || (mxgraph.online = {})); 6554 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6555})(com || (com = {})); 6556(function (com) { 6557 var mxgraph; 6558 (function (mxgraph) { 6559 var io; 6560 (function (io) { 6561 var vsdx; 6562 (function (vsdx) { 6563 var geometry; 6564 (function (geometry) { 6565 var ArcTo = (function (_super) { 6566 __extends(ArcTo, _super); 6567 function ArcTo(index, x, y, a) { 6568 var _this = _super.call(this, index, x, y) || this; 6569 _this.a = a; 6570 return _this; 6571 } 6572 /** 6573 * 6574 * @param {mxPoint} p 6575 * @param {com.mxgraph.io.vsdx.Shape} shape 6576 * @return {string} 6577 */ 6578 ArcTo.prototype.handle = function (p, shape) { 6579 if (this.x != null && this.y != null && this.a != null) { 6580 var h = shape.getHeight(); 6581 var w = shape.getWidth(); 6582 var x0 = Math.floor(Math.round(shape.getLastX() * w) / 100); 6583 var y0 = Math.floor(Math.round(shape.getLastY() * h) / 100); 6584 var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6585 var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6586 y = h - y; 6587 var a = this.a * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6588 var dx = Math.abs(x - x0); 6589 var dy = Math.abs(y - y0); 6590 var rx = (a * 0.5) + (dx * dx + dy * dy) / (8.0 * a); 6591 var ry = rx; 6592 var r0 = Math.abs(rx); 6593 rx = rx * 100 / w; 6594 ry = ry * 100 / h; 6595 x = x * 100 / w; 6596 y = y * 100 / h; 6597 rx = Math.round(rx * 100.0) / 100.0; 6598 ry = Math.round(ry * 100.0) / 100.0; 6599 x = Math.round(x * 100.0) / 100.0; 6600 y = Math.round(y * 100.0) / 100.0; 6601 a = Math.round(a * 100.0) / 100.0; 6602 rx = Math.abs(rx); 6603 ry = Math.abs(ry); 6604 var sf = (a < 0) ? "1" : "0"; 6605 var laf = (r0 < Math.abs(a)) ? "1" : "0"; 6606 shape.setLastX(x); 6607 shape.setLastY(y); 6608 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 + "\"/>"; 6609 } 6610 return ""; 6611 }; 6612 return ArcTo; 6613 }(com.mxgraph.io.vsdx.geometry.Row)); 6614 geometry.ArcTo = ArcTo; 6615 ArcTo["__class"] = "com.mxgraph.io.vsdx.geometry.ArcTo"; 6616 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 6617 })(vsdx = io.vsdx || (io.vsdx = {})); 6618 })(io = mxgraph.io || (mxgraph.io = {})); 6619 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6620})(com || (com = {})); 6621(function (com) { 6622 var mxgraph; 6623 (function (mxgraph) { 6624 var io; 6625 (function (io) { 6626 var vsdx; 6627 (function (vsdx) { 6628 var geometry; 6629 (function (geometry) { 6630 var DelRow = (function (_super) { 6631 __extends(DelRow, _super); 6632 function DelRow(index) { 6633 return _super.call(this, index, null, null) || this; 6634 } 6635 /** 6636 * 6637 * @param {mxPoint} p 6638 * @param {com.mxgraph.io.vsdx.Shape} shape 6639 * @return {string} 6640 */ 6641 DelRow.prototype.handle = function (p, shape) { 6642 return ""; 6643 }; 6644 return DelRow; 6645 }(com.mxgraph.io.vsdx.geometry.Row)); 6646 geometry.DelRow = DelRow; 6647 DelRow["__class"] = "com.mxgraph.io.vsdx.geometry.DelRow"; 6648 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 6649 })(vsdx = io.vsdx || (io.vsdx = {})); 6650 })(io = mxgraph.io || (mxgraph.io = {})); 6651 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6652})(com || (com = {})); 6653(function (com) { 6654 var mxgraph; 6655 (function (mxgraph) { 6656 var io; 6657 (function (io) { 6658 var vsdx; 6659 (function (vsdx) { 6660 var geometry; 6661 (function (geometry) { 6662 var Ellipse = (function (_super) { 6663 __extends(Ellipse, _super); 6664 function Ellipse(index, x, y, a, b, c, d) { 6665 var _this = _super.call(this, index, x, y) || this; 6666 _this.a = a; 6667 _this.b = b; 6668 _this.c = c; 6669 _this.d = d; 6670 return _this; 6671 } 6672 /** 6673 * 6674 * @param {mxPoint} p 6675 * @param {com.mxgraph.io.vsdx.Shape} shape 6676 * @return {string} 6677 */ 6678 Ellipse.prototype.handle = function (p, shape) { 6679 if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) { 6680 var h = shape.getHeight(); 6681 var w = shape.getWidth(); 6682 var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6683 var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6684 y = h - y; 6685 var a = this.a * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6686 var b = this.b * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6687 b = h - b; 6688 var c = this.c * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6689 var d = this.d * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6690 d = h - d; 6691 var dx1 = Math.abs(a - x); 6692 var dy1 = Math.abs(b - y); 6693 var r1 = Math.sqrt(dx1 * dx1 + dy1 * dy1); 6694 var dx2 = Math.abs(c - x); 6695 var dy2 = Math.abs(d - y); 6696 var r2 = Math.sqrt(dx2 * dx2 + dy2 * dy2); 6697 var newX = x * 100 / w; 6698 var newY = y * 100 / h; 6699 var newW = (r1 * 100 / w) / 2; 6700 var newH = (r2 * 100 / h) / 2; 6701 newH = Math.round(newH * 100.0) / 100.0; 6702 newW = Math.round(newW * 100.0) / 100.0; 6703 var newX1 = Math.round((newX - 2 * newW) * 100.0) / 100.0; 6704 var newX2 = Math.round((newX + 2 * newW) * 100.0) / 100.0; 6705 newY = Math.round(newY * 100.0) / 100.0; 6706 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\"/>"; 6707 } 6708 return ""; 6709 }; 6710 return Ellipse; 6711 }(com.mxgraph.io.vsdx.geometry.Row)); 6712 geometry.Ellipse = Ellipse; 6713 Ellipse["__class"] = "com.mxgraph.io.vsdx.geometry.Ellipse"; 6714 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 6715 })(vsdx = io.vsdx || (io.vsdx = {})); 6716 })(io = mxgraph.io || (mxgraph.io = {})); 6717 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6718})(com || (com = {})); 6719(function (com) { 6720 var mxgraph; 6721 (function (mxgraph) { 6722 var io; 6723 (function (io) { 6724 var vsdx; 6725 (function (vsdx) { 6726 var geometry; 6727 (function (geometry) { 6728 var EllipticalArcTo = (function (_super) { 6729 __extends(EllipticalArcTo, _super); 6730 function EllipticalArcTo(index, x, y, a, b, c, d) { 6731 var _this = _super.call(this, index, x, y) || this; 6732 _this.a = a; 6733 _this.b = b; 6734 _this.c = c; 6735 _this.d = d; 6736 return _this; 6737 } 6738 /** 6739 * 6740 * @param {mxPoint} p 6741 * @param {com.mxgraph.io.vsdx.Shape} shape 6742 * @return {string} 6743 */ 6744 EllipticalArcTo.prototype.handle = function (p, shape) { 6745 if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) { 6746 var h = shape.getHeight(); 6747 var w = shape.getWidth(); 6748 var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6749 var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6750 y = h - y; 6751 var a = this.a * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6752 var b = this.b * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6753 var c = this.c; 6754 var d = this.d; 6755 x = x * 100.0 / w; 6756 y = y * 100.0 / h; 6757 var x1 = shape.getLastX() * w / 100.0; 6758 var y1 = shape.getLastY() * h / 100.0; 6759 var x2 = x * w / 100.0; 6760 var y2 = y * h / 100.0; 6761 var x3 = a; 6762 var y3 = h - b; 6763 var ang = -c; 6764 var p1x = Math.sqrt(x1 * x1 + y1 * y1) * Math.cos(Math.atan2(y1, x1) - ang); 6765 var p1y = Math.sqrt(x1 * x1 + y1 * y1) * Math.sin(Math.atan2(y1, x1) - ang); 6766 var p2x = Math.sqrt(x2 * x2 + y2 * y2) * Math.cos(Math.atan2(y2, x2) - ang); 6767 var p2y = Math.sqrt(x2 * x2 + y2 * y2) * Math.sin(Math.atan2(y2, x2) - ang); 6768 var p3x = Math.sqrt(x3 * x3 + y3 * y3) * Math.cos(Math.atan2(y3, x3) - ang); 6769 var p3y = Math.sqrt(x3 * x3 + y3 * y3) * Math.sin(Math.atan2(y3, x3) - ang); 6770 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))); 6771 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))); 6772 var newX = Math.sqrt(p0x * p0x + p0y * p0y) * Math.cos(Math.atan2(p0y, p0x) + ang); 6773 var newY = Math.sqrt(p0x * p0x + p0y * p0y) * Math.sin(Math.atan2(p0y, p0x) + ang); 6774 newX = newX * w / 100.0; 6775 newY = newY * h / 100.0; 6776 var dx = p1x - p0x; 6777 var dy = p1y - p0y; 6778 var rx = Math.sqrt(dx * dx + dy * dy * d * d); 6779 var ry = rx / d; 6780 var rot = (function (x) { return x * 180 / Math.PI; })(ang); 6781 rx = rx * 100.0 / w; 6782 ry = ry * 100.0 / h; 6783 x = Math.round(x * 100.0) / 100.0; 6784 y = Math.round(y * 100.0) / 100.0; 6785 rx = Math.round(rx * 100.0) / 100.0; 6786 ry = Math.round(ry * 100.0) / 100.0; 6787 rot = Math.round(rot * 100.0) / 100.0; 6788 var sweep = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1); 6789 var sf = (sweep > 0) ? "0" : "1"; 6790 var laf = "0"; 6791 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 6792 { 6793 laf = "1"; 6794 } 6795 shape.setLastX(x); 6796 shape.setLastY(y); 6797 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 + "\"/>"; 6798 } 6799 return ""; 6800 }; 6801 /** 6802 * @param {number} x0 y0 center point of ellipse containing the arc 6803 * @param {number} x1 y1 starting point of the arc 6804 * @param {number} x2 y2 endpoint of the arc 6805 * @param {number} x3 y3 control point 6806 * @return {boolean} true if the start to end angle that contains the control point is a reflex angle 6807 * @param {number} y0 6808 * @param {number} y1 6809 * @param {number} y2 6810 * @param {number} y3 6811 */ 6812 EllipticalArcTo.prototype.isReflexAngle = function (x0, y0, x1, y1, x2, y2, x3, y3) { 6813 x1 = x1 - x0; 6814 y1 = y1 - y0; 6815 x2 = x2 - x0; 6816 y2 = y2 - y0; 6817 x2 = x3 - x0; 6818 y3 = y3 - y0; 6819 x0 = 0; 6820 y0 = 0; 6821 var aStart = (function (x) { return x * 180 / Math.PI; })(Math.atan2(y1, x1) - Math.atan2(y0, x0)); 6822 var aEnd = (function (x) { return x * 180 / Math.PI; })(Math.atan2(y2, x2) - Math.atan2(y0, x0)); 6823 var aCP = (function (x) { return x * 180 / Math.PI; })(Math.atan2(y3, x3) - Math.atan2(y0, x0)); 6824 aStart = (aStart - aCP) % 360; 6825 aEnd = (aEnd - aCP) % 360; 6826 if (aStart > 180) { 6827 aStart = aStart - 360; 6828 } 6829 else if (aStart < -180) { 6830 aStart = aStart + 360; 6831 } 6832 if (aEnd > 180) { 6833 aEnd = aEnd - 360; 6834 } 6835 else if (aEnd < -180) { 6836 aEnd = aEnd + 360; 6837 } 6838 if ((aStart > 0 && aEnd < 0) || (aStart < 0 && aEnd > 0)) { 6839 if (Math.abs(aStart - aEnd) > 180) { 6840 return true; 6841 } 6842 } 6843 return false; 6844 }; 6845 return EllipticalArcTo; 6846 }(com.mxgraph.io.vsdx.geometry.Row)); 6847 geometry.EllipticalArcTo = EllipticalArcTo; 6848 EllipticalArcTo["__class"] = "com.mxgraph.io.vsdx.geometry.EllipticalArcTo"; 6849 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 6850 })(vsdx = io.vsdx || (io.vsdx = {})); 6851 })(io = mxgraph.io || (mxgraph.io = {})); 6852 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6853})(com || (com = {})); 6854(function (com) { 6855 var mxgraph; 6856 (function (mxgraph) { 6857 var io; 6858 (function (io) { 6859 var vsdx; 6860 (function (vsdx) { 6861 var geometry; 6862 (function (geometry) { 6863 var InfiniteLine = (function (_super) { 6864 __extends(InfiniteLine, _super); 6865 function InfiniteLine(index, x, y, a, b) { 6866 var _this = _super.call(this, index, x, y) || this; 6867 _this.a = a; 6868 _this.b = b; 6869 return _this; 6870 } 6871 /** 6872 * 6873 * @param {mxPoint} p 6874 * @param {com.mxgraph.io.vsdx.Shape} shape 6875 * @return {string} 6876 */ 6877 InfiniteLine.prototype.handle = function (p, shape) { 6878 return ""; 6879 }; 6880 return InfiniteLine; 6881 }(com.mxgraph.io.vsdx.geometry.Row)); 6882 geometry.InfiniteLine = InfiniteLine; 6883 InfiniteLine["__class"] = "com.mxgraph.io.vsdx.geometry.InfiniteLine"; 6884 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 6885 })(vsdx = io.vsdx || (io.vsdx = {})); 6886 })(io = mxgraph.io || (mxgraph.io = {})); 6887 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6888})(com || (com = {})); 6889(function (com) { 6890 var mxgraph; 6891 (function (mxgraph) { 6892 var io; 6893 (function (io) { 6894 var vsdx; 6895 (function (vsdx) { 6896 var geometry; 6897 (function (geometry) { 6898 var LineTo = (function (_super) { 6899 __extends(LineTo, _super); 6900 function LineTo(index, x, y) { 6901 return _super.call(this, index, x, y) || this; 6902 } 6903 /** 6904 * 6905 * @param {mxPoint} p 6906 * @param {com.mxgraph.io.vsdx.Shape} shape 6907 * @return {string} 6908 */ 6909 LineTo.prototype.handle = function (p, shape) { 6910 var x = p.x; 6911 var y = p.y; 6912 var h = shape.getHeight(); 6913 var w = shape.getWidth(); 6914 if (this.x != null && this.y != null) { 6915 x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6916 y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6917 } 6918 x = x * 100.0 / w; 6919 y = y * 100.0 / h; 6920 y = 100 - y; 6921 x = Math.round(x * 100.0) / 100.0; 6922 y = Math.round(y * 100.0) / 100.0; 6923 p.x = (x); 6924 p.y = (y); 6925 shape.setLastX(x); 6926 shape.setLastY(y); 6927 return "<line x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>"; 6928 }; 6929 return LineTo; 6930 }(com.mxgraph.io.vsdx.geometry.Row)); 6931 geometry.LineTo = LineTo; 6932 LineTo["__class"] = "com.mxgraph.io.vsdx.geometry.LineTo"; 6933 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 6934 })(vsdx = io.vsdx || (io.vsdx = {})); 6935 })(io = mxgraph.io || (mxgraph.io = {})); 6936 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6937})(com || (com = {})); 6938(function (com) { 6939 var mxgraph; 6940 (function (mxgraph) { 6941 var io; 6942 (function (io) { 6943 var vsdx; 6944 (function (vsdx) { 6945 var geometry; 6946 (function (geometry) { 6947 var MoveTo = (function (_super) { 6948 __extends(MoveTo, _super); 6949 function MoveTo(index, x, y) { 6950 return _super.call(this, index, x, y) || this; 6951 } 6952 /** 6953 * 6954 * @param {mxPoint} p 6955 * @param {com.mxgraph.io.vsdx.Shape} shape 6956 * @return {string} 6957 */ 6958 MoveTo.prototype.handle = function (p, shape) { 6959 var x = p.x; 6960 var y = p.y; 6961 var h = shape.getHeight(); 6962 var w = shape.getWidth(); 6963 if (this.x != null && this.y != null) { 6964 x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6965 y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 6966 } 6967 x = x * 100.0 / w; 6968 y = y * 100.0 / h; 6969 y = 100 - y; 6970 x = Math.round(x * 100.0) / 100.0; 6971 y = Math.round(y * 100.0) / 100.0; 6972 p.x = (x); 6973 p.y = (y); 6974 shape.setLastX(x); 6975 shape.setLastY(y); 6976 shape.setLastMoveX(x); 6977 shape.setLastMoveY(y); 6978 return "<move x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>"; 6979 }; 6980 return MoveTo; 6981 }(com.mxgraph.io.vsdx.geometry.Row)); 6982 geometry.MoveTo = MoveTo; 6983 MoveTo["__class"] = "com.mxgraph.io.vsdx.geometry.MoveTo"; 6984 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 6985 })(vsdx = io.vsdx || (io.vsdx = {})); 6986 })(io = mxgraph.io || (mxgraph.io = {})); 6987 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 6988})(com || (com = {})); 6989(function (com) { 6990 var mxgraph; 6991 (function (mxgraph) { 6992 var io; 6993 (function (io) { 6994 var vsdx; 6995 (function (vsdx) { 6996 var geometry; 6997 (function (geometry) { 6998 var NURBSTo = (function (_super) { 6999 __extends(NURBSTo, _super); 7000 function NURBSTo(index, x, y, a, b, c, d, e) { 7001 var _this = _super.call(this, index, x, y) || this; 7002 _this.a = a; 7003 _this.b = b; 7004 _this.c = c; 7005 _this.d = d; 7006 _this.formulaE = e; 7007 return _this; 7008 } 7009 /** 7010 * Helper class for geometry 7011 * @param {mxPoint} p 7012 * @param {com.mxgraph.io.vsdx.Shape} shape 7013 * @return {string} 7014 */ 7015 NURBSTo.prototype.handle = function (p, shape) { 7016 if (this.x != null && this.y != null && this.formulaE != null) { 7017 var h = shape.getHeight(); 7018 var w = shape.getWidth(); 7019 var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7020 var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7021 var eValue = this.formulaE.split("NURBS(").join(""); 7022 eValue = eValue.split(")").join(""); 7023 var nurbs = new NURBSTo.Nurbs(this, eValue, w, h); 7024 if (nurbs.getSize() >= 2) { 7025 var x1 = nurbs.getX(0); 7026 var y1 = nurbs.getY(0); 7027 var x2 = nurbs.getX(1); 7028 var y2 = nurbs.getY(1); 7029 y = y * 100.0 / h; 7030 x = x * 100.0 / w; 7031 y = 100 - y; 7032 x = Math.round(x * 100.0) / 100.0; 7033 y = Math.round(y * 100.0) / 100.0; 7034 x1 = Math.round(x1 * 100.0) / 100.0; 7035 y1 = Math.round(y1 * 100.0) / 100.0; 7036 x2 = Math.round(x2 * 100.0) / 100.0; 7037 y2 = Math.round(y2 * 100.0) / 100.0; 7038 shape.setLastX(x); 7039 shape.setLastY(y); 7040 if (nurbs.getDegree() === 3 && nurbs.isOrderedByThree(this.getA())) { 7041 var cp1 = ([]); 7042 var cp2 = ([]); 7043 var nut = ([]); 7044 var nurbsize = nurbs.getSize(); 7045 for (var i = 0; i < nurbsize - 1; i = i + 3) { 7046 /* add */ (cp1.push(new mxPoint(nurbs.getX(i), nurbs.getY(i)))); 7047 /* add */ (cp2.push(new mxPoint(nurbs.getX(i + 1), nurbs.getY(i + 1)))); 7048 if (i < nurbsize - 2) { 7049 /* add */ (nut.push(new mxPoint(nurbs.getX(i + 2), nurbs.getY(i + 2)))); 7050 } 7051 else { 7052 /* add */ (nut.push(new mxPoint(x, y))); 7053 } 7054 } 7055 ; 7056 var result = ""; 7057 for (var i = 0; i < cp1.length; i++) { 7058 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"; 7059 } 7060 ; 7061 return result; 7062 } 7063 else { 7064 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() + "\"/>"; 7065 } 7066 } 7067 } 7068 return ""; 7069 }; 7070 return NURBSTo; 7071 }(com.mxgraph.io.vsdx.geometry.Row)); 7072 geometry.NURBSTo = NURBSTo; 7073 NURBSTo["__class"] = "com.mxgraph.io.vsdx.geometry.NURBSTo"; 7074 (function (NURBSTo) { 7075 /** 7076 * Holds the NURBS array that is part of the VSDX NURBSTo element, together with some helper functions 7077 * @param {string} s 7078 * @param {number} w 7079 * @param {number} h 7080 * @class 7081 */ 7082 var Nurbs = (function () { 7083 function Nurbs(__parent, s, w, h) { 7084 this.__parent = __parent; 7085 this.nurbsValues = ([]); 7086 var n = s.split(/\s*,\s*/).slice(0); 7087 for (var i = 0; i < n.length; i++) { 7088 if ((i > 3) && (i % 4 === 0)) { 7089 /* add */ (this.nurbsValues.push(/* parseDouble */ parseFloat(/* get */ n[i]) * 100.0)); 7090 } 7091 else if ((i > 3) && (i % 4 === 1)) { 7092 /* add */ (this.nurbsValues.push(100 - parseFloat(/* get */ n[i]) * 100.0)); 7093 } 7094 else { 7095 /* add */ (this.nurbsValues.push(/* parseDouble */ parseFloat(/* get */ n[i]))); 7096 } 7097 } 7098 ; 7099 } 7100 /** 7101 * @param {number} lastKnot the last knot outside of the nurbs string. Obtain it with this.getA() 7102 * @return {boolean} true if knots are ordered by sets of 3 7103 */ 7104 Nurbs.prototype.isOrderedByThree = function (lastKnot) { 7105 for (var i = 0; i + 2 < (this.getSize()); i = i + 3) { 7106 var k_1 = Math.round(this.getKnot((i)) * 100.0) / 100.0; 7107 var k1_1 = Math.round(this.getKnot((i + 1)) * 100.0) / 100.0; 7108 var k2 = Math.round(this.getKnot((i + 2)) * 100.0) / 100.0; 7109 if (k_1 !== k1_1 || k_1 !== k2 || k1_1 !== k2) { 7110 return false; 7111 } 7112 } 7113 ; 7114 var k = Math.round(this.getKnot((this.getSize() - 2)) * 10.0) / 10.0; 7115 var k1 = Math.round(this.getKnot((this.getSize() - 1)) * 10.0) / 10.0; 7116 var lk = Math.round(lastKnot * 10.0) / 10.0; 7117 if (k !== k1 || k !== lk || k1 !== lk) { 7118 return false; 7119 } 7120 return true; 7121 }; 7122 /** 7123 * @return {number} number of points, not including the last one (which is outside of the nurbs string) 7124 */ 7125 Nurbs.prototype.getSize = function () { 7126 return (((this.nurbsValues.length / 4 | 0)) - 1); 7127 }; 7128 /** 7129 * @return {number} last knot (element knotLast) 7130 */ 7131 Nurbs.prototype.getKnotLast = function () { 7132 return this.nurbsValues[0]; 7133 }; 7134 /** 7135 * @return {number} degree of the NURBS (element degree) 7136 */ 7137 Nurbs.prototype.getDegree = function () { 7138 return this.nurbsValues[1]; 7139 }; 7140 /** 7141 * @return {number} 0 if X is relative, otherwise X is in the coordinate system of the shape (element xType) 7142 */ 7143 Nurbs.prototype.getXType = function () { 7144 return this.nurbsValues[2]; 7145 }; 7146 /** 7147 * @return {number} 0 if Y is relative, otherwise Y is in the coordinate system of the shape (element yType) 7148 */ 7149 Nurbs.prototype.getYType = function () { 7150 return this.nurbsValues[3]; 7151 }; 7152 /** 7153 * @return {number} the i-th X coordinate 7154 * @param {number} i 7155 */ 7156 Nurbs.prototype.getX = function (i) { 7157 return this.nurbsValues[(i + 1) * 4]; 7158 }; 7159 /** 7160 * @return {number} the i-th Y coordinate 7161 * @param {number} i 7162 */ 7163 Nurbs.prototype.getY = function (i) { 7164 return this.nurbsValues[(i + 1) * 4 + 1]; 7165 }; 7166 /** 7167 * @return {number} the i-th knot 7168 * @param {number} i 7169 */ 7170 Nurbs.prototype.getKnot = function (i) { 7171 return this.nurbsValues[(i + 1) * 4 + 2]; 7172 }; 7173 /** 7174 * @return {number} the i-th weight 7175 * @param {number} i 7176 */ 7177 Nurbs.prototype.getWeight = function (i) { 7178 return this.nurbsValues[(i + 1) * 4 + 3]; 7179 }; 7180 return Nurbs; 7181 }()); 7182 NURBSTo.Nurbs = Nurbs; 7183 Nurbs["__class"] = "com.mxgraph.io.vsdx.geometry.NURBSTo.Nurbs"; 7184 })(NURBSTo = geometry.NURBSTo || (geometry.NURBSTo = {})); 7185 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 7186 })(vsdx = io.vsdx || (io.vsdx = {})); 7187 })(io = mxgraph.io || (mxgraph.io = {})); 7188 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 7189})(com || (com = {})); 7190(function (com) { 7191 var mxgraph; 7192 (function (mxgraph) { 7193 var io; 7194 (function (io) { 7195 var vsdx; 7196 (function (vsdx) { 7197 var geometry; 7198 (function (geometry) { 7199 var PolylineTo = (function (_super) { 7200 __extends(PolylineTo, _super); 7201 function PolylineTo(index, x, y, a) { 7202 var _this = _super.call(this, index, x, y) || this; 7203 _this.formulaA = a; 7204 return _this; 7205 } 7206 /** 7207 * 7208 * @param {mxPoint} p 7209 * @param {com.mxgraph.io.vsdx.Shape} shape 7210 * @return {string} 7211 */ 7212 PolylineTo.prototype.handle = function (p, shape) { 7213 var result = ""; 7214 if (this.x != null && this.y != null && this.formulaA != null) { 7215 var h = shape.getHeight(); 7216 var w = shape.getWidth(); 7217 var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7218 var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7219 x = x * 100.0 / w; 7220 y = y * 100.0 / h; 7221 y = 100 - y; 7222 x = Math.round(x * 100.0) / 100.0; 7223 y = Math.round(y * 100.0) / 100.0; 7224 var aValue = this.formulaA.replace(new RegExp("\\s", 'g'), "").toLowerCase().replace(new RegExp("polyline\\(", 'g'), "").replace(new RegExp("\\)", 'g'), ""); 7225 if ((function (o1, o2) { if (o1 && o1.equals) { 7226 return o1.equals(o2); 7227 } 7228 else { 7229 return o1 === o2; 7230 } })(aValue, "inh")) { 7231 throw Object.defineProperty(new Error(), '__classes', { configurable: true, value: ['java.lang.Throwable', 'java.lang.Object', 'java.lang.RuntimeException', 'java.lang.IllegalArgumentException', 'java.lang.Exception'] }); 7232 } 7233 var polyEntriesList = (aValue.split(",").slice(0).slice(0)); 7234 var xRel = parseFloat(/* remove */ polyEntriesList.splice(0, 1)); 7235 var yRel = parseFloat(/* remove */ polyEntriesList.splice(0, 1)); 7236 var currX = 0; 7237 var currY = 0; 7238 while ((polyEntriesList.length > 0)) { 7239 currX = parseFloat(/* remove */ polyEntriesList.splice(0, 1)) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7240 currY = parseFloat(/* remove */ polyEntriesList.splice(0, 1)) * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7241 if (xRel === 1) { 7242 currX = currX * 100.0 / w; 7243 } 7244 if (xRel === 1) { 7245 currY = currY * 100.0 / h; 7246 } 7247 currY = 100 - currY; 7248 currX = Math.round(currX * 100.0) / 100.0; 7249 currY = Math.round(currY * 100.0) / 100.0; 7250 shape.setLastX(currX); 7251 shape.setLastY(currY); 7252 result += "<line x=\"" + new String(currX).toString() + "\" y=\"" + new String(currY).toString() + "\"/>"; 7253 } 7254 ; 7255 result += "<line x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>"; 7256 if (shape.getLastMoveX() === x && shape.getLastMoveY() === y) { 7257 result += "<close/>"; 7258 } 7259 } 7260 return result; 7261 }; 7262 return PolylineTo; 7263 }(com.mxgraph.io.vsdx.geometry.Row)); 7264 geometry.PolylineTo = PolylineTo; 7265 PolylineTo["__class"] = "com.mxgraph.io.vsdx.geometry.PolylineTo"; 7266 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 7267 })(vsdx = io.vsdx || (io.vsdx = {})); 7268 })(io = mxgraph.io || (mxgraph.io = {})); 7269 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 7270})(com || (com = {})); 7271(function (com) { 7272 var mxgraph; 7273 (function (mxgraph) { 7274 var io; 7275 (function (io) { 7276 var vsdx; 7277 (function (vsdx) { 7278 var geometry; 7279 (function (geometry) { 7280 var RelCubBezTo = (function (_super) { 7281 __extends(RelCubBezTo, _super); 7282 function RelCubBezTo(index, x, y, a, b, c, d) { 7283 var _this = _super.call(this, index, x, y) || this; 7284 _this.a = a; 7285 _this.b = b; 7286 _this.c = c; 7287 _this.d = d; 7288 return _this; 7289 } 7290 /** 7291 * 7292 * @param {mxPoint} p 7293 * @param {com.mxgraph.io.vsdx.Shape} shape 7294 * @return {string} 7295 */ 7296 RelCubBezTo.prototype.handle = function (p, shape) { 7297 if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) { 7298 var x = this.x * 100; 7299 var y = 100 - this.y * 100; 7300 var x1 = this.a * 100.0; 7301 var y1 = 100 - this.b * 100.0; 7302 var x2 = this.c * 100.0; 7303 var y2 = 100 - this.d * 100.0; 7304 x = Math.round(x * 100.0) / 100.0; 7305 y = Math.round(y * 100.0) / 100.0; 7306 x1 = Math.round(x1 * 100.0) / 100.0; 7307 y1 = Math.round(y1 * 100.0) / 100.0; 7308 x2 = Math.round(x2 * 100.0) / 100.0; 7309 y2 = Math.round(y2 * 100.0) / 100.0; 7310 shape.setLastX(x); 7311 shape.setLastY(y); 7312 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() + "\"/>"; 7313 } 7314 return ""; 7315 }; 7316 return RelCubBezTo; 7317 }(com.mxgraph.io.vsdx.geometry.Row)); 7318 geometry.RelCubBezTo = RelCubBezTo; 7319 RelCubBezTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelCubBezTo"; 7320 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 7321 })(vsdx = io.vsdx || (io.vsdx = {})); 7322 })(io = mxgraph.io || (mxgraph.io = {})); 7323 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 7324})(com || (com = {})); 7325(function (com) { 7326 var mxgraph; 7327 (function (mxgraph) { 7328 var io; 7329 (function (io) { 7330 var vsdx; 7331 (function (vsdx) { 7332 var geometry; 7333 (function (geometry) { 7334 var RelLineTo = (function (_super) { 7335 __extends(RelLineTo, _super); 7336 function RelLineTo(index, x, y) { 7337 return _super.call(this, index, x, y) || this; 7338 } 7339 /** 7340 * 7341 * @param {mxPoint} p 7342 * @param {com.mxgraph.io.vsdx.Shape} shape 7343 * @return {string} 7344 */ 7345 RelLineTo.prototype.handle = function (p, shape) { 7346 var x = p.x; 7347 var y = p.y; 7348 if (this.x != null && this.y != null) { 7349 x = this.x * 100; 7350 y = 100 - this.y * 100; 7351 } 7352 x = Math.round(x * 100.0) / 100.0; 7353 y = Math.round(y * 100.0) / 100.0; 7354 p.x = (x); 7355 p.y = (y); 7356 shape.setLastX(x); 7357 shape.setLastY(y); 7358 return "<line x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>"; 7359 }; 7360 return RelLineTo; 7361 }(com.mxgraph.io.vsdx.geometry.Row)); 7362 geometry.RelLineTo = RelLineTo; 7363 RelLineTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelLineTo"; 7364 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 7365 })(vsdx = io.vsdx || (io.vsdx = {})); 7366 })(io = mxgraph.io || (mxgraph.io = {})); 7367 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 7368})(com || (com = {})); 7369(function (com) { 7370 var mxgraph; 7371 (function (mxgraph) { 7372 var io; 7373 (function (io) { 7374 var vsdx; 7375 (function (vsdx) { 7376 var geometry; 7377 (function (geometry) { 7378 var RelMoveTo = (function (_super) { 7379 __extends(RelMoveTo, _super); 7380 function RelMoveTo(index, x, y) { 7381 return _super.call(this, index, x, y) || this; 7382 } 7383 /** 7384 * 7385 * @param {mxPoint} p 7386 * @param {com.mxgraph.io.vsdx.Shape} shape 7387 * @return {string} 7388 */ 7389 RelMoveTo.prototype.handle = function (p, shape) { 7390 var x = p.x; 7391 var y = p.y; 7392 if (this.x != null && this.y != null) { 7393 x = this.x * 100; 7394 y = 100 - this.y * 100; 7395 } 7396 x = Math.round(x * 100.0) / 100.0; 7397 y = Math.round(y * 100.0) / 100.0; 7398 p.x = (x); 7399 p.y = (y); 7400 shape.setLastX(x); 7401 shape.setLastY(y); 7402 shape.setLastMoveX(x); 7403 shape.setLastMoveY(y); 7404 return "<move x=\"" + new String(x).toString() + "\" y=\"" + new String(y).toString() + "\"/>"; 7405 }; 7406 return RelMoveTo; 7407 }(com.mxgraph.io.vsdx.geometry.Row)); 7408 geometry.RelMoveTo = RelMoveTo; 7409 RelMoveTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelMoveTo"; 7410 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 7411 })(vsdx = io.vsdx || (io.vsdx = {})); 7412 })(io = mxgraph.io || (mxgraph.io = {})); 7413 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 7414})(com || (com = {})); 7415(function (com) { 7416 var mxgraph; 7417 (function (mxgraph) { 7418 var io; 7419 (function (io) { 7420 var vsdx; 7421 (function (vsdx) { 7422 var geometry; 7423 (function (geometry) { 7424 var RelQuadBezTo = (function (_super) { 7425 __extends(RelQuadBezTo, _super); 7426 function RelQuadBezTo(index, x, y, a, b) { 7427 var _this = _super.call(this, index, x, y) || this; 7428 _this.a = a; 7429 _this.b = b; 7430 return _this; 7431 } 7432 /** 7433 * 7434 * @param {mxPoint} p 7435 * @param {com.mxgraph.io.vsdx.Shape} shape 7436 * @return {string} 7437 */ 7438 RelQuadBezTo.prototype.handle = function (p, shape) { 7439 if (this.x != null && this.y != null && this.a != null && this.b != null) { 7440 var x = this.x * 100; 7441 var y = 100 - this.y * 100; 7442 var x1 = this.a * 100.0; 7443 var y1 = 100 - this.b * 100.0; 7444 x = Math.round(x * 100.0) / 100.0; 7445 y = Math.round(y * 100.0) / 100.0; 7446 x1 = Math.round(x1 * 100.0) / 100.0; 7447 y1 = Math.round(y1 * 100.0) / 100.0; 7448 shape.setLastX(x); 7449 shape.setLastY(y); 7450 return "<quad x1=\"" + new String(x1).toString() + "\" y1=\"" + new String(y1).toString() + "\" x2=\"" + new String(x).toString() + "\" y2=\"" + new String(y).toString() + "\"/>"; 7451 } 7452 return ""; 7453 }; 7454 return RelQuadBezTo; 7455 }(com.mxgraph.io.vsdx.geometry.Row)); 7456 geometry.RelQuadBezTo = RelQuadBezTo; 7457 RelQuadBezTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelQuadBezTo"; 7458 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 7459 })(vsdx = io.vsdx || (io.vsdx = {})); 7460 })(io = mxgraph.io || (mxgraph.io = {})); 7461 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 7462})(com || (com = {})); 7463(function (com) { 7464 var mxgraph; 7465 (function (mxgraph) { 7466 var io; 7467 (function (io) { 7468 var vsdx; 7469 (function (vsdx) { 7470 var geometry; 7471 (function (geometry) { 7472 var SplineKnot = (function (_super) { 7473 __extends(SplineKnot, _super); 7474 function SplineKnot(index, x, y, a) { 7475 var _this = _super.call(this, index, x, y) || this; 7476 _this.a = a; 7477 return _this; 7478 } 7479 /** 7480 * 7481 * @param {mxPoint} p 7482 * @param {com.mxgraph.io.vsdx.Shape} shape 7483 * @return {string} 7484 */ 7485 SplineKnot.prototype.handle = function (p, shape) { 7486 if (this.x != null && this.y != null && this.a != null) { 7487 var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7488 var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7489 var a = this.a; 7490 var knot = a; 7491 y = 100 - y; 7492 x = Math.round(x * 100.0) / 100.0; 7493 y = Math.round(y * 100.0) / 100.0; 7494 knot = Math.round(knot * 100.0) / 100.0; 7495 shape.setLastX(x); 7496 shape.setLastY(y); 7497 } 7498 return ""; 7499 }; 7500 return SplineKnot; 7501 }(com.mxgraph.io.vsdx.geometry.Row)); 7502 geometry.SplineKnot = SplineKnot; 7503 SplineKnot["__class"] = "com.mxgraph.io.vsdx.geometry.SplineKnot"; 7504 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 7505 })(vsdx = io.vsdx || (io.vsdx = {})); 7506 })(io = mxgraph.io || (mxgraph.io = {})); 7507 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 7508})(com || (com = {})); 7509(function (com) { 7510 var mxgraph; 7511 (function (mxgraph) { 7512 var io; 7513 (function (io) { 7514 var vsdx; 7515 (function (vsdx) { 7516 var geometry; 7517 (function (geometry) { 7518 var SplineStart = (function (_super) { 7519 __extends(SplineStart, _super); 7520 function SplineStart(index, x, y, a, b, c, d) { 7521 var _this = _super.call(this, index, x, y) || this; 7522 _this.a = a; 7523 _this.b = b; 7524 _this.c = c; 7525 _this.d = d; 7526 return _this; 7527 } 7528 /** 7529 * 7530 * @param {mxPoint} p 7531 * @param {com.mxgraph.io.vsdx.Shape} shape 7532 * @return {string} 7533 */ 7534 SplineStart.prototype.handle = function (p, shape) { 7535 if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) { 7536 var h = shape.getHeight(); 7537 var w = shape.getWidth(); 7538 var x = this.x * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7539 var y = this.y * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7540 var c = this.c; 7541 var d = (this.d | 0); 7542 var lastKnot = c; 7543 shape.setLastKnot(lastKnot); 7544 var degree = d; 7545 y = 100 - y; 7546 x = Math.round(x * 100.0) / 100.0; 7547 y = Math.round(y * 100.0) / 100.0; 7548 lastKnot = Math.round(lastKnot * 100.0) / 100.0; 7549 var x0 = shape.getLastX() * w / 100.0; 7550 var y0 = shape.getLastY() * h / 100.0; 7551 shape.setLastX(x); 7552 shape.setLastY(y); 7553 return "<curve "; 7554 } 7555 return ""; 7556 }; 7557 return SplineStart; 7558 }(com.mxgraph.io.vsdx.geometry.Row)); 7559 geometry.SplineStart = SplineStart; 7560 SplineStart["__class"] = "com.mxgraph.io.vsdx.geometry.SplineStart"; 7561 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 7562 })(vsdx = io.vsdx || (io.vsdx = {})); 7563 })(io = mxgraph.io || (mxgraph.io = {})); 7564 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 7565})(com || (com = {})); 7566(function (com) { 7567 var mxgraph; 7568 (function (mxgraph) { 7569 var io; 7570 (function (io) { 7571 var vsdx; 7572 (function (vsdx) { 7573 /** 7574 * Create a new instance of mxGeneralShape 7575 * @param {*} shape Shape Element to be wrapped. 7576 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 7577 * @class 7578 */ 7579 var Style = (function () { 7580 function Style(shape, model) { 7581 this.cellElements = ({}); 7582 this.sections = ({}); 7583 /** 7584 * Mapping of line,text and fill styles to the style parents 7585 */ 7586 this.styleParents = ({}); 7587 this.shape = null; 7588 this.Id = null; 7589 this.pm = null; 7590 this.style = null; 7591 this.shape = shape; 7592 this.pm = model.getPropertiesManager(); 7593 var Id = shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.ID); 7594 try { 7595 this.Id = (Id != null && !(Id.length === 0)) ? parseFloat(Id) : -1; 7596 } 7597 catch (e) { 7598 this.Id = -1; 7599 } 7600 ; 7601 this.cacheCells(model); 7602 this.stylesheetRefs(model); 7603 } 7604 Style.__static_initialize = function () { if (!Style.__static_initialized) { 7605 Style.__static_initialized = true; 7606 Style.__static_initializer_0(); 7607 Style.__static_initializer_1(); 7608 } }; 7609 Style.styleTypes_$LI$ = function () { Style.__static_initialize(); if (Style.styleTypes == null) 7610 Style.styleTypes = ({}); return Style.styleTypes; }; 7611 ; 7612 Style.__static_initializer_0 = function () { 7613 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7614 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_BKGND] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7615 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_BKGND_TRANS] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7616 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_FOREGND] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7617 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_FOREGND_TRANS] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7618 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_PATTERN] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7619 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.SHDW_PATTERN] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7620 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7621 /* put */ (Style.styleTypes_$LI$()["QuickStyleFillColor"] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7622 /* put */ (Style.styleTypes_$LI$()["QuickStyleFillMatrix"] = com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE); 7623 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7624 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7625 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7626 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7627 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR_TRANS] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7628 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_WEIGHT] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7629 /* put */ (Style.styleTypes_$LI$()["QuickStyleLineColor"] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7630 /* put */ (Style.styleTypes_$LI$()["QuickStyleLineMatrix"] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7631 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW_SIZE] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7632 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW_SIZE] = com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE); 7633 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_BKGND] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE); 7634 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.BOTTOM_MARGIN] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE); 7635 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.LEFT_MARGIN] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE); 7636 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.RIGHT_MARGIN] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE); 7637 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.TOP_MARGIN] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE); 7638 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.PARAGRAPH] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE); 7639 /* put */ (Style.styleTypes_$LI$()[com.mxgraph.io.vsdx.mxVsdxConstants.CHARACTER] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE); 7640 /* put */ (Style.styleTypes_$LI$()["QuickStyleFontColor"] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE); 7641 /* put */ (Style.styleTypes_$LI$()["QuickStyleFontMatrix"] = com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE); 7642 }; 7643 Style.prototype.getTheme = function () { 7644 return null; 7645 }; 7646 Style.prototype.getQuickStyleVals = function () { 7647 return null; 7648 }; 7649 Style.prototype.isVertex = function () { 7650 return false; 7651 }; 7652 Style.prototype.styleDebug = function (debug) { 7653 if (Style.vsdxStyleDebug) { 7654 console.info(debug); 7655 } 7656 }; 7657 Style.prototype.stylesheetRefs = function (model) { 7658 /* put */ (this.styleParents[com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE] = model.getStylesheet(this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_STYLE))); 7659 /* put */ (this.styleParents[com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE] = model.getStylesheet(this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_STYLE))); 7660 /* put */ (this.styleParents[com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE] = model.getStylesheet(this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_STYLE))); 7661 var style = model.getStylesheet("0"); 7662 this.style = style; 7663 }; 7664 /** 7665 * Checks if the shape Element has a children with tag name = 'tag'. 7666 * @param tag Name of the Element to be found. 7667 * @return {void} Returns <code>true</code> if the shape Element has a children with tag name = 'tag' 7668 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 7669 */ 7670 Style.prototype.cacheCells = function (model) { 7671 if (this.shape != null) { 7672 var children = this.shape.childNodes; 7673 if (children != null) { 7674 var childNode = children.item(0); 7675 while ((childNode != null)) { 7676 if (childNode != null && (childNode.nodeType == 1)) { 7677 this.parseShapeElem(childNode, model); 7678 } 7679 childNode = childNode.nextSibling; 7680 } 7681 ; 7682 } 7683 } 7684 }; 7685 /** 7686 * Caches the specified element 7687 * @param {*} elem the element to cache 7688 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 7689 */ 7690 Style.prototype.parseShapeElem = function (elem, model) { 7691 var childName = elem.nodeName; 7692 if ((function (o1, o2) { if (o1 && o1.equals) { 7693 return o1.equals(o2); 7694 } 7695 else { 7696 return o1 === o2; 7697 } })(childName, "Cell")) { 7698 /* put */ (this.cellElements[elem.getAttribute("N")] = elem); 7699 } 7700 else if ((function (o1, o2) { if (o1 && o1.equals) { 7701 return o1.equals(o2); 7702 } 7703 else { 7704 return o1 === o2; 7705 } })(childName, "Section")) { 7706 this.parseSection(elem); 7707 } 7708 }; 7709 /** 7710 * Caches the specific section element 7711 * @param {*} elem the element to cache 7712 */ 7713 Style.prototype.parseSection = function (elem) { 7714 var sect = new com.mxgraph.io.vsdx.Section(elem); 7715 /* put */ (this.sections[elem.getAttribute("N")] = sect); 7716 }; 7717 /** 7718 * Checks if the 'primary' Element has a child with tag name = 'tag'. 7719 * @param {string} tag Name of the Element to be found. 7720 * @return {boolean} Returns <code>true</code> if the 'primary' Element has a child with tag name = 'tag'. 7721 * @param {string} nodeName 7722 */ 7723 Style.prototype.hasProperty = function (nodeName, tag) { 7724 return this.cellElements.hasOwnProperty(tag); 7725 }; 7726 /** 7727 * Returns the value of the element 7728 * @param {*} elem The element whose value is to be found 7729 * @param {string} defaultValue the value to return if there is no value attribute 7730 * @return {string} String value of the element, or the default value if no value found 7731 */ 7732 Style.prototype.getValue = function (elem, defaultValue) { 7733 if (elem != null) { 7734 return elem.getAttribute("V") || ""; 7735 } 7736 return defaultValue; 7737 }; 7738 /** 7739 * Returns the value of the element as a double 7740 * @param elem The element whose value is to be found 7741 * @param {number} defaultValue the value to return if there is no value attribute 7742 * @return {number} double value of the element, or the default value if no value found 7743 * @param {*} cell 7744 */ 7745 Style.prototype.getValueAsDouble = function (cell, defaultValue) { 7746 if (cell != null) { 7747 var value = cell.getAttribute("V"); 7748 if (value != null) { 7749 if ((function (o1, o2) { if (o1 && o1.equals) { 7750 return o1.equals(o2); 7751 } 7752 else { 7753 return o1 === o2; 7754 } })(value, "Themed")) { 7755 return 0; 7756 } 7757 try { 7758 var parsedValue = parseFloat(value); 7759 var units = cell.getAttribute("U"); 7760 if ((function (o1, o2) { if (o1 && o1.equals) { 7761 return o1.equals(o2); 7762 } 7763 else { 7764 return o1 === o2; 7765 } })(units, "PT")) { 7766 parsedValue = parsedValue * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7767 } 7768 return Math.round(parsedValue * 100.0) / 100.0; 7769 } 7770 catch (e) { 7771 console.error(e.message, e); 7772 } 7773 ; 7774 } 7775 } 7776 return defaultValue; 7777 }; 7778 Style.prototype.getScreenNumericalValue$org_w3c_dom_Element$double = function (cell, defaultValue) { 7779 if (cell != null) { 7780 var value = cell.getAttribute("V"); 7781 if (value != null) { 7782 try { 7783 var parsedValue = parseFloat(value); 7784 return this.getScreenNumericalValue$double(parsedValue); 7785 } 7786 catch (e) { 7787 console.error(e.message, e); 7788 } 7789 ; 7790 } 7791 } 7792 return defaultValue; 7793 }; 7794 /** 7795 * Returns the value of the element as a double 7796 * @param elem The element whose value is to be found 7797 * @param {number} defaultValue the value to return if there is no value attribute 7798 * @return {number} double value of the element, or the default value if no value found 7799 * @param {*} cell 7800 */ 7801 Style.prototype.getScreenNumericalValue = function (cell, defaultValue) { 7802 if (((cell != null && (cell.nodeType == 1)) || cell === null) && ((typeof defaultValue === 'number') || defaultValue === null)) { 7803 return this.getScreenNumericalValue$org_w3c_dom_Element$double(cell, defaultValue); 7804 } 7805 else if (((typeof cell === 'number') || cell === null) && defaultValue === undefined) { 7806 return this.getScreenNumericalValue$double(cell); 7807 } 7808 else 7809 throw new Error('invalid overload'); 7810 }; 7811 Style.prototype.getScreenNumericalValue$double = function (val) { 7812 var conVal = val * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 7813 return conVal; 7814 }; 7815 /** 7816 * Returns the value of the attribute of the element with tag name = 'tag' in the children 7817 * of the shape element<br/> 7818 * @param {string} tag Name of the Element to be found. 7819 * @return {string} Numerical value of the element. 7820 * @param {string} attribute 7821 * @param {string} defaultValue 7822 */ 7823 Style.prototype.getAttribute = function (tag, attribute, defaultValue) { 7824 var result = defaultValue; 7825 var cell = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, tag); 7826 if (cell != null) { 7827 result = cell.getAttribute(attribute) || ""; 7828 } 7829 return result; 7830 }; 7831 Style.prototype.getChildValues = function (parent, requiredValues) { 7832 var result = ({}); 7833 var child = parent.firstChild; 7834 while ((child != null)) { 7835 if (child != null && (child.nodeType == 1)) { 7836 var childElem = child; 7837 var childName = childElem.nodeName; 7838 var name_9 = null; 7839 var nodeValue = null; 7840 if ((function (o1, o2) { if (o1 && o1.equals) { 7841 return o1.equals(o2); 7842 } 7843 else { 7844 return o1 === o2; 7845 } })(childName, "Cell")) { 7846 name_9 = childElem.getAttribute("N") || ""; 7847 nodeValue = childElem.getAttribute("V") || ""; 7848 } 7849 else { 7850 name_9 = childElem.nodeName; 7851 nodeValue = childElem.textContent; 7852 } 7853 if (requiredValues != null) { 7854 var nodeOverride = (function (m, k) { return m[k] ? m[k] : null; })(requiredValues, name_9); 7855 if (nodeOverride != null) { 7856 nodeValue = childElem.getAttribute(nodeOverride) || ""; 7857 } 7858 } 7859 /* put */ (result[name_9] = nodeValue); 7860 } 7861 child = child.nextSibling; 7862 } 7863 ; 7864 return result; 7865 }; 7866 Style.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String = function (cellKey, index, sectKey) { 7867 var sect = (function (m, k) { return m[k] ? m[k] : null; })(this.sections, sectKey); 7868 var elem = null; 7869 var inherit = false; 7870 if (sect != null) { 7871 elem = sect.getIndexedCell(index, cellKey); 7872 } 7873 if (elem != null) { 7874 var form = elem.getAttribute("F"); 7875 var value = elem.getAttribute("V"); 7876 if (form != null && value != null) { 7877 if ((function (o1, o2) { if (o1 && o1.equals) { 7878 return o1.equals(o2); 7879 } 7880 else { 7881 return o1 === o2; 7882 } })(form, "Inh") && (function (o1, o2) { if (o1 && o1.equals) { 7883 return o1.equals(o2); 7884 } 7885 else { 7886 return o1 === o2; 7887 } })(value, "Themed")) { 7888 inherit = true; 7889 } 7890 else if ((function (o1, o2) { if (o1 && o1.equals) { 7891 return o1.equals(o2); 7892 } 7893 else { 7894 return o1 === o2; 7895 } })(form, "THEMEVAL()") && (function (o1, o2) { if (o1 && o1.equals) { 7896 return o1.equals(o2); 7897 } 7898 else { 7899 return o1 === o2; 7900 } })(value, "Themed") && this.style != null) { 7901 if ((function (o1, o2) { if (o1 && o1.equals) { 7902 return o1.equals(o2); 7903 } 7904 else { 7905 return o1 === o2; 7906 } })(com.mxgraph.io.vsdx.mxVsdxConstants.COLOR, cellKey)) 7907 return elem; 7908 var themeElem = this.style.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey); 7909 if (themeElem != null) { 7910 return themeElem; 7911 } 7912 } 7913 } 7914 } 7915 if (elem == null || inherit) { 7916 var styleType = (function (m, k) { return m[k] ? m[k] : null; })(Style.styleTypes_$LI$(), sectKey); 7917 var parentStyle = (function (m, k) { return m[k] ? m[k] : null; })(this.styleParents, styleType); 7918 if (parentStyle != null) { 7919 var parentElem = parentStyle.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey); 7920 if (parentElem != null) { 7921 return parentElem; 7922 } 7923 } 7924 } 7925 return elem; 7926 }; 7927 Style.prototype.getCellElement = function (cellKey, index, sectKey) { 7928 if (((typeof cellKey === 'string') || cellKey === null) && ((typeof index === 'string') || index === null) && ((typeof sectKey === 'string') || sectKey === null)) { 7929 return this.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey); 7930 } 7931 else if (((typeof cellKey === 'string') || cellKey === null) && index === undefined && sectKey === undefined) { 7932 return this.getCellElement$java_lang_String(cellKey); 7933 } 7934 else 7935 throw new Error('invalid overload'); 7936 }; 7937 Style.prototype.getCellElement$java_lang_String = function (key) { 7938 var elem = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, key); 7939 var inherit = false; 7940 if (elem != null) { 7941 var form = elem.getAttribute("F"); 7942 var value = elem.getAttribute("V"); 7943 if (form != null && value != null) { 7944 if ((function (o1, o2) { if (o1 && o1.equals) { 7945 return o1.equals(o2); 7946 } 7947 else { 7948 return o1 === o2; 7949 } })(form, "Inh") && (function (o1, o2) { if (o1 && o1.equals) { 7950 return o1.equals(o2); 7951 } 7952 else { 7953 return o1 === o2; 7954 } })(value, "Themed")) { 7955 inherit = true; 7956 } 7957 else if (form.indexOf("THEMEVAL()") != -1 && (function (o1, o2) { if (o1 && o1.equals) { 7958 return o1.equals(o2); 7959 } 7960 else { 7961 return o1 === o2; 7962 } })(value, "Themed") && this.style != null) { 7963 if ((function (o1, o2) { if (o1 && o1.equals) { 7964 return o1.equals(o2); 7965 } 7966 else { 7967 return o1 === o2; 7968 } })("FillForegnd", key) || (function (o1, o2) { if (o1 && o1.equals) { 7969 return o1.equals(o2); 7970 } 7971 else { 7972 return o1 === o2; 7973 } })(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR, key) || (function (o1, o2) { if (o1 && o1.equals) { 7974 return o1.equals(o2); 7975 } 7976 else { 7977 return o1 === o2; 7978 } })(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN, key) || (function (o1, o2) { if (o1 && o1.equals) { 7979 return o1.equals(o2); 7980 } 7981 else { 7982 return o1 === o2; 7983 } })(com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW_SIZE, key) || (function (o1, o2) { if (o1 && o1.equals) { 7984 return o1.equals(o2); 7985 } 7986 else { 7987 return o1 === o2; 7988 } })(com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW_SIZE, key) || (function (o1, o2) { if (o1 && o1.equals) { 7989 return o1.equals(o2); 7990 } 7991 else { 7992 return o1 === o2; 7993 } })(com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW, key) || (function (o1, o2) { if (o1 && o1.equals) { 7994 return o1.equals(o2); 7995 } 7996 else { 7997 return o1 === o2; 7998 } })(com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW, key) || (function (o1, o2) { if (o1 && o1.equals) { 7999 return o1.equals(o2); 8000 } 8001 else { 8002 return o1 === o2; 8003 } })(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_WEIGHT, key)) 8004 return elem; 8005 var themeElem = this.style.getCellElement$java_lang_String(key); 8006 if (themeElem != null) { 8007 return themeElem; 8008 } 8009 } 8010 } 8011 } 8012 if (elem == null || inherit) { 8013 var styleType = (function (m, k) { return m[k] ? m[k] : null; })(Style.styleTypes_$LI$(), key); 8014 var parentStyle = (function (m, k) { return m[k] ? m[k] : null; })(this.styleParents, styleType); 8015 if (parentStyle != null) { 8016 var parentElem = parentStyle.getCellElement$java_lang_String(key); 8017 if (parentElem != null) { 8018 return parentElem; 8019 } 8020 } 8021 } 8022 return elem; 8023 }; 8024 /** 8025 * Returns the line color.<br/> 8026 * The property may to be defined in master shape or line stylesheet.<br/> 8027 * @return {string} hexadecimal representation of the color. 8028 */ 8029 Style.prototype.getStrokeColor = function () { 8030 var color = ""; 8031 if ((function (o1, o2) { if (o1 && o1.equals) { 8032 return o1.equals(o2); 8033 } 8034 else { 8035 return o1 === o2; 8036 } })(this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN), "1"), "0")) { 8037 color = "none"; 8038 } 8039 else { 8040 color = this.getColor(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR)); 8041 if ((function (o1, o2) { if (o1 && o1.equals) { 8042 return o1.equals(o2); 8043 } 8044 else { 8045 return o1 === o2; 8046 } })("Themed", color)) { 8047 var theme_7 = this.getTheme(); 8048 if (theme_7 != null) { 8049 var colorObj = this.isVertex() ? theme_7.getLineColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_7.getConnLineColor(this.getQuickStyleVals()); 8050 color = colorObj.toHexStr(); 8051 } 8052 else { 8053 color = ""; 8054 } 8055 } 8056 } 8057 return color; 8058 }; 8059 /** 8060 * Returns the shape's color. 8061 * The property may to be defined in master shape or fill stylesheet. 8062 * If the color is the background or the fore color, it depends on the pattern. 8063 * For simple gradients and solid, returns the fore color, else return the 8064 * background color. 8065 * @return {string} hexadecimal representation of the color. 8066 */ 8067 Style.prototype.getFillColor = function () { 8068 var fillGradientEnabled = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_GRADIENT_ENABLED), "0"); 8069 if ((function (o1, o2) { if (o1 && o1.equals) { 8070 return o1.equals(o2); 8071 } 8072 else { 8073 return o1 === o2; 8074 } })("1", fillGradientEnabled)) { 8075 var fillGradient = (function (m, k) { return m[k] ? m[k] : null; })(this.sections, "FillGradient"); 8076 if (fillGradient != null) { 8077 var color = this.getColor(fillGradient.getIndexedCell("0", "GradientStopColor")); 8078 if (color != null && !(color.length === 0)) 8079 return color; 8080 } 8081 } 8082 var fillForeColor = this.getColor(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_FOREGND)); 8083 if ((function (o1, o2) { if (o1 && o1.equals) { 8084 return o1.equals(o2); 8085 } 8086 else { 8087 return o1 === o2; 8088 } })("Themed", fillForeColor)) { 8089 var theme_8 = this.getTheme(); 8090 if (theme_8 != null) { 8091 var color = theme_8.getFillColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()); 8092 fillForeColor = color.toHexStr(); 8093 } 8094 else { 8095 fillForeColor = "#FFFFFF"; 8096 } 8097 } 8098 var fillPattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_PATTERN), "0"); 8099 if (fillPattern != null && (function (o1, o2) { if (o1 && o1.equals) { 8100 return o1.equals(o2); 8101 } 8102 else { 8103 return o1 === o2; 8104 } })(fillPattern, "0")) { 8105 return "none"; 8106 } 8107 else { 8108 return fillForeColor; 8109 } 8110 }; 8111 Style.prototype.getColor = function (elem) { 8112 var color = this.getValue(elem, ""); 8113 if (!(function (o1, o2) { if (o1 && o1.equals) { 8114 return o1.equals(o2); 8115 } 8116 else { 8117 return o1 === o2; 8118 } })("Themed", color) && !(function (str, searchString, position) { 8119 if (position === void 0) { position = 0; } 8120 return str.substr(position, searchString.length) === searchString; 8121 })(color, "#")) { 8122 color = this.pm.getColor(color); 8123 } 8124 return color; 8125 }; 8126 /** 8127 * 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. 8128 * 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, 8129 * rather than a number, will be shown in the ShapeSheet window. When used in numeric operations, custom colors have values of 25 and above. 8130 * You can set the transparency of the text background color in the TextBkgndTrans cell. 8131 * @param {*} elem 8132 * @return {string} 8133 */ 8134 Style.prototype.getTextBkgndColor = function (elem) { 8135 var color = this.getValue(elem, ""); 8136 if (!(function (str, searchString, position) { 8137 if (position === void 0) { position = 0; } 8138 return str.substr(position, searchString.length) === searchString; 8139 })(color, "#")) { 8140 if ((function (o1, o2) { if (o1 && o1.equals) { 8141 return o1.equals(o2); 8142 } 8143 else { 8144 return o1 === o2; 8145 } })(color, "0") || (function (o1, o2) { if (o1 && o1.equals) { 8146 return o1.equals(o2); 8147 } 8148 else { 8149 return o1 === o2; 8150 } })(color, "255") || (color.length === 0)) { 8151 return "none"; 8152 } 8153 return this.pm.getColor(/* valueOf */ new String(/* parseInt */ parseInt(color) - 1).toString()); 8154 } 8155 return color; 8156 }; 8157 /** 8158 * Returns the line weight of the shape in pixels 8159 * @return {number} Numerical value of the LineWeight element. 8160 */ 8161 Style.prototype.getLineWeight = function () { 8162 return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_WEIGHT), 0); 8163 }; 8164 /** 8165 * Returns the level of transparency of the Shape. 8166 * @return {number} double in range (opaque = 0)..(100 = transparent) 8167 */ 8168 Style.prototype.getStrokeTransparency = function () { 8169 return this.getValueAsDouble(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR_TRANS), 0); 8170 }; 8171 /** 8172 * Returns the NameU attribute. 8173 * @return {string} Value of the NameU attribute. 8174 */ 8175 Style.prototype.getNameU = function () { 8176 return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U) || ""; 8177 }; 8178 /** 8179 * Returns the Name attribute. 8180 * @return {string} Value of the Name attribute (Human readable name). 8181 */ 8182 Style.prototype.getName = function () { 8183 return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME) || ""; 8184 }; 8185 /** 8186 * Returns the UniqueID attribute. 8187 * @return {string} Value of the UniqueID attribute. 8188 */ 8189 Style.prototype.getUniqueID = function () { 8190 return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.UNIQUE_ID) || ""; 8191 }; 8192 /** 8193 * Returns the value of the Id attribute. 8194 * @return {number} Value of the Id attribute. 8195 */ 8196 Style.prototype.getId = function () { 8197 return this.Id; 8198 }; 8199 /** 8200 * Returns the color of one text fragment 8201 * @param charIX IX attribute of Char element 8202 * @return {string} Text color in hexadecimal representation. 8203 * @param {string} index 8204 */ 8205 Style.prototype.getTextColor = function (index) { 8206 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); 8207 var color = this.getValue(colorElem, "#000000"); 8208 if ((function (o1, o2) { if (o1 && o1.equals) { 8209 return o1.equals(o2); 8210 } 8211 else { 8212 return o1 === o2; 8213 } })("Themed", color)) { 8214 var theme_9 = this.getTheme(); 8215 if (theme_9 != null) { 8216 var colorObj = this.isVertex() ? theme_9.getFontColor$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_9.getConnFontColor(this.getQuickStyleVals()); 8217 color = colorObj.toHexStr(); 8218 } 8219 else { 8220 color = "#000000"; 8221 } 8222 } 8223 else if (!(function (str, searchString, position) { 8224 if (position === void 0) { position = 0; } 8225 return str.substr(position, searchString.length) === searchString; 8226 })(color, "#")) { 8227 color = this.pm.getColor(color); 8228 } 8229 return color; 8230 }; 8231 /** 8232 * Returns the top margin of text in pixels. 8233 * @return {number} Numerical value of the TopMargin element 8234 */ 8235 Style.prototype.getTextTopMargin = function () { 8236 return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.TOP_MARGIN), 0); 8237 }; 8238 /** 8239 * Returns the bottom margin of text in pixels. 8240 * @return {number} Numerical value of the BottomMargin element. 8241 */ 8242 Style.prototype.getTextBottomMargin = function () { 8243 return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.BOTTOM_MARGIN), 0); 8244 }; 8245 /** 8246 * Returns the left margin of text in pixels. 8247 * @return {number} Numerical value of the LeftMargin element. 8248 */ 8249 Style.prototype.getTextLeftMargin = function () { 8250 return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LEFT_MARGIN), 0); 8251 }; 8252 /** 8253 * Returns the right margin of text in pixels. 8254 * @return {number} Numerical value of the RightMargin element. 8255 */ 8256 Style.prototype.getTextRightMargin = function () { 8257 return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.RIGHT_MARGIN), 0); 8258 }; 8259 /** 8260 * Returns the style of one text fragment. 8261 * @param charIX IX attribute of Char element 8262 * @return {string} String value of the Style element. 8263 * @param {string} index 8264 */ 8265 Style.prototype.getTextStyle = function (index) { 8266 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); 8267 return this.getValue(styleElem, ""); 8268 }; 8269 /** 8270 * Returns the font of one text fragment 8271 * @param charIX IX attribute of Char element 8272 * @return {string} Name of the font. 8273 * @param {string} index 8274 */ 8275 Style.prototype.getTextFont = function (index) { 8276 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); 8277 return this.getValue(fontElem, ""); 8278 }; 8279 /** 8280 * Returns the position of one text fragment 8281 * @param charIX IX attribute of Char element 8282 * @return {string} Integer value of the Pos element. 8283 * @param {string} index 8284 */ 8285 Style.prototype.getTextPos = function (index) { 8286 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); 8287 return this.getValue(posElem, ""); 8288 }; 8289 /** 8290 * Checks if one text fragment is Strikethru 8291 * @param charIX IX attribute of Char element 8292 * @return {boolean} Returns <code>true</code> if one text fragment is Strikethru 8293 * @param {string} index 8294 */ 8295 Style.prototype.getTextStrike = function (index) { 8296 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); 8297 return (function (o1, o2) { if (o1 && o1.equals) { 8298 return o1.equals(o2); 8299 } 8300 else { 8301 return o1 === o2; 8302 } })(this.getValue(strikeElem, ""), "1"); 8303 }; 8304 /** 8305 * Returns the case property of one text fragment 8306 * @param charIX IX attribute of Char element 8307 * @return {string} Integer value of the Case element 8308 * @param {string} index 8309 */ 8310 Style.prototype.getTextCase = function (index) { 8311 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); 8312 return this.getValue(caseElem, ""); 8313 }; 8314 /** 8315 * Returns the horizontal align property of a paragraph 8316 * @param {string} index IX attribute of Para element 8317 * @param {boolean} html whether to return the html values or mxGraph values 8318 * @return {string} String value of the HorizontalAlign element. 8319 */ 8320 Style.prototype.getHorizontalAlign = function (index, html) { 8321 var ret = "center"; 8322 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); 8323 var align = this.getValue(horAlign, ""); 8324 switch ((align)) { 8325 case "0": 8326 ret = html ? "left" : mxConstants.ALIGN_LEFT; 8327 break; 8328 case "2": 8329 ret = html ? "right" : mxConstants.ALIGN_RIGHT; 8330 break; 8331 case "3": 8332 case "4": 8333 ret = html ? "justify" : mxConstants.ALIGN_CENTER; 8334 break; 8335 default: 8336 ret = html ? "center" : mxConstants.ALIGN_CENTER; 8337 } 8338 return ret; 8339 }; 8340 /** 8341 * Returns the first indent of one paragraph in pixels. 8342 * @param paraIX IX attribute of Para element 8343 * @return {string} String representation of the numerical value of the IndentFirst element. 8344 * @param {string} index 8345 */ 8346 Style.prototype.getIndentFirst = function (index) { 8347 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); 8348 return new String(this.getScreenNumericalValue$org_w3c_dom_Element$double(indentFirstElem, 0)).toString(); 8349 }; 8350 /** 8351 * Returns the indent to left of one paragraph 8352 * @param paraIX IX attribute of Para element 8353 * @return {string} String representation of the numerical value of the IndentLeft element. 8354 * @param {string} index 8355 */ 8356 Style.prototype.getIndentLeft = function (index) { 8357 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); 8358 return new String((Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(indentLeftElem, 0)) | 0)).toString(); 8359 }; 8360 /** 8361 * Returns the indent to right of one paragraph 8362 * @param paraIX IX attribute of Para element 8363 * @return {string} String representation of the numerical value of the IndentRight element. 8364 * @param {string} index 8365 */ 8366 Style.prototype.getIndentRight = function (index) { 8367 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); 8368 return new String((Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(indentRightElem, 0)) | 0)).toString(); 8369 }; 8370 /** 8371 * Returns the space before one paragraph. 8372 * @param paraIX IX attribute of Para element 8373 * @return {string} String representation of the numerical value of the SpBefore element. 8374 * @param {string} index 8375 */ 8376 Style.prototype.getSpBefore = function (index) { 8377 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); 8378 return new String((Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(spBeforeElem, 0)) | 0)).toString(); 8379 }; 8380 /** 8381 * Returns the space after one paragraph 8382 * @param paraIX IX attribute of Para element 8383 * @return {string} String representation of the numerical value of the SpAfter element. 8384 * @param {string} index 8385 */ 8386 Style.prototype.getSpAfter = function (index) { 8387 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); 8388 return new String((Math.round(this.getScreenNumericalValue$org_w3c_dom_Element$double(spAfterElem, 0)) | 0)).toString(); 8389 }; 8390 /** 8391 * Returns the space between lines in one paragraph. 8392 * @param paraIX IX attribute of Para element. 8393 * @return {number} Double representation of the value of the SpLine element. 8394 * @param {string} index 8395 */ 8396 Style.prototype.getSpLine = function (index) { 8397 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); 8398 var val = this.getValue(spLineElem, ""); 8399 if (!(function (o1, o2) { if (o1 && o1.equals) { 8400 return o1.equals(o2); 8401 } 8402 else { 8403 return o1 === o2; 8404 } })(val, "")) { 8405 return parseFloat(val); 8406 } 8407 return 0; 8408 }; 8409 /** 8410 * Returns the flags of one paragraph. 8411 * @param paraIX IX attribute of Para element. 8412 * @return {string} String value of the Flags element. 8413 * @param {string} index 8414 */ 8415 Style.prototype.getFlags = function (index) { 8416 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); 8417 return this.getValue(flagsElem, "0"); 8418 }; 8419 /** 8420 * Returns the space between characters in one text fragment. 8421 * @param paraIX IX attribute of Para element. 8422 * @return {string} String representation of the numerical value of the Letterspace element. 8423 * @param {string} index 8424 */ 8425 Style.prototype.getLetterSpace = function (index) { 8426 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); 8427 return new String(this.getScreenNumericalValue$org_w3c_dom_Element$double(letterSpaceElem, 0)).toString(); 8428 }; 8429 /** 8430 * Returns the bullet element value. 8431 * @param paraIX IX attribute of Para element. 8432 * @return {string} String value of the Bullet element. 8433 * @param {string} index 8434 */ 8435 Style.prototype.getBullet = function (index) { 8436 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); 8437 return this.getValue(bulletElem, "0"); 8438 }; 8439 Style.prototype.getShape = function () { 8440 return this.shape; 8441 }; 8442 Style.prototype.setShape = function (shape) { 8443 this.shape = shape; 8444 }; 8445 Style.lineDashPatterns_$LI$ = function () { Style.__static_initialize(); if (Style.lineDashPatterns == null) 8446 Style.lineDashPatterns = ([]); return Style.lineDashPatterns; }; 8447 ; 8448 Style.__static_initializer_1 = function () { 8449 /* add */ (Style.lineDashPatterns_$LI$().push([])); 8450 /* add */ (Style.lineDashPatterns_$LI$().push([])); 8451 /* add */ (Style.lineDashPatterns_$LI$().push([])); 8452 var lineDashPattern = ([]); 8453 /* add */ (lineDashPattern.push(Style.DOT)); 8454 /* add */ (lineDashPattern.push(Style.SPACE)); 8455 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8456 lineDashPattern = ([]); 8457 /* add */ (lineDashPattern.push(Style.DASH)); 8458 /* add */ (lineDashPattern.push(Style.SPACE)); 8459 /* add */ (lineDashPattern.push(Style.DOT)); 8460 /* add */ (lineDashPattern.push(Style.SPACE)); 8461 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8462 lineDashPattern = ([]); 8463 /* add */ (lineDashPattern.push(Style.DASH)); 8464 /* add */ (lineDashPattern.push(Style.SPACE)); 8465 /* add */ (lineDashPattern.push(Style.DOT)); 8466 /* add */ (lineDashPattern.push(Style.SPACE)); 8467 /* add */ (lineDashPattern.push(Style.DOT)); 8468 /* add */ (lineDashPattern.push(Style.SPACE)); 8469 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8470 lineDashPattern = ([]); 8471 /* add */ (lineDashPattern.push(Style.DASH)); 8472 /* add */ (lineDashPattern.push(Style.SPACE)); 8473 /* add */ (lineDashPattern.push(Style.DASH)); 8474 /* add */ (lineDashPattern.push(Style.SPACE)); 8475 /* add */ (lineDashPattern.push(Style.DOT)); 8476 /* add */ (lineDashPattern.push(Style.SPACE)); 8477 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8478 lineDashPattern = ([]); 8479 /* add */ (lineDashPattern.push(Style.LONG_DASH)); 8480 /* add */ (lineDashPattern.push(Style.SPACE)); 8481 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8482 /* add */ (lineDashPattern.push(Style.SPACE)); 8483 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8484 lineDashPattern = ([]); 8485 /* add */ (lineDashPattern.push(Style.LONG_DASH)); 8486 /* add */ (lineDashPattern.push(Style.SPACE)); 8487 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8488 /* add */ (lineDashPattern.push(Style.SPACE)); 8489 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8490 /* add */ (lineDashPattern.push(Style.SPACE)); 8491 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8492 lineDashPattern = ([]); 8493 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8494 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8495 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8496 lineDashPattern = ([]); 8497 /* add */ (lineDashPattern.push(Style.DOT)); 8498 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8499 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8500 lineDashPattern = ([]); 8501 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8502 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8503 /* add */ (lineDashPattern.push(Style.DOT)); 8504 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8505 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8506 lineDashPattern = ([]); 8507 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8508 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8509 /* add */ (lineDashPattern.push(Style.DOT)); 8510 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8511 /* add */ (lineDashPattern.push(Style.DOT)); 8512 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8513 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8514 lineDashPattern = ([]); 8515 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8516 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8517 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8518 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8519 /* add */ (lineDashPattern.push(Style.DOT)); 8520 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8521 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8522 lineDashPattern = ([]); 8523 /* add */ (lineDashPattern.push(Style.DASH)); 8524 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8525 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8526 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8527 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8528 lineDashPattern = ([]); 8529 /* add */ (lineDashPattern.push(Style.DASH)); 8530 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8531 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8532 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8533 /* add */ (lineDashPattern.push(Style.SHORT_DASH)); 8534 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8535 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8536 lineDashPattern = ([]); 8537 /* add */ (lineDashPattern.push(Style.LONG_DASH)); 8538 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8539 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8540 lineDashPattern = ([]); 8541 /* add */ (lineDashPattern.push(Style.DOT)); 8542 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8543 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8544 lineDashPattern = ([]); 8545 /* add */ (lineDashPattern.push(Style.LONG_DASH)); 8546 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8547 /* add */ (lineDashPattern.push(Style.DOT)); 8548 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8549 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8550 lineDashPattern = ([]); 8551 /* add */ (lineDashPattern.push(Style.LONG_DASH)); 8552 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8553 /* add */ (lineDashPattern.push(Style.DOT)); 8554 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8555 /* add */ (lineDashPattern.push(Style.DOT)); 8556 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8557 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8558 lineDashPattern = ([]); 8559 /* add */ (lineDashPattern.push(Style.LONG_DASH)); 8560 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8561 /* add */ (lineDashPattern.push(Style.LONG_DASH)); 8562 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8563 /* add */ (lineDashPattern.push(Style.DOT)); 8564 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8565 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8566 lineDashPattern = ([]); 8567 /* add */ (lineDashPattern.push(Style.XLONG_DASH)); 8568 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8569 /* add */ (lineDashPattern.push(Style.DASH)); 8570 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8571 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8572 lineDashPattern = ([]); 8573 /* add */ (lineDashPattern.push(Style.XLONG_DASH)); 8574 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8575 /* add */ (lineDashPattern.push(Style.DASH)); 8576 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8577 /* add */ (lineDashPattern.push(Style.DASH)); 8578 /* add */ (lineDashPattern.push(Style.LONG_SPACE)); 8579 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8580 lineDashPattern = ([]); 8581 /* add */ (lineDashPattern.push(Style.XSHORT_DASH)); 8582 /* add */ (lineDashPattern.push(Style.SHORT_SPACE)); 8583 /* add */ (Style.lineDashPatterns_$LI$().push(lineDashPattern)); 8584 }; 8585 Style.getLineDashPattern = function (pattern) { 8586 if (pattern >= 0 && pattern <= 23) 8587 return Style.lineDashPatterns_$LI$()[pattern]; 8588 else 8589 return Style.lineDashPatterns_$LI$()[0]; 8590 }; 8591 return Style; 8592 }()); 8593 Style.__static_initialized = false; 8594 Style.vsdxStyleDebug = false; 8595 Style.SPACE = 4.0; 8596 Style.SHORT_SPACE = 2.0; 8597 Style.LONG_SPACE = 6.0; 8598 Style.DOT = 1.0; 8599 Style.DASH = 8.0; 8600 Style.LONG_DASH = 12.0; 8601 Style.SHORT_DASH = 4.0; 8602 Style.XLONG_DASH = 20.0; 8603 Style.XSHORT_DASH = 2.0; 8604 vsdx.Style = Style; 8605 Style["__class"] = "com.mxgraph.io.vsdx.Style"; 8606 })(vsdx = io.vsdx || (io.vsdx = {})); 8607 })(io = mxgraph.io || (mxgraph.io = {})); 8608 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 8609})(com || (com = {})); 8610(function (com) { 8611 var mxgraph; 8612 (function (mxgraph) { 8613 var io; 8614 (function (io) { 8615 var vsdx; 8616 (function (vsdx) { 8617 var theme; 8618 (function (theme) { 8619 var HslClr = (function (_super) { 8620 __extends(HslClr, _super); 8621 function HslClr(hue, sat, lum) { 8622 var _this = _super.call(this) || this; 8623 _this.__com_mxgraph_io_vsdx_theme_HslClr_hue = 0; 8624 _this.__com_mxgraph_io_vsdx_theme_HslClr_sat = 0; 8625 _this.__com_mxgraph_io_vsdx_theme_HslClr_lum = 0; 8626 _this.__com_mxgraph_io_vsdx_theme_HslClr_hue = hue / 360.0; 8627 _this.__com_mxgraph_io_vsdx_theme_HslClr_sat = sat / 100.0; 8628 _this.__com_mxgraph_io_vsdx_theme_HslClr_lum = lum / 100.0; 8629 _this.color = new com.mxgraph.io.vsdx.theme.HSLColor(hue, sat, lum).toRgb(); 8630 return _this; 8631 } 8632 return HslClr; 8633 }(com.mxgraph.io.vsdx.theme.OoxmlColor)); 8634 theme.HslClr = HslClr; 8635 HslClr["__class"] = "com.mxgraph.io.vsdx.theme.HslClr"; 8636 })(theme = vsdx.theme || (vsdx.theme = {})); 8637 })(vsdx = io.vsdx || (io.vsdx = {})); 8638 })(io = mxgraph.io || (mxgraph.io = {})); 8639 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 8640})(com || (com = {})); 8641(function (com) { 8642 var mxgraph; 8643 (function (mxgraph) { 8644 var io; 8645 (function (io) { 8646 var vsdx; 8647 (function (vsdx) { 8648 var theme; 8649 (function (theme) { 8650 var PrstClr = (function (_super) { 8651 __extends(PrstClr, _super); 8652 function PrstClr(val) { 8653 var _this = _super.call(this) || this; 8654 _this.val = null; 8655 _this.val = val; 8656 _this.color = new com.mxgraph.io.vsdx.theme.Color(255, 255, 255); 8657 return _this; 8658 } 8659 return PrstClr; 8660 }(com.mxgraph.io.vsdx.theme.OoxmlColor)); 8661 theme.PrstClr = PrstClr; 8662 PrstClr["__class"] = "com.mxgraph.io.vsdx.theme.PrstClr"; 8663 })(theme = vsdx.theme || (vsdx.theme = {})); 8664 })(vsdx = io.vsdx || (io.vsdx = {})); 8665 })(io = mxgraph.io || (mxgraph.io = {})); 8666 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 8667})(com || (com = {})); 8668(function (com) { 8669 var mxgraph; 8670 (function (mxgraph) { 8671 var io; 8672 (function (io) { 8673 var vsdx; 8674 (function (vsdx) { 8675 var theme; 8676 (function (theme_10) { 8677 var SchemeClr = (function (_super) { 8678 __extends(SchemeClr, _super); 8679 function SchemeClr(val) { 8680 var _this = _super.call(this) || this; 8681 _this.val = null; 8682 _this.isDynamic = true; 8683 _this.val = val; 8684 return _this; 8685 } 8686 SchemeClr.prototype.calcColor = function (styleColor, theme) { 8687 if (!(function (o1, o2) { if (o1 && o1.equals) { 8688 return o1.equals(o2); 8689 } 8690 else { 8691 return o1 === o2; 8692 } })("phClr", this.val)) { 8693 this.color = theme.getSchemeColor(this.val); 8694 this.isDynamic = false; 8695 } 8696 else { 8697 this.color = theme.getStyleColor(styleColor); 8698 } 8699 _super.prototype.calcColor.call(this, styleColor, theme); 8700 }; 8701 return SchemeClr; 8702 }(com.mxgraph.io.vsdx.theme.OoxmlColor)); 8703 theme_10.SchemeClr = SchemeClr; 8704 SchemeClr["__class"] = "com.mxgraph.io.vsdx.theme.SchemeClr"; 8705 })(theme = vsdx.theme || (vsdx.theme = {})); 8706 })(vsdx = io.vsdx || (io.vsdx = {})); 8707 })(io = mxgraph.io || (mxgraph.io = {})); 8708 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 8709})(com || (com = {})); 8710(function (com) { 8711 var mxgraph; 8712 (function (mxgraph) { 8713 var io; 8714 (function (io) { 8715 var vsdx; 8716 (function (vsdx) { 8717 var theme; 8718 (function (theme) { 8719 var ScrgbClr = (function (_super) { 8720 __extends(ScrgbClr, _super); 8721 function ScrgbClr(r, g, b) { 8722 var _this = _super.call(this) || this; 8723 _this.r = 0; 8724 _this.g = 0; 8725 _this.b = 0; 8726 _this.r = r; 8727 _this.g = g; 8728 _this.b = b; 8729 _this.color = new com.mxgraph.io.vsdx.theme.Color(r, g, b); 8730 return _this; 8731 } 8732 return ScrgbClr; 8733 }(com.mxgraph.io.vsdx.theme.OoxmlColor)); 8734 theme.ScrgbClr = ScrgbClr; 8735 ScrgbClr["__class"] = "com.mxgraph.io.vsdx.theme.ScrgbClr"; 8736 })(theme = vsdx.theme || (vsdx.theme = {})); 8737 })(vsdx = io.vsdx || (io.vsdx = {})); 8738 })(io = mxgraph.io || (mxgraph.io = {})); 8739 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 8740})(com || (com = {})); 8741(function (com) { 8742 var mxgraph; 8743 (function (mxgraph) { 8744 var io; 8745 (function (io) { 8746 var vsdx; 8747 (function (vsdx) { 8748 var theme; 8749 (function (theme) { 8750 var SrgbClr = (function (_super) { 8751 __extends(SrgbClr, _super); 8752 function SrgbClr(hexVal) { 8753 var _this = _super.call(this) || this; 8754 _this.hexVal = null; 8755 _this.hexVal = hexVal; 8756 _this.color = com.mxgraph.io.vsdx.theme.Color.decodeColorHex(hexVal); 8757 return _this; 8758 } 8759 return SrgbClr; 8760 }(com.mxgraph.io.vsdx.theme.OoxmlColor)); 8761 theme.SrgbClr = SrgbClr; 8762 SrgbClr["__class"] = "com.mxgraph.io.vsdx.theme.SrgbClr"; 8763 })(theme = vsdx.theme || (vsdx.theme = {})); 8764 })(vsdx = io.vsdx || (io.vsdx = {})); 8765 })(io = mxgraph.io || (mxgraph.io = {})); 8766 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 8767})(com || (com = {})); 8768(function (com) { 8769 var mxgraph; 8770 (function (mxgraph) { 8771 var io; 8772 (function (io) { 8773 var vsdx; 8774 (function (vsdx) { 8775 var theme; 8776 (function (theme) { 8777 var SysClr = (function (_super) { 8778 __extends(SysClr, _super); 8779 function SysClr(val, lastClr) { 8780 var _this = _super.call(this) || this; 8781 _this.val = null; 8782 _this.lastClr = null; 8783 _this.val = val; 8784 _this.lastClr = lastClr; 8785 var hexVal = lastClr; 8786 if (hexVal == null) { 8787 switch ((val)) { 8788 case "windowText": 8789 hexVal = "000000"; 8790 break; 8791 case "window": 8792 hexVal = "FFFFFF"; 8793 break; 8794 default: 8795 hexVal = "FFFFFF"; 8796 } 8797 } 8798 _this.color = com.mxgraph.io.vsdx.theme.Color.decodeColorHex(hexVal); 8799 return _this; 8800 } 8801 return SysClr; 8802 }(com.mxgraph.io.vsdx.theme.OoxmlColor)); 8803 theme.SysClr = SysClr; 8804 SysClr["__class"] = "com.mxgraph.io.vsdx.theme.SysClr"; 8805 })(theme = vsdx.theme || (vsdx.theme = {})); 8806 })(vsdx = io.vsdx || (io.vsdx = {})); 8807 })(io = mxgraph.io || (mxgraph.io = {})); 8808 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 8809})(com || (com = {})); 8810(function (com) { 8811 var mxgraph; 8812 (function (mxgraph) { 8813 var io; 8814 (function (io) { 8815 var vsdx; 8816 (function (vsdx) { 8817 var geometry; 8818 (function (geometry) { 8819 var RelEllipticalArcTo = (function (_super) { 8820 __extends(RelEllipticalArcTo, _super); 8821 function RelEllipticalArcTo(index, x, y, a, b, c, d) { 8822 return _super.call(this, index, x, y, a, b, c, d) || this; 8823 } 8824 /** 8825 * 8826 * @param {mxPoint} p 8827 * @param {com.mxgraph.io.vsdx.Shape} shape 8828 * @return {string} 8829 */ 8830 RelEllipticalArcTo.prototype.handle = function (p, shape) { 8831 if (this.x != null && this.y != null && this.a != null && this.b != null && this.c != null && this.d != null) { 8832 var h = shape.getHeight() / com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 8833 var w = shape.getWidth() / com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 8834 this.x *= w; 8835 this.y *= h; 8836 this.a *= w; 8837 this.b *= h; 8838 } 8839 return _super.prototype.handle.call(this, p, shape); 8840 }; 8841 return RelEllipticalArcTo; 8842 }(com.mxgraph.io.vsdx.geometry.EllipticalArcTo)); 8843 geometry.RelEllipticalArcTo = RelEllipticalArcTo; 8844 RelEllipticalArcTo["__class"] = "com.mxgraph.io.vsdx.geometry.RelEllipticalArcTo"; 8845 })(geometry = vsdx.geometry || (vsdx.geometry = {})); 8846 })(vsdx = io.vsdx || (io.vsdx = {})); 8847 })(io = mxgraph.io || (mxgraph.io = {})); 8848 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 8849})(com || (com = {})); 8850(function (com) { 8851 var mxgraph; 8852 (function (mxgraph) { 8853 var io; 8854 (function (io) { 8855 var vsdx; 8856 (function (vsdx) { 8857 var Shape = (function (_super) { 8858 __extends(Shape, _super); 8859 function Shape(shape, model) { 8860 //BUG in JSweet, fields default values and explicit assignments are not the same (defaults are before super() and assignments are after)! 8861 var _this = this; 8862 8863 _this.text = null; 8864 _this.fields = null; 8865 _this.geom = null; 8866 _this.imageData = null; 8867 _this.theme = null; 8868 _this.quickStyleVals = null; 8869 8870 _this = _super.call(this, shape, model) || this; 8871 8872 /** 8873 * List of paragraphs in this shape 8874 */ 8875 _this.paragraphs = null; 8876 /** 8877 * mxGraph cell style map 8878 */ 8879 _this.styleMap = ({}); 8880 /** 8881 * Width of shape 8882 */ 8883 _this.width = 0; 8884 /** 8885 * Height of shape 8886 */ 8887 _this.height = 0; 8888 /** 8889 * Cumulative rotation of shape, including parents 8890 */ 8891 _this.rotation = 0; 8892 _this.lastX = 0; 8893 _this.lastY = 0; 8894 _this.lastMoveX = 0; 8895 _this.lastMoveY = 0; 8896 _this.lastKnot = -1; 8897 _this.geomList = null; 8898 _this.geomListProcessed = false; 8899 _this.themeVariant = 0; 8900 /** 8901 * Last cp IX referenced in the Text Element. 8902 */ 8903 _this.cp = "0"; 8904 /** 8905 * Last pp IX referenced in the Text Element. 8906 */ 8907 _this.pp = "0"; 8908 /** 8909 * Last tp IX referenced in the Text Element. 8910 */ 8911 _this.tp = "0"; 8912 /** 8913 * Last fld IX referenced in the Text Element. 8914 */ 8915 _this.fld = "0"; 8916 8917 _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); 8918 _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); 8919 return _this; 8920 } 8921 Shape.UNICODE_LINE_SEP_$LI$ = function () 8922 { 8923 if (Shape.UNICODE_LINE_SEP == null) 8924 { 8925 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=="; 8926 Shape.UNICODE_LINE_SEP = String.fromCharCode(8232);//[String.fromCharCode(226), String.fromCharCode(128), String.fromCharCode(168)].join(''); 8927 } 8928 return Shape.UNICODE_LINE_SEP; 8929 }; 8930 ; 8931 Shape.prototype.setThemeAndVariant = function (theme, themeVariant) { 8932 this.theme = theme; 8933 this.themeVariant = themeVariant; 8934 }; 8935 Shape.prototype.getTheme = function () { 8936 if (this.theme != null) { 8937 this.theme.setVariant(this.themeVariant); 8938 } 8939 return this.theme; 8940 }; 8941 Shape.prototype.getQuickStyleVals = function () { 8942 return this.quickStyleVals; 8943 }; 8944 Shape.prototype.processGeomList = function (parentGeoList) { 8945 if (!this.geomListProcessed) { 8946 this.geomList = new com.mxgraph.io.vsdx.mxVsdxGeometryList(parentGeoList); 8947 if (this.geom != null) { 8948 for (var index156 = 0; index156 < this.geom.length; index156++) { 8949 var geoElem = this.geom[index156]; 8950 { 8951 this.geomList.addGeometry(geoElem); 8952 } 8953 } 8954 } 8955 this.geomListProcessed = true; 8956 } 8957 }; 8958 /** 8959 * Caches the specified element 8960 * @param {*} elem the element to cache 8961 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 8962 */ 8963 Shape.prototype.parseShapeElem = function (elem, model) { 8964 _super.prototype.parseShapeElem.call(this, elem, model); 8965 var childName = elem.nodeName; 8966 if ((function (o1, o2) { if (o1 && o1.equals) { 8967 return o1.equals(o2); 8968 } 8969 else { 8970 return o1 === o2; 8971 } })(childName, "ForeignData")) 8972 { 8973 function getForeignRel(elem, filename) 8974 { 8975 var fdChild = elem.firstChild; 8976 8977 while (fdChild != null) 8978 { 8979 if (fdChild.nodeType == 1) 8980 { 8981 var fdElem = fdChild; 8982 var grandchildName = fdElem.nodeName; 8983 8984 if (grandchildName.toLowerCase() == "rel") 8985 { 8986 var rid = fdElem.getAttribute("r:id"); 8987 8988 if (rid != null && !(rid.length === 0)) 8989 { 8990 var index = filename.lastIndexOf('/'); 8991 var pre = ""; 8992 var post = ""; 8993 8994 try 8995 { 8996 pre = filename.substring(0, index); 8997 post = filename.substring(index, filename.length); 8998 } 8999 catch (e) 9000 { 9001 return; 9002 } 9003 9004 var relElem = model.getRelationship(rid, pre + "/_rels" + post + ".rels"); 9005 9006 if (relElem != null) 9007 { 9008 var target = relElem.getAttribute("Target") || ""; 9009 var type = relElem.getAttribute("Type"); 9010 index = target.lastIndexOf('/'); 9011 9012 try 9013 { 9014 target = target.substring(index + 1, target.length); 9015 } 9016 catch (e) 9017 { 9018 return; 9019 } 9020 9021 return {type: type, target: target}; 9022 } 9023 9024 return; 9025 } 9026 } 9027 } 9028 fdChild = fdChild.nextSibling; 9029 } 9030 } 9031 9032 var filename = elem.ownerDocument.vsdxFileName; //was getDocumentURI() 9033 var iType = elem.getAttribute("ForeignType"); 9034 var compression = elem.getAttribute("CompressionType") || ""; 9035 var typeTarget = null; 9036 9037 if ((function (o1, o2) { if (o1 && o1.equals) { 9038 return o1.equals(o2); 9039 } 9040 else { 9041 return o1 === o2; 9042 } })(iType, "Bitmap")) { 9043 compression = compression.toLowerCase(); 9044 } 9045 else if ((function (o1, o2) { if (o1 && o1.equals) { 9046 return o1.equals(o2); 9047 } 9048 else { 9049 return o1 === o2; 9050 } })(iType, "MetaFile")) { 9051 compression = "png"; //we convert emf files to png 9052 } 9053 else if ((function (o1, o2) { if (o1 && o1.equals) { 9054 return o1.equals(o2); 9055 } 9056 else { 9057 return o1 === o2; 9058 } })(iType, "Enhanced Metafile") || (function (o1, o2) { if (o1 && o1.equals) { 9059 return o1.equals(o2); 9060 } 9061 else { 9062 return o1 === o2; 9063 } })(iType, "EnhMetaFile")) { 9064 compression = "png"; //we convert emf files to png 9065 } 9066 else if (iType == "Object") //This is a very basic support for embedded visio objects by looking for associated image 9067 { 9068 typeTarget = getForeignRel(elem, filename); 9069 9070 if (typeTarget.type.indexOf('/oleObject') > 0) 9071 { 9072 var relElem = model.getRelationship("rId1", "visio/embeddings/_rels/" + typeTarget.target + ".rels"); 9073 9074 if (relElem != null) 9075 { 9076 var target = relElem.getAttribute("Target"); 9077 var type = relElem.getAttribute("Type"); 9078 9079 try 9080 { 9081 var index = target.lastIndexOf('/'); 9082 target = target.substring(index + 1, target.length); 9083 } 9084 catch (e) 9085 { 9086 return; 9087 } 9088 9089 compression = "png"; 9090 typeTarget = {type: type, target: target}; 9091 } 9092 else 9093 { 9094 return; 9095 } 9096 } 9097 } 9098 else { 9099 return; 9100 } 9101 9102 if (typeTarget == null) 9103 { 9104 typeTarget = getForeignRel(elem, filename); 9105 } 9106 9107 var type = typeTarget.type, target = typeTarget.target; 9108 9109 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")) 9110 { 9111 this.imageData = ({}); 9112 var iData = model.getMedia(com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder + "/media/" + target); 9113 if (!iData) 9114 { 9115 /* put */ (this.imageData["iData"] = Shape.ERROR_IMAGE); 9116 /* put */ (this.imageData["iType"] = 'svg+xml'); 9117 } 9118 else 9119 { 9120 /* put */ (this.imageData["iData"] = iData); 9121 if ((function (str, searchString) { var pos = str.length - searchString.length; var lastIndex = str.indexOf(searchString, pos); return lastIndex !== -1 && lastIndex === pos; })(target.toLowerCase(), ".bmp")) { 9122 compression = "jpg"; 9123 } 9124 /* put */ (this.imageData["iType"] = compression); 9125 } 9126 } 9127 } 9128 else if ((function (o1, o2) { if (o1 && o1.equals) { 9129 return o1.equals(o2); 9130 } 9131 else { 9132 return o1 === o2; 9133 } })(childName, com.mxgraph.io.vsdx.mxVsdxConstants.TEXT)) { 9134 this.text = elem; 9135 } 9136 }; 9137 /** 9138 * Caches the specific section element 9139 * @param {*} elem the element to cache 9140 */ 9141 Shape.prototype.parseSection = function (elem) { 9142 var n = elem.getAttribute("N"); 9143 if ((function (o1, o2) { if (o1 && o1.equals) { 9144 return o1.equals(o2); 9145 } 9146 else { 9147 return o1 === o2; 9148 } })(n, "Geometry")) { 9149 if (this.geom == null) { 9150 this.geom = ([]); 9151 } 9152 /* add */ (this.geom.push(elem)); 9153 } 9154 else if ((function (o1, o2) { if (o1 && o1.equals) { 9155 return o1.equals(o2); 9156 } 9157 else { 9158 return o1 === o2; 9159 } })(n, "Field")) { 9160 var rows = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(elem, "Row"); 9161 for (var index157 = 0; index157 < rows.length; index157++) { 9162 var row = rows[index157]; 9163 { 9164 var ix = row.getAttribute("IX") || ""; 9165 if (!(ix.length === 0)) { 9166 if (this.fields == null) { 9167 this.fields = ({}); 9168 } 9169 var del = row.getAttribute("Del"); 9170 if ((function (o1, o2) { if (o1 && o1.equals) { 9171 return o1.equals(o2); 9172 } 9173 else { 9174 return o1 === o2; 9175 } })("1", del)) { 9176 /* put */ (this.fields[ix] = ""); 9177 continue; 9178 } 9179 var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(row, "Cell"); 9180 var value = ""; 9181 var format = ""; 9182 var calendar = ""; 9183 var type = ""; 9184 for (var index158 = 0; index158 < cells.length; index158++) { 9185 var cell = cells[index158]; 9186 { 9187 n = cell.getAttribute("N"); 9188 var v = cell.getAttribute("V") || cell.textContent || ""; 9189 switch ((n)) { 9190 case "Value": 9191 value = v; 9192 break; 9193 case "Format": 9194 format = v; 9195 break; 9196 case "Calendar": 9197 calendar = v; 9198 break; 9199 case "Type": 9200 type = v; 9201 break; 9202 } 9203 } 9204 } 9205 if (!(value.length === 0)) { 9206 try { 9207 //Date can be in string date format or a number 9208 var date = isNaN(value)? new Date(value) : new Date(Shape.VSDX_START_TIME + Math.floor((parseFloat(value) * 24 * 60 * 60 * 1000))); 9209 9210 if (format == 'c') 9211 { 9212 if (date.getHours() + date.getMinutes() + date.getSeconds() + date.getMilliseconds() == 0) 9213 { 9214 format = 'm/d/yyyy'; 9215 } 9216 else 9217 { 9218 format = 'm/d/yyyy h:MM:ss tt'; 9219 } 9220 } 9221 else if (format == 'ddddd') 9222 { 9223 format = 'm/d/yyyy'; 9224 } 9225 else if (format == 'dddddd') 9226 { 9227 format = 'dddd, mmmm dd, yyyy'; 9228 } 9229 else if (format == 'C') 9230 { 9231 format = 'dddd, mmmm dd, yyyy h:MM:ss tt'; 9232 } 9233 else if (format == 'T') 9234 { 9235 format = 'h:MM:ss tt'; 9236 } 9237 else 9238 { 9239 //Our date format function swaps M/m meaning 9240 format = format.replace(/am\/pm/g, 'tt').replace(/m/g, '@').replace(/M/g, 'm').replace(/@/g, 'M'); 9241 } 9242 9243 value = Graph.prototype.formatDate(date, /* replaceAll */ 'UTC:' + format.replace(new RegExp("\\{|\\}", 'g'), "")); 9244 } 9245 catch (e) { 9246 } 9247 ; 9248 /* put */ (this.fields[ix] = value); 9249 } 9250 } 9251 } 9252 } 9253 } 9254 else { 9255 _super.prototype.parseSection.call(this, elem); 9256 } 9257 }; 9258 /** 9259 * 9260 * @return {string} mxGraph stencil XML or null or there is no displayed geometry 9261 */ 9262 Shape.prototype.parseGeom = function () { 9263 if (!this.hasGeomList()) { 9264 return ""; 9265 } 9266 return this.geomList.getShapeXML(this); 9267 }; 9268 /** 9269 * Returns the value of the Text element. 9270 * @return {string} Value of the Text element. 9271 */ 9272 Shape.prototype.getText = function () { 9273 return this.text != null ? this.text.textContent : null; 9274 }; 9275 /** 9276 * Returns the children Nodes of Text. 9277 * @return {*} List with the children of the Text element. 9278 */ 9279 Shape.prototype.getTextChildren = function () { 9280 return this.text != null ? this.text.childNodes : null; 9281 }; 9282 /** 9283 * Returns the value of the width element in pixels. 9284 * @return {number} Numerical value of the width element. 9285 */ 9286 Shape.prototype.getWidth = function () { 9287 return this.width === 0 && this.height > 0 ? 1 : this.width; 9288 }; 9289 /** 9290 * Returns the value of the height element in pixels. 9291 * @return {number} Numerical value of the height element. 9292 */ 9293 Shape.prototype.getHeight = function () { 9294 return this.height === 0 && this.width > 0 ? 1 : this.height; 9295 }; 9296 /** 9297 * Returns the value of the rotation. 9298 * @return {number} Numerical value of the rotation 9299 */ 9300 Shape.prototype.getRotation = function () { 9301 return this.rotation; 9302 }; 9303 /** 9304 * Returns the style map of this shape 9305 * @return {*} the style map 9306 */ 9307 Shape.prototype.getStyleMap = function () { 9308 return this.styleMap; 9309 }; 9310 /** 9311 * Returns whether or not this shape has a geometry defined, locally 9312 * or inherited 9313 * @return {boolean} whether the shape has a geometry 9314 */ 9315 Shape.prototype.hasGeom = function () { 9316 return !(this.geom == null || (this.geom.length == 0)); 9317 }; 9318 /** 9319 * Returns whether or not this shape or its master has a geometry defined 9320 * @return {boolean} whether the shape has a geometry 9321 */ 9322 Shape.prototype.hasGeomList = function () { 9323 return this.geomList != null && this.geomList.hasGeom(); 9324 }; 9325 9326 /** 9327 * Check if the paragraph is a list and return the list with its style 9328 * @param {string} pp Reference to a Para element 9329 * @return {string} the opening tag of the list with style or null if no list is found 9330 */ 9331 Shape.prototype.getPPList = function (pp) 9332 { 9333 var ul = null; 9334 9335 if (pp != '') 9336 { 9337 var bullet = this.getBullet(pp); 9338 9339 if (bullet != '0') 9340 { 9341 ul = '<ul style="margin: 0;list-style-type: ' + (bullet == '4'? 'square' : 'disc') + '">'; 9342 } 9343 } 9344 9345 return ul; 9346 }; 9347 9348 /** 9349 * Returns the paragraph formated according the properties in the last 9350 * Para element referenced. 9351 * @param {string} para Paragraph to be formated 9352 * @return {string} Formated paragraph. 9353 */ 9354 Shape.prototype.getTextParagraphFormated = function (para) { 9355 var ret = ""; 9356 var styleMap = ({}); 9357 /* put */ (styleMap["align"] = this.getHorizontalAlign(this.pp, true)); 9358 /* put */ (styleMap["margin-left"] = this.getIndentLeft(this.pp)); 9359 /* put */ (styleMap["margin-right"] = this.getIndentRight(this.pp)); 9360 /* put */ (styleMap["margin-top"] = this.getSpBefore(this.pp) + "px"); 9361 /* put */ (styleMap["margin-bottom"] = this.getSpAfter(this.pp) + "px"); 9362 /* put */ (styleMap["text-indent"] = this.getIndentFirst(this.pp)); 9363 /* put */ (styleMap["valign"] = this.getAlignVertical()); 9364 /* put */ (styleMap["direction"] = this.getTextDirection(this.pp)); 9365 ret += this.insertAttributes(para, styleMap); 9366 return ret; 9367 }; 9368 /** 9369 * Returns the text formated according the properties in the last 9370 * Char element referenced. 9371 * @param {string} text Text to be formated 9372 * @return {string} Formated text. 9373 */ 9374 Shape.prototype.getTextCharFormated = function (text) { 9375 var ret = ""; 9376 var color = "color:" + this.getTextColor(this.cp) + ";"; 9377 var size = "font-size:" + (parseFloat(this.getTextSize(this.cp))) + "px;"; 9378 var font = "font-family:" + this.getTextFont(this.cp) + ";"; 9379 var direction = "direction:" + this.getRtlText(this.cp) + ";"; 9380 var space = "letter-spacing:" + (parseFloat(this.getLetterSpace(this.cp)) / 0.71) + "px;"; 9381 var lineHeight = "line-height:" + this.getSpcLine(this.pp); 9382 var opacity = ";opacity:" + this.getTextOpacity(this.cp); 9383 var pos = this.getTextPos(this.cp); 9384 var tCase = this.getTextCase(this.cp); 9385 if ((function (o1, o2) { if (o1 && o1.equals) { 9386 return o1.equals(o2); 9387 } 9388 else { 9389 return o1 === o2; 9390 } })(tCase, "1")) { 9391 text = text.toUpperCase(); 9392 } 9393 else if ((function (o1, o2) { if (o1 && o1.equals) { 9394 return o1.equals(o2); 9395 } 9396 else { 9397 return o1 === o2; 9398 } })(tCase, "2")) { 9399 text = com.mxgraph.io.vsdx.mxVsdxUtils.toInitialCapital(text); 9400 } 9401 if ((function (o1, o2) { if (o1 && o1.equals) { 9402 return o1.equals(o2); 9403 } 9404 else { 9405 return o1 === o2; 9406 } })(pos, "1")) { 9407 text = com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "sup"); 9408 } 9409 else if ((function (o1, o2) { if (o1 && o1.equals) { 9410 return o1.equals(o2); 9411 } 9412 else { 9413 return o1 === o2; 9414 } })(pos, "2")) { 9415 text = com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "sub"); 9416 } 9417 text = this.isBold(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "b") : text; 9418 text = this.isItalic(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "i") : text; 9419 text = this.isUnderline(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "u") : text; 9420 text = this.getTextStrike(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(text, "s") : text; 9421 text = this.isSmallCaps(this.cp) ? com.mxgraph.io.vsdx.mxVsdxUtils.toSmallCaps(text, this.getTextSize(this.cp)) : text; 9422 ret += "<font style=\"" + size + font + color + direction + space + lineHeight + opacity + "\">" + text + "</font>"; 9423 return ret; 9424 }; 9425 /** 9426 * Returns the direction of the text. It may be right to left or left to right.<br/> 9427 * This property may to be founded in the shape, master shape, stylesheet or 9428 * default style-sheet. 9429 * @param {string} index Index of the Para element that contains the Flags element. 9430 * @return {string} The direction of the text. 9431 */ 9432 Shape.prototype.getTextDirection = function (index) { 9433 var direction = this.getFlags(index); 9434 if ((function (o1, o2) { if (o1 && o1.equals) { 9435 return o1.equals(o2); 9436 } 9437 else { 9438 return o1 === o2; 9439 } })(direction, "0")) { 9440 direction = "ltr"; 9441 } 9442 else if ((function (o1, o2) { if (o1 && o1.equals) { 9443 return o1.equals(o2); 9444 } 9445 else { 9446 return o1 === o2; 9447 } })(direction, "1")) { 9448 direction = "rtl"; 9449 } 9450 return direction; 9451 }; 9452 /** 9453 * Returns the space between lines in a paragraph.<br/> 9454 * This property may to be founded in the shape, master shape, stylesheet or 9455 * default style-sheet. 9456 * @param {string} index Index of the Para element that contains the SpLine element. 9457 * @return {string} The space between lines n pixels. 9458 */ 9459 Shape.prototype.getSpcLine = function (index) { 9460 var ret = "0"; 9461 var isPercent = false; 9462 var space = this.getSpLine(index); 9463 if (space > 0) { 9464 space = space * com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 9465 } 9466 else if (space === 0) { 9467 space = 100; 9468 isPercent = true; 9469 } 9470 else { 9471 space = Math.abs(space) * 100; 9472 isPercent = true; 9473 } 9474 ret = new String(space).toString(); 9475 ret += isPercent ? "%" : "px"; 9476 return ret; 9477 }; 9478 /** 9479 * Returns the space before a paragraph.<br/> 9480 * This property may to be founded in the shape, master shape, stylesheet or 9481 * default style-sheet. 9482 * @param {string} index Index of the Para element that contains the SpBefore element. 9483 * @return {string} The space before the paragraph in pixels. 9484 */ 9485 Shape.prototype.getSpcBefore = function (index) { 9486 return this.getSpBefore(index); 9487 }; 9488 /** 9489 * Inserts the style attributes contained in attr into the text.<br/> 9490 * The text must be surrounded by tags html. 9491 * @param {string} text Text where the attributes must be inserted. 9492 * @param {*} attr Map with the attributes. 9493 * @return {string} Text with the attributes applied like style. 9494 */ 9495 Shape.prototype.insertAttributes = function (text, attr) { 9496 if (text.indexOf(">") != -1) { 9497 var i = text.indexOf(">"); 9498 var tail = text.substring(i); 9499 var head = text.substring(0, i); 9500 var style = " style=\"" + com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(attr, ":") + "\""; 9501 return head + style + tail; 9502 } 9503 return text; 9504 }; 9505 /** 9506 * Returns the direction of the text. It may be right to left or left to right.<br/> 9507 * This property may to be founded in the shape, master shape, stylesheet or 9508 * default stylesheet. 9509 * @param {string} index Index of the Char element that contains the RTLText element. 9510 * @return {string} Direction of the text. 9511 */ 9512 Shape.prototype.getRtlText = function (index) { 9513 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); 9514 var direction = this.getValue(rtlElem, "ltr"); 9515 if ((function (o1, o2) { if (o1 && o1.equals) { 9516 return o1.equals(o2); 9517 } 9518 else { 9519 return o1 === o2; 9520 } })(direction, "0")) { 9521 direction = "ltr"; 9522 } 9523 else if ((function (o1, o2) { if (o1 && o1.equals) { 9524 return o1.equals(o2); 9525 } 9526 else { 9527 return o1 === o2; 9528 } })(direction, "1")) { 9529 direction = "rtl"; 9530 } 9531 return direction; 9532 }; 9533 /** 9534 * Checks if the style property of the Char element of index = 'index' 9535 * indicates bold.<br/> 9536 * This property may to be founded in the shape, master shape, stylesheet or 9537 * default stylesheet. 9538 * @param {string} index Index of the Char element that contains the Style element. 9539 * @return {boolean} Returns <code>true</code> if the style property of the Char element of 9540 * index = 'index' indicates bold. 9541 */ 9542 Shape.prototype.isBold = function (index) { 9543 var isBold = false; 9544 var style = this.getTextStyle(index); 9545 if (!(function (o1, o2) { if (o1 && o1.equals) { 9546 return o1.equals(o2); 9547 } 9548 else { 9549 return o1 === o2; 9550 } })(style, "")) { 9551 if ((function (o1, o2) { if (o1 && o1.equals) { 9552 return o1.equals(o2); 9553 } 9554 else { 9555 return o1 === o2; 9556 } })(style.toLowerCase(), "themed")) { 9557 } 9558 else { 9559 var value = parseInt(style); 9560 isBold = ((value & 1) === 1); 9561 } 9562 } 9563 return isBold; 9564 }; 9565 /** 9566 * Checks if the style property of the Char element of index = 'index' 9567 * indicates italic.<br/> 9568 * This property may to be founded in the shape, master shape, stylesheet or 9569 * default stylesheet. 9570 * @param {string} index Index of the Char element that contains the Style element. 9571 * @return {boolean} Returns <code>true</code> if the style property of the Char element of 9572 * index = 'index' indicates italic. 9573 */ 9574 Shape.prototype.isItalic = function (index) { 9575 var isItalic = false; 9576 var style = this.getTextStyle(index); 9577 if (!(function (o1, o2) { if (o1 && o1.equals) { 9578 return o1.equals(o2); 9579 } 9580 else { 9581 return o1 === o2; 9582 } })(style, "")) { 9583 if ((function (o1, o2) { if (o1 && o1.equals) { 9584 return o1.equals(o2); 9585 } 9586 else { 9587 return o1 === o2; 9588 } })(style.toLowerCase(), "themed")) { 9589 } 9590 else { 9591 var value = parseInt(style); 9592 isItalic = ((value & 2) === 2); 9593 } 9594 } 9595 return isItalic; 9596 }; 9597 /** 9598 * Checks if the style property of the Char element of index = 'index' 9599 * indicates underline.<br/> 9600 * This property may to be founded in the shape, master shape, stylesheet or 9601 * default stylesheet. 9602 * @param {string} index Index of the Char element that contains the Style element. 9603 * @return {boolean} Returns <code>true</code> if the style property of the Char element of 9604 * index = 'index' indicates underline. 9605 */ 9606 Shape.prototype.isUnderline = function (index) { 9607 var isUnderline = false; 9608 var style = this.getTextStyle(index); 9609 if (!(function (o1, o2) { if (o1 && o1.equals) { 9610 return o1.equals(o2); 9611 } 9612 else { 9613 return o1 === o2; 9614 } })(style, "")) { 9615 if ((function (o1, o2) { if (o1 && o1.equals) { 9616 return o1.equals(o2); 9617 } 9618 else { 9619 return o1 === o2; 9620 } })(style.toLowerCase(), "themed")) { 9621 } 9622 else { 9623 var value = parseInt(style); 9624 isUnderline = ((value & 4) === 4); 9625 } 9626 } 9627 return isUnderline; 9628 }; 9629 /** 9630 * Checks if the style property of the Char element of index = 'index' 9631 * indicates small caps.<br/> 9632 * This property may to be founded in the shape, master shape, stylesheet or 9633 * default stylesheet. 9634 * @param {string} index Index of the Char element that contains the Style element. 9635 * @return {boolean} Returns <code>true</code> if the style property of the Char element of 9636 * index = 'index' indicates small caps. 9637 */ 9638 Shape.prototype.isSmallCaps = function (index) { 9639 var isSmallCaps = false; 9640 var style = this.getTextStyle(index); 9641 if (!(function (o1, o2) { if (o1 && o1.equals) { 9642 return o1.equals(o2); 9643 } 9644 else { 9645 return o1 === o2; 9646 } })(style, "")) { 9647 if ((function (o1, o2) { if (o1 && o1.equals) { 9648 return o1.equals(o2); 9649 } 9650 else { 9651 return o1 === o2; 9652 } })(style.toLowerCase(), "themed")) { 9653 } 9654 else { 9655 var value = parseInt(style); 9656 isSmallCaps = ((value & 8) === 8); 9657 } 9658 } 9659 return isSmallCaps; 9660 }; 9661 Shape.prototype.getTextOpacity = function (index) { 9662 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); 9663 var trans = this.getValue(colorTrans, "0"); 9664 var result = "1"; 9665 if (trans != null && !(trans.length === 0)) { 9666 var tmp = 1.0 - parseFloat(trans); 9667 result = new String(tmp).toString(); 9668 } 9669 return result; 9670 }; 9671 /** 9672 * Returns the actual text size defined by the Char element referenced in cp.<br/> 9673 * This property may to be founded in the shape, master shape, stylesheet or 9674 * default stylesheet. 9675 * @param {string} index Index of the Char element that contains the Size element. 9676 * @return {string} Returns the size of the font in pixels. 9677 */ 9678 Shape.prototype.getTextSize = function (index) { 9679 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); 9680 var size = this.getScreenNumericalValue$org_w3c_dom_Element$double(sizeElem, 12); 9681 return ('' + (Math.floor(Math.round(size * 100) / 100))); 9682 }; 9683 /** 9684 * Returns the vertical align of the label.<br/> 9685 * The property may to be defined in master shape or text stylesheet.<br/> 9686 * @return {string} Vertical align (bottom, middle and top) 9687 */ 9688 Shape.prototype.getAlignVertical = function () { 9689 var vertical = mxConstants.ALIGN_MIDDLE; 9690 var align = parseInt(this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.VERTICAL_ALIGN), "1")); 9691 if (align === 0) { 9692 vertical = mxConstants.ALIGN_TOP; 9693 } 9694 else if (align === 2) { 9695 vertical = mxConstants.ALIGN_BOTTOM; 9696 } 9697 return vertical; 9698 }; 9699 Shape.prototype.getGeomList = function () { 9700 return this.geomList; 9701 }; 9702 Shape.prototype.getLastX = function () { 9703 return this.lastX; 9704 }; 9705 Shape.prototype.getLastY = function () { 9706 return this.lastY; 9707 }; 9708 Shape.prototype.getLastMoveX = function () { 9709 return this.lastMoveX; 9710 }; 9711 Shape.prototype.getLastMoveY = function () { 9712 return this.lastMoveY; 9713 }; 9714 Shape.prototype.getLastKnot = function () { 9715 return this.lastKnot; 9716 }; 9717 Shape.prototype.setLastX = function (lastX) { 9718 this.lastX = lastX; 9719 }; 9720 Shape.prototype.setLastY = function (lastY) { 9721 this.lastY = lastY; 9722 }; 9723 Shape.prototype.setLastMoveX = function (lastMoveX) { 9724 this.lastMoveX = lastMoveX; 9725 }; 9726 Shape.prototype.setLastMoveY = function (lastMoveY) { 9727 this.lastMoveY = lastMoveY; 9728 }; 9729 Shape.prototype.setLastKnot = function (lastKnot) { 9730 this.lastKnot = lastKnot; 9731 }; 9732 return Shape; 9733 }(com.mxgraph.io.vsdx.Style)); 9734 Shape.VSDX_START_TIME = new Date('1899-12-30T00:00:00Z').getTime(); 9735 vsdx.Shape = Shape; 9736 Shape["__class"] = "com.mxgraph.io.vsdx.Shape"; 9737 })(vsdx = io.vsdx || (io.vsdx = {})); 9738 })(io = mxgraph.io || (mxgraph.io = {})); 9739 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 9740})(com || (com = {})); 9741(function (com) { 9742 var mxgraph; 9743 (function (mxgraph) { 9744 var io; 9745 (function (io) { 9746 var vsdx; 9747 (function (vsdx) { 9748 /** 9749 * Create a new instance of mxVdxShape. 9750 * This method get the references to the master element, master shape 9751 * and stylesheet. 9752 * @param {*} shape 9753 * @param {com.mxgraph.io.vsdx.mxVsdxPage} page 9754 * @param {boolean} vertex 9755 * @param {*} masters 9756 * @param {com.mxgraph.io.vsdx.mxVsdxMaster} master 9757 * @param {com.mxgraph.io.vsdx.mxVsdxModel} model 9758 * @class 9759 * @extends com.mxgraph.io.vsdx.Shape 9760 */ 9761 var VsdxShape = (function (_super) { 9762 __extends(VsdxShape, _super); 9763 function VsdxShape(page, shape, vertex, masters, master, model) { 9764 //BUG in JSweet, fields default values and explicit assignments are not the same (defaults are before super() and assignments are after)! 9765 var _this = this; 9766 9767 _this.masterShape = null; 9768 _this.master = null; 9769 _this.parentHeight = 0; 9770 9771 _this = _super.call(this, shape, model) || this; 9772 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 9795 9796 var masterId = _this.getMasterId(); 9797 var masterShapeLocal = _this.getShapeMasterId(); 9798 if (masterId != null) { 9799 _this.master = (function (m, k) { return m[k] ? m[k] : null; })(masters, masterId); 9800 } 9801 else { 9802 _this.master = master; 9803 } 9804 if (_this.master != null) { 9805 if (masterId == null && masterShapeLocal != null) { 9806 _this.masterShape = _this.master.getSubShape(masterShapeLocal); 9807 } 9808 else { 9809 _this.masterShape = _this.master.getMasterShape(); 9810 } 9811 } 9812 var name = _this.getNameU(); 9813 var index = name.lastIndexOf("."); 9814 if (index !== -1) { 9815 name = name.substring(0, index); 9816 } 9817 _this.shapeName = name; 9818 var shapesList = shape.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.SHAPES); 9819 if (shapesList != null && shapesList.length > 0) { 9820 var shapesElement = shapesList.item(0); 9821 _this.childShapes = page.parseShapes(shapesElement, _this.master, false); 9822 } 9823 var rotation = _this.calcRotation(); 9824 _this.rotation = rotation * 100 / 100; 9825 _this.rotation = _this.rotation % 360.0; 9826 var themeIndex = page.getCellIntValue("ThemeIndex", -100); 9827 if (themeIndex === -100) { 9828 themeIndex = parseInt(_this.getValue(_this.getCellElement$java_lang_String("ThemeIndex"), "0")); 9829 } 9830 var theme = (function (m, k) { if (m.entries == null) 9831 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9832 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9833 return m.entries[i].value; 9834 } return null; })(model.getThemes(), themeIndex); 9835 var variant = page.getCellIntValue("VariationColorIndex", 0); 9836 _this.setThemeAndVariant(theme, variant); 9837 { 9838 var array161 = (function (m) { if (m.entries == null) 9839 m.entries = []; return m.entries; })(_this.childShapes); 9840 for (var index160 = 0; index160 < array161.length; index160++) { 9841 var entry = array161[index160]; 9842 { 9843 var childShape = entry.getValue(); 9844 childShape.setRootShape(_this); 9845 if (childShape.theme == null) { 9846 childShape.setThemeAndVariant(theme, variant); 9847 } 9848 } 9849 } 9850 } 9851 _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"))); 9852 if (_this.masterShape != null) { 9853 _this.masterShape.processGeomList(null); 9854 _this.processGeomList(_this.masterShape.getGeomList()); 9855 if (_this.width === 0) 9856 _this.width = _this.getScreenNumericalValue$org_w3c_dom_Element$double(_this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.WIDTH), 0); 9857 if (_this.height === 0) 9858 _this.height = _this.getScreenNumericalValue$org_w3c_dom_Element$double(_this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.HEIGHT), 0); 9859 } 9860 else { 9861 _this.processGeomList(null); 9862 } 9863 _this.vertex = vertex || (_this.childShapes != null && !(function (m) { if (m.entries == null) 9864 m.entries = []; return m.entries.length == 0; })(_this.childShapes)) || (_this.geomList != null && (!_this.geomList.isNoFill() || _this.geomList.getGeoCount() > 1)); 9865 _this.layerMember = _this.getValue(_this.getCellElement$java_lang_String("LayerMember")); 9866 9867 //We don't have a cell belongs to multiple layers 9868 if (_this.layerMember && _this.layerMember.indexOf('0;') == 0) 9869 { 9870 _this.layerMember = _this.layerMember.substr(2); 9871 } 9872 9873 return _this; 9874 } 9875 VsdxShape.__static_initialize = function () { if (!VsdxShape.__static_initialized) { 9876 VsdxShape.__static_initialized = true; 9877 VsdxShape.__static_initializer_0(); 9878 } }; 9879 VsdxShape.OFFSET_ARRAY_$LI$ = function () { VsdxShape.__static_initialize(); if (VsdxShape.OFFSET_ARRAY == null) 9880 VsdxShape.OFFSET_ARRAY = (["Organizational unit", "Domain 3D"].slice(0).slice(0)); return VsdxShape.OFFSET_ARRAY; }; 9881 ; 9882 VsdxShape.arrowSizes_$LI$ = function () { VsdxShape.__static_initialize(); if (VsdxShape.arrowSizes == null) 9883 VsdxShape.arrowSizes = [2, 3, 5, 7, 9, 22, 45]; return VsdxShape.arrowSizes; }; 9884 ; 9885 VsdxShape.arrowTypes_$LI$ = function () { VsdxShape.__static_initialize(); return VsdxShape.arrowTypes; }; 9886 ; 9887 VsdxShape.__static_initializer_0 = function () { 9888// mxResources.add("/js/vsdx/resources/edgeNameU"); 9889// mxResources.add("/js/vsdx/resources/nameU"); 9890 VsdxShape.arrowTypes = ({}); 9891 /* put */ (function (m, k, v) { if (m.entries == null) 9892 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9893 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9894 m.entries[i].value = v; 9895 return; 9896 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 0, mxConstants.NONE); 9897 /* put */ (function (m, k, v) { if (m.entries == null) 9898 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9899 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9900 m.entries[i].value = v; 9901 return; 9902 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 1, mxConstants.ARROW_OPEN); 9903 /* put */ (function (m, k, v) { if (m.entries == null) 9904 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9905 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9906 m.entries[i].value = v; 9907 return; 9908 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 2, "blockThin"); 9909 /* put */ (function (m, k, v) { if (m.entries == null) 9910 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9911 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9912 m.entries[i].value = v; 9913 return; 9914 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 3, mxConstants.ARROW_OPEN); 9915 /* put */ (function (m, k, v) { if (m.entries == null) 9916 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9917 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9918 m.entries[i].value = v; 9919 return; 9920 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 4, mxConstants.ARROW_BLOCK); 9921 /* put */ (function (m, k, v) { if (m.entries == null) 9922 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9923 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9924 m.entries[i].value = v; 9925 return; 9926 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 5, mxConstants.ARROW_CLASSIC); 9927 /* put */ (function (m, k, v) { if (m.entries == null) 9928 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9929 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9930 m.entries[i].value = v; 9931 return; 9932 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 10, mxConstants.ARROW_OVAL); 9933 /* put */ (function (m, k, v) { if (m.entries == null) 9934 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9935 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9936 m.entries[i].value = v; 9937 return; 9938 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 13, mxConstants.ARROW_BLOCK); 9939 /* put */ (function (m, k, v) { if (m.entries == null) 9940 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9941 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9942 m.entries[i].value = v; 9943 return; 9944 } 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); 9945 /* put */ (function (m, k, v) { if (m.entries == null) 9946 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9947 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9948 m.entries[i].value = v; 9949 return; 9950 } 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); 9951 /* put */ (function (m, k, v) { if (m.entries == null) 9952 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9953 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9954 m.entries[i].value = v; 9955 return; 9956 } 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); 9957 /* put */ (function (m, k, v) { if (m.entries == null) 9958 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9959 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9960 m.entries[i].value = v; 9961 return; 9962 } 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"); 9963 /* put */ (function (m, k, v) { if (m.entries == null) 9964 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9965 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9966 m.entries[i].value = v; 9967 return; 9968 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 23, "dash"); 9969 /* put */ (function (m, k, v) { if (m.entries == null) 9970 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9971 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9972 m.entries[i].value = v; 9973 return; 9974 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 24, "ERone"); 9975 /* put */ (function (m, k, v) { if (m.entries == null) 9976 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9977 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9978 m.entries[i].value = v; 9979 return; 9980 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 25, "ERmandOne"); 9981 /* put */ (function (m, k, v) { if (m.entries == null) 9982 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9983 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9984 m.entries[i].value = v; 9985 return; 9986 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 27, "ERmany"); 9987 /* put */ (function (m, k, v) { if (m.entries == null) 9988 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9989 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9990 m.entries[i].value = v; 9991 return; 9992 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 28, "ERoneToMany"); 9993 /* put */ (function (m, k, v) { if (m.entries == null) 9994 m.entries = []; for (var i = 0; i < m.entries.length; i++) 9995 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 9996 m.entries[i].value = v; 9997 return; 9998 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 29, "ERzeroToMany"); 9999 /* put */ (function (m, k, v) { if (m.entries == null) 10000 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10001 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10002 m.entries[i].value = v; 10003 return; 10004 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 30, "ERzeroToOne"); 10005 /* put */ (function (m, k, v) { if (m.entries == null) 10006 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10007 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10008 m.entries[i].value = v; 10009 return; 10010 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 6, mxConstants.ARROW_BLOCK); 10011 /* put */ (function (m, k, v) { if (m.entries == null) 10012 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10013 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10014 m.entries[i].value = v; 10015 return; 10016 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 7, mxConstants.ARROW_OPEN); 10017 /* put */ (function (m, k, v) { if (m.entries == null) 10018 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10019 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10020 m.entries[i].value = v; 10021 return; 10022 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 8, mxConstants.ARROW_CLASSIC); 10023 /* put */ (function (m, k, v) { if (m.entries == null) 10024 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10025 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10026 m.entries[i].value = v; 10027 return; 10028 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 9, "openAsync"); 10029 /* put */ (function (m, k, v) { if (m.entries == null) 10030 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10031 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10032 m.entries[i].value = v; 10033 return; 10034 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 11, "diamond"); 10035 /* put */ (function (m, k, v) { if (m.entries == null) 10036 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10037 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10038 m.entries[i].value = v; 10039 return; 10040 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 12, mxConstants.ARROW_OPEN); 10041 /* put */ (function (m, k, v) { if (m.entries == null) 10042 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10043 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10044 m.entries[i].value = v; 10045 return; 10046 } 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); 10047 /* put */ (function (m, k, v) { if (m.entries == null) 10048 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10049 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10050 m.entries[i].value = v; 10051 return; 10052 } 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); 10053 /* put */ (function (m, k, v) { if (m.entries == null) 10054 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10055 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10056 m.entries[i].value = v; 10057 return; 10058 } 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); 10059 /* put */ (function (m, k, v) { if (m.entries == null) 10060 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10061 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10062 m.entries[i].value = v; 10063 return; 10064 } 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); 10065 /* put */ (function (m, k, v) { if (m.entries == null) 10066 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10067 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10068 m.entries[i].value = v; 10069 return; 10070 } 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"); 10071 /* put */ (function (m, k, v) { if (m.entries == null) 10072 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10073 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10074 m.entries[i].value = v; 10075 return; 10076 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 26, "ERmandOne"); 10077 /* put */ (function (m, k, v) { if (m.entries == null) 10078 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10079 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10080 m.entries[i].value = v; 10081 return; 10082 } 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); 10083 /* put */ (function (m, k, v) { if (m.entries == null) 10084 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10085 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10086 m.entries[i].value = v; 10087 return; 10088 } 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); 10089 /* put */ (function (m, k, v) { if (m.entries == null) 10090 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10091 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10092 m.entries[i].value = v; 10093 return; 10094 } 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); 10095 /* put */ (function (m, k, v) { if (m.entries == null) 10096 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10097 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10098 m.entries[i].value = v; 10099 return; 10100 } 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); 10101 /* put */ (function (m, k, v) { if (m.entries == null) 10102 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10103 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10104 m.entries[i].value = v; 10105 return; 10106 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 35, mxConstants.ARROW_OVAL); 10107 /* put */ (function (m, k, v) { if (m.entries == null) 10108 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10109 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10110 m.entries[i].value = v; 10111 return; 10112 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 36, mxConstants.ARROW_OVAL); 10113 /* put */ (function (m, k, v) { if (m.entries == null) 10114 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10115 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10116 m.entries[i].value = v; 10117 return; 10118 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 37, mxConstants.ARROW_OVAL); 10119 /* put */ (function (m, k, v) { if (m.entries == null) 10120 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10121 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10122 m.entries[i].value = v; 10123 return; 10124 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 38, mxConstants.ARROW_OVAL); 10125 /* put */ (function (m, k, v) { if (m.entries == null) 10126 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10127 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10128 m.entries[i].value = v; 10129 return; 10130 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 39, mxConstants.ARROW_BLOCK); 10131 /* put */ (function (m, k, v) { if (m.entries == null) 10132 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10133 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10134 m.entries[i].value = v; 10135 return; 10136 } 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); 10137 /* put */ (function (m, k, v) { if (m.entries == null) 10138 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10139 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10140 m.entries[i].value = v; 10141 return; 10142 } 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); 10143 /* put */ (function (m, k, v) { if (m.entries == null) 10144 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10145 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10146 m.entries[i].value = v; 10147 return; 10148 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 42, mxConstants.ARROW_OVAL); 10149 /* put */ (function (m, k, v) { if (m.entries == null) 10150 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10151 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10152 m.entries[i].value = v; 10153 return; 10154 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 43, mxConstants.ARROW_OPEN); 10155 /* put */ (function (m, k, v) { if (m.entries == null) 10156 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10157 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10158 m.entries[i].value = v; 10159 return; 10160 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 44, mxConstants.ARROW_OPEN); 10161 /* put */ (function (m, k, v) { if (m.entries == null) 10162 m.entries = []; for (var i = 0; i < m.entries.length; i++) 10163 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 10164 m.entries[i].value = v; 10165 return; 10166 } m.entries.push({ key: k, value: v, getKey: function () { return this.key; }, getValue: function () { return this.value; } }); })(VsdxShape.arrowTypes_$LI$(), 45, mxConstants.ARROW_OPEN); 10167 }; 10168 VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER_$LI$ = function () { VsdxShape.__static_initialize(); if (VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER == null) 10169 VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER = {}; return VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER; }; 10170 ; 10171 /** 10172 * Locates the first entry for the specified attribute string in the shape hierarchy. 10173 * The order is to look locally, then delegate the request to the master shape 10174 * if it doesn't exist locally 10175 * @param {string} key The key of the shape to find 10176 * @return {*} the Element that first resolves to that shape key or null or none is found 10177 */ 10178 VsdxShape.prototype.getShapeNode = function (key) { 10179 var elem = (function (m, k) { return m[k] ? m[k] : null; })(this.cellElements, key); 10180 if (elem == null && this.masterShape != null) { 10181 return this.masterShape.getCellElement$java_lang_String(key); 10182 } 10183 return elem; 10184 }; 10185 /** 10186 * Returns the value of the Text element.<br/> 10187 * If the shape has no text, it is obtained from the master shape. 10188 * @return {string} Text label of the shape. 10189 */ 10190 VsdxShape.prototype.getTextLabel = function () { 10191 var hideText = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.HIDE_TEXT), "0"); 10192 if ((function (o1, o2) { if (o1 && o1.equals) { 10193 return o1.equals(o2); 10194 } 10195 else { 10196 return o1 === o2; 10197 } })("1", hideText)) { 10198 return null; 10199 } 10200 var txtChildren = this.getTextChildren(); 10201 if (txtChildren == null && this.masterShape != null) { 10202 txtChildren = this.masterShape.getTextChildren(); 10203 } 10204 if (this.htmlLabels) { 10205 if (txtChildren != null) { 10206 /* put */ (this.styleMap[mxConstants.STYLE_VERTICAL_ALIGN] = this.getAlignVertical()); 10207 /* put */ (this.styleMap[mxConstants.STYLE_ALIGN] = this.getHorizontalAlign("0", false)); 10208 return this.getHtmlTextContent(txtChildren); 10209 } 10210 } 10211 else { 10212 var text = this.getText(); 10213 if (text == null && this.masterShape != null) { 10214 return this.masterShape.getText(); 10215 } 10216 else { 10217 return text; 10218 } 10219 } 10220 return null; 10221 }; 10222 /*private*/ VsdxShape.prototype.getIndex = function (elem) { 10223 var ix = elem.getAttribute("IX") || ""; 10224 return (ix.length === 0) ? "0" : ix; 10225 }; 10226 /** 10227 * Initialises the text labels 10228 * @param {*} children the text Elements 10229 */ 10230 VsdxShape.prototype.initLabels = function (children) { 10231 this.paragraphs = ({}); 10232 var ch = null; 10233 var pg = null; 10234 var fld = null; 10235 for (var index = 0; index < children.length; index++) { 10236 var value = null; 10237 var node = children.item(index); 10238 var nodeName = node.nodeName; 10239 switch ((nodeName)) { 10240 case "cp": 10241 { 10242 var elem = node; 10243 ch = this.getIndex(elem); 10244 } 10245 ; 10246 break; 10247 case "tp": 10248 { 10249 var elem = node; 10250 this.getIndex(elem); 10251 } 10252 ; 10253 break; 10254 case "pp": 10255 { 10256 var elem = node; 10257 pg = this.getIndex(elem); 10258 } 10259 ; 10260 break; 10261 case "fld": 10262 { 10263 var elem = node; 10264 fld = this.getIndex(elem); 10265 break; 10266 } 10267 ; 10268 case "#text": 10269 { 10270 value = node.textContent; 10271 var para = (function (m, k) { return m[k] ? m[k] : null; })(this.paragraphs, pg); 10272 if (para == null) { 10273 para = new com.mxgraph.io.vsdx.Paragraph(value, ch, pg, fld); 10274 /* put */ (this.paragraphs[pg] = para); 10275 } 10276 else { 10277 para.addText(value, ch, fld); 10278 } 10279 } 10280 ; 10281 } 10282 } 10283 ; 10284 }; 10285 /** 10286 * 10287 * @param {string} index 10288 * @return 10289 * @return {string} 10290 */ 10291 VsdxShape.prototype.createHybridLabel = function (index) { 10292 var para = (function (m, k) { return m[k] ? m[k] : null; })(this.paragraphs, index); 10293 /* put */ (this.styleMap[mxConstants.STYLE_ALIGN] = this.getHorizontalAlign(index, false)); 10294 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_LEFT] = this.getIndentLeft(index)); 10295 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_RIGHT] = this.getIndentRight(index)); 10296 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_TOP] = this.getSpBefore(index)); 10297 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_BOTTOM] = this.getSpAfter(index)); 10298 /* put */ (this.styleMap[mxConstants.STYLE_VERTICAL_ALIGN] = this.getAlignVertical()); 10299 /* put */ (this.styleMap["fontColor"] = this.getTextColor(index)); 10300 /* put */ (this.styleMap["fontSize"] = this.getTextSize(index)); 10301 /* put */ (this.styleMap["fontFamily"] = this.getTextFont(index)); 10302 var fontStyle = this.isBold(index) ? mxConstants.FONT_BOLD : 0; 10303 fontStyle |= this.isItalic(index) ? mxConstants.FONT_ITALIC : 0; 10304 fontStyle |= this.isUnderline(index) ? mxConstants.FONT_UNDERLINE : 0; 10305 /* put */ (this.styleMap["fontStyle"] = new String(fontStyle).toString()); 10306 var numValues = para.numValues(); 10307 var result = null; 10308 for (var i = 0; i < numValues; i++) { 10309 var value = para.getValue(i); 10310 if ((value.length === 0) && this.fields != null) { 10311 var fieldIx = para.getField(i); 10312 if (fieldIx != null) { 10313 value = (function (m, k) { return m[k] ? m[k] : null; })(this.fields, fieldIx); 10314 if (value == null && this.masterShape != null && this.masterShape.fields != null) { 10315 value = (function (m, k) { return m[k] ? m[k] : null; })(this.masterShape.fields, fieldIx); 10316 } 10317 } 10318 } 10319 if (value != null) { 10320 result = result == null ? value : result + value; 10321 } 10322 } 10323 ; 10324 return result; 10325 }; 10326 /** 10327 * Returns the text contained in the shape formated with tags html.<br/> 10328 * @return {string} Text content in html. 10329 * @param {*} txtChildren 10330 */ 10331 VsdxShape.prototype.getHtmlTextContent = function (txtChildren) { 10332 var ret = ""; 10333 var first = true; 10334 var ulMode = false; 10335 var ulModeFirst = false; 10336 10337 function processLblTxt(text) 10338 { 10339 text = com.mxgraph.io.vsdx.mxVsdxUtils.htmlEntities(text); 10340 10341 if (ulModeFirst) 10342 { 10343 text = '<li>' + text; 10344 ulModeFirst = false; 10345 } 10346 10347 if (ulMode) 10348 { 10349 var entries = text.split('\n'); 10350 10351 if (!entries[entries.length - 1]) 10352 { 10353 entries.pop(); 10354 ulModeFirst = true; 10355 } 10356 10357 text = entries.join('</li><li>'); 10358 } 10359 else 10360 { 10361 text = text.replace(new RegExp('\n', 'g'), '<br/>').replace(new RegExp(com.mxgraph.io.vsdx.Shape.UNICODE_LINE_SEP, 'g'), '<br/>'); 10362 } 10363 10364 return this.getTextCharFormated(text); 10365 }; 10366 10367 if (txtChildren != null && txtChildren.length > 0) { 10368 for (var index = 0; index < txtChildren.length; index++) { 10369 var node = txtChildren.item(index); 10370 if ((function (o1, o2) { if (o1 && o1.equals) { 10371 return o1.equals(o2); 10372 } 10373 else { 10374 return o1 === o2; 10375 } })(node.nodeName, "cp")) { 10376 var elem = node; 10377 this.cp = this.getIndex(elem); 10378 } 10379 else if ((function (o1, o2) { if (o1 && o1.equals) { 10380 return o1.equals(o2); 10381 } 10382 else { 10383 return o1 === o2; 10384 } })(node.nodeName, "tp")) { 10385 var elem = node; 10386 this.tp = this.getIndex(elem); 10387 } 10388 else if ((function (o1, o2) { if (o1 && o1.equals) { 10389 return o1.equals(o2); 10390 } 10391 else { 10392 return o1 === o2; 10393 } })(node.nodeName, "pp")) 10394 { 10395 var elem = node; 10396 this.pp = this.getIndex(elem); 10397 10398 if (ulMode) 10399 { 10400 //TODO closing li is wrongly placed after font (and other tags (e.g, b, i)) 10401 ret += '</li></ul>'; 10402 } 10403 10404 if (first) 10405 { 10406 first = false; 10407 } 10408 else 10409 { 10410 ret += "</p>"; 10411 } 10412 10413 var para = "<p>"; 10414 ret += this.getTextParagraphFormated(para); 10415 10416 var ul = this.getPPList(this.pp); 10417 10418 ulMode = ul != null; 10419 ulModeFirst = ulMode; 10420 ret += ulMode? ul : ''; 10421 } 10422 else if ((function (o1, o2) { if (o1 && o1.equals) { 10423 return o1.equals(o2); 10424 } 10425 else { 10426 return o1 === o2; 10427 } })(node.nodeName, "fld")) { 10428 var elem = node; 10429 this.fld = this.getIndex(elem); 10430 var text = null; 10431 if (this.fields != null) { 10432 text = (function (m, k) { return m[k] ? m[k] : null; })(this.fields, this.fld); 10433 } 10434 if (text == null && this.masterShape != null && this.masterShape.fields != null) { 10435 text = (function (m, k) { return m[k] ? m[k] : null; })(this.masterShape.fields, this.fld); 10436 } 10437 if (text != null) 10438 ret += processLblTxt.call(this, text); 10439 } 10440 else if ((function (o1, o2) { if (o1 && o1.equals) { 10441 return o1.equals(o2); 10442 } 10443 else { 10444 return o1 === o2; 10445 } })(node.nodeName, "#text")) { 10446 var text = node.textContent; 10447 ret += processLblTxt.call(this, text); 10448 } 10449 } 10450 } 10451 10452 if (ulMode) 10453 { 10454 //TODO closing li is wrongly placed after font (and other tags (e.g, b, i)) 10455 ret += '</li></ul>'; 10456 } 10457 10458 var end = first ? "" : "</p>"; 10459 ret += end; 10460 com.mxgraph.io.vsdx.mxVsdxUtils.surroundByTags(ret, "div"); 10461 return ret; 10462 }; 10463 10464 /** 10465 * Checks if a nameU is for big connectors. 10466 * @param {string} nameU NameU attribute. 10467 * @return {boolean} Returns <code>true</code> if a nameU is for big connectors. 10468 */ 10469 VsdxShape.prototype.isConnectorBigNameU = function (nameU) { 10470 return (function (str, searchString, position) { 10471 if (position === void 0) { position = 0; } 10472 return str.substr(position, searchString.length) === searchString; 10473 })(nameU, "60 degree single") || (function (str, searchString, position) { 10474 if (position === void 0) { position = 0; } 10475 return str.substr(position, searchString.length) === searchString; 10476 })(nameU, "45 degree single") || (function (str, searchString, position) { 10477 if (position === void 0) { position = 0; } 10478 return str.substr(position, searchString.length) === searchString; 10479 })(nameU, "45 degree double") || (function (str, searchString, position) { 10480 if (position === void 0) { position = 0; } 10481 return str.substr(position, searchString.length) === searchString; 10482 })(nameU, "60 degree double") || (function (str, searchString, position) { 10483 if (position === void 0) { position = 0; } 10484 return str.substr(position, searchString.length) === searchString; 10485 })(nameU, "45 degree tail") || (function (str, searchString, position) { 10486 if (position === void 0) { position = 0; } 10487 return str.substr(position, searchString.length) === searchString; 10488 })(nameU, "60 degree tail") || (function (str, searchString, position) { 10489 if (position === void 0) { position = 0; } 10490 return str.substr(position, searchString.length) === searchString; 10491 })(nameU, "45 degree tail") || (function (str, searchString, position) { 10492 if (position === void 0) { position = 0; } 10493 return str.substr(position, searchString.length) === searchString; 10494 })(nameU, "60 degree tail") || (function (str, searchString, position) { 10495 if (position === void 0) { position = 0; } 10496 return str.substr(position, searchString.length) === searchString; 10497 })(nameU, "Flexi-arrow 2") || (function (str, searchString, position) { 10498 if (position === void 0) { position = 0; } 10499 return str.substr(position, searchString.length) === searchString; 10500 })(nameU, "Flexi-arrow 1") || (function (str, searchString, position) { 10501 if (position === void 0) { position = 0; } 10502 return str.substr(position, searchString.length) === searchString; 10503 })(nameU, "Flexi-arrow 3") || (function (str, searchString, position) { 10504 if (position === void 0) { position = 0; } 10505 return str.substr(position, searchString.length) === searchString; 10506 })(nameU, "Double flexi-arrow") || (function (str, searchString, position) { 10507 if (position === void 0) { position = 0; } 10508 return str.substr(position, searchString.length) === searchString; 10509 })(nameU, "Fancy arrow"); 10510 }; 10511 /** 10512 * Checks if the shape represents a vertex. 10513 * @return {boolean} Returns <code>true</code> if the shape represents a vertex. 10514 */ 10515 VsdxShape.prototype.isVertex = function () { 10516 return this.vertex; 10517 }; 10518 /** 10519 * Returns the coordinates of the top left corner of the Shape. 10520 * When a coordinate is not found, it is taken from masterShape. 10521 * @param {number} parentHeight Height of the parent cell of the shape. 10522 * @param {boolean} rotation whether to allow for cell rotation 10523 * @return {mxPoint} mxPoint that represents the coordinates 10524 */ 10525 VsdxShape.prototype.getOriginPoint = function (parentHeight, rotation) { 10526 var px = this.getPinX(); 10527 var py = this.getPinY(); 10528 var lpy = this.getLocPinY(); 10529 var lpx = this.getLocPinX(); 10530 var w = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.WIDTH), 0); 10531 var h = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.HEIGHT), 0); 10532 var x = px - lpx; 10533 var y = parentHeight - ((py) + (h - lpy)); 10534 if (rotation && (lpy !== h / 2 || lpx !== w / 2)) { 10535 if (this.rotation !== 0) { 10536 var vecX = w / 2 - lpx; 10537 var vecY = lpy - h / 2; 10538 var cos = Math.cos(/* toRadians */ (function (x) { return x * Math.PI / 180; })(360 - this.rotation)); 10539 var sin = Math.sin(/* toRadians */ (function (x) { return x * Math.PI / 180; })(360 - this.rotation)); 10540 return new mxPoint(x + vecX - (vecX * cos - vecY * sin), (vecX * sin + vecY * cos) + y - vecY); 10541 } 10542 } 10543 return new mxPoint(x, y); 10544 }; 10545 /** 10546 * Returns the width and height of the Shape expressed like an mxPoint.<br/> 10547 * x = width<br/> 10548 * y = height<br/> 10549 * When a dimension is not found, it is taken from masterShape. 10550 * @return {mxPoint} mxPoint that represents the dimensions of the shape. 10551 */ 10552 VsdxShape.prototype.getDimensions = function () { 10553 var w = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.WIDTH), 0); 10554 var h = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.HEIGHT), 0); 10555 return new mxPoint(w === 0 && h > 0 ? 1 : w, h === 0 && w > 0 ? 1 : h); 10556 }; 10557 /** 10558 * Returns the value of the pinX element. 10559 * @return {number} The shape pinX element 10560 */ 10561 VsdxShape.prototype.getPinX = function () { 10562 return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.PIN_X), 0); 10563 }; 10564 /** 10565 * Returns the value of the pinY element in pixels. 10566 * @return {number} Numerical value of the pinY element. 10567 */ 10568 VsdxShape.prototype.getPinY = function () { 10569 return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.PIN_Y), 0); 10570 }; 10571 /** 10572 * Returns the value of the locPinX element in pixels. 10573 * @return {number} Numerical value of the pinY element. 10574 */ 10575 VsdxShape.prototype.getLocPinX = function () { 10576 return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.LOC_PIN_X), 0); 10577 }; 10578 /** 10579 * Returns the value of the locPinY element in pixels. 10580 * @return {number} Numerical value of the locPinY element. 10581 */ 10582 VsdxShape.prototype.getLocPinY = function () { 10583 return this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.LOC_PIN_Y), 0); 10584 }; 10585 /** 10586 * Returns the opacity of the Shape.<br/> 10587 * @return {number} Double in the range of (transparent = 0)..(100 = opaque) 10588 * @param {string} key 10589 * @private 10590 */ 10591 /*private*/ VsdxShape.prototype.getOpacity = function (key) { 10592 var opacity = 100; 10593 if (this.isGroup()) { 10594 opacity = 0; 10595 } 10596 opacity = this.getValueAsDouble(this.getCellElement$java_lang_String(key), 0); 10597 opacity = 100 - opacity * 100; 10598 opacity = Math.max(opacity, 0); 10599 opacity = Math.min(opacity, 100); 10600 return opacity; 10601 }; 10602 /** 10603 * Returns the background color for apply in the gradient.<br/> 10604 * If no gradient must be applicated, returns an empty string. 10605 * @return {string} hexadecimal representation of the color. 10606 * @private 10607 */ 10608 /*private*/ VsdxShape.prototype.getGradient = function () { 10609 var fillGradientEnabled = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_GRADIENT_ENABLED), "0"); 10610 if ((function (o1, o2) { if (o1 && o1.equals) { 10611 return o1.equals(o2); 10612 } 10613 else { 10614 return o1 === o2; 10615 } })("1", fillGradientEnabled)) { 10616 var fillGradient = (function (m, k) { return m[k] ? m[k] : null; })(this.sections, "FillGradient"); 10617 if (fillGradient != null) { 10618 var rows = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(fillGradient.elem, "Row"); 10619 var color = this.getColor(fillGradient.getIndexedCell(/* get */ rows[rows.length - 1].getAttribute("IX"), "GradientStopColor")); 10620 if (color != null && !(color.length === 0)) 10621 return color; 10622 } 10623 } 10624 var gradient = ""; 10625 var fillPattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_PATTERN), "0"); 10626 if (parseInt(fillPattern) >= 25) { 10627 gradient = this.getColor(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_BKGND)); 10628 } 10629 else { 10630 var theme_11 = this.getTheme(); 10631 if (theme_11 != null) { 10632 var gradColor = theme_11.getFillGraientColor(this.getQuickStyleVals()); 10633 if (gradColor != null) 10634 gradient = gradColor.toHexStr(); 10635 } 10636 } 10637 return gradient; 10638 }; 10639 /** 10640 * Returns the direction of the gradient.<br/> 10641 * If no gradient has to be applied, returns an empty string. 10642 * @return {string} Direction.(east, west, north or south) 10643 * @private 10644 */ 10645 /*private*/ VsdxShape.prototype.getGradientDirection = function () { 10646 var direction = ""; 10647 var fillPattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_PATTERN), "0"); 10648 if ((function (o1, o2) { if (o1 && o1.equals) { 10649 return o1.equals(o2); 10650 } 10651 else { 10652 return o1 === o2; 10653 } })(fillPattern, "25")) { 10654 direction = mxConstants.DIRECTION_EAST; 10655 } 10656 else if ((function (o1, o2) { if (o1 && o1.equals) { 10657 return o1.equals(o2); 10658 } 10659 else { 10660 return o1 === o2; 10661 } })(fillPattern, "27")) { 10662 direction = mxConstants.DIRECTION_WEST; 10663 } 10664 else if ((function (o1, o2) { if (o1 && o1.equals) { 10665 return o1.equals(o2); 10666 } 10667 else { 10668 return o1 === o2; 10669 } })(fillPattern, "28")) { 10670 direction = mxConstants.DIRECTION_SOUTH; 10671 } 10672 else if ((function (o1, o2) { if (o1 && o1.equals) { 10673 return o1.equals(o2); 10674 } 10675 else { 10676 return o1 === o2; 10677 } })(fillPattern, "30")) { 10678 direction = mxConstants.DIRECTION_NORTH; 10679 } 10680 return direction; 10681 }; 10682 /** 10683 * Returns the rotation of the shape.<br/> 10684 * @return {number} Rotation of the shape in degrees. 10685 */ 10686 VsdxShape.prototype.calcRotation = function () { 10687 var rotation = parseFloat(this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.ANGLE), "0")); 10688 rotation = (function (x) { return x * 180 / Math.PI; })(rotation); 10689 rotation = rotation % 360; 10690 rotation = rotation * 100 / 100; 10691 return 360 - rotation; 10692 }; 10693 /** 10694 * Used to pass in a parents rotation to the child 10695 * @param {number} parentRotation the rotation of the parent 10696 */ 10697 VsdxShape.prototype.propagateRotation = function (parentRotation) { 10698 this.rotation += parentRotation; 10699 this.rotation %= 360; 10700 this.rotation = this.rotation * 100 / 100; 10701 }; 10702 /** 10703 * Returns the top spacing of the label in pixels.<br/> 10704 * The property may to be defined in master shape or text stylesheet.<br/> 10705 * @return {number} Top spacing in double precision. 10706 */ 10707 VsdxShape.prototype.getTopSpacing = function () { 10708 var topMargin = this.getTextTopMargin(); 10709 topMargin = (topMargin / 2 - 2.8) * 100 / 100; 10710 return topMargin; 10711 }; 10712 /** 10713 * Returns the bottom spacing of the label in pixels.<br/> 10714 * The property may to be defined in master shape or text stylesheet.<br/> 10715 * @return {number} Bottom spacing in double precision. 10716 */ 10717 VsdxShape.prototype.getBottomSpacing = function () { 10718 var bottomMargin = this.getTextBottomMargin(); 10719 bottomMargin = (bottomMargin / 2 - 2.8) * 100 / 100; 10720 return bottomMargin; 10721 }; 10722 /** 10723 * Returns the left spacing of the label in pixels.<br/> 10724 * The property may to be defined in master shape or text stylesheet.<br/> 10725 * @return {number} Left spacing in double precision. 10726 */ 10727 VsdxShape.prototype.getLeftSpacing = function () { 10728 var leftMargin = this.getTextLeftMargin(); 10729 leftMargin = (leftMargin / 2 - 2.8) * 100 / 100; 10730 return leftMargin; 10731 }; 10732 /** 10733 * Returns the right spacing of the label in pixels.<br/> 10734 * The property may to be defined in master shape or text stylesheet.<br/> 10735 * @return {number} Right spacing in double precision. 10736 */ 10737 VsdxShape.prototype.getRightSpacing = function () { 10738 var rightMargin = this.getTextRightMargin(); 10739 rightMargin = (rightMargin / 2 - 2.8) * 100 / 100; 10740 return rightMargin; 10741 }; 10742 /** 10743 * Checks if the label must be rotated.<br/> 10744 * The property may to be defined in master shape or text stylesheet.<br/> 10745 * @return {boolean} Returns <code>true<code/> if the label should remain horizontal. 10746 */ 10747 VsdxShape.prototype.getLabelRotation = function () { 10748 var hor = true; 10749 var rotation = this.calcRotation(); 10750 var angle = parseFloat(this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE), "0")); 10751 angle = (function (x) { return x * 180 / Math.PI; })(angle); 10752 angle = angle - rotation; 10753 if (!(Math.abs(angle) < 45 || Math.abs(angle) > 270)) { 10754 hor = false; 10755 } 10756 return hor; 10757 }; 10758 10759 /** 10760 * Get hyperlink address or subaddress 10761 */ 10762 VsdxShape.prototype.getHyperlink = function () 10763 { 10764 var addressElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String('Address', null, 'Hyperlink'); 10765 var extLink = this.getValue(addressElem, ''); 10766 10767 var subAddressElem = this.getCellElement$java_lang_String$java_lang_String$java_lang_String('SubAddress', null, 'Hyperlink'); 10768 var pageLink = this.getValue(subAddressElem, ''); 10769 10770 return {extLink: extLink, pageLink: pageLink}; 10771 }; 10772 10773 VsdxShape.prototype.getProperties = function () 10774 { 10775 var props = []; 10776 10777 if (this.sections && this.sections['Property']) 10778 { 10779 var rows = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildNamedElements(this.sections['Property'].elem, "Row"); 10780 10781 for (var i = 0; i < rows.length; i++) 10782 { 10783 var row = rows[i]; 10784 var n = row.getAttribute("N"); 10785 10786 var cells = com.mxgraph.io.vsdx.mxVsdxUtils.getDirectChildElements(row); 10787 10788 for (var j = 0; j < cells.length; j++) 10789 { 10790 var cell = cells[j]; 10791 var cn = cell.getAttribute("N"); 10792 10793 if (cn == 'Value') 10794 { 10795 props.push({key: n, val: cell.getAttribute("V")}); 10796 break; 10797 } 10798 } 10799 } 10800 } 10801 10802 return props; 10803 }; 10804 10805 /** 10806 * Analyzes the shape and returns a string with the style. 10807 * @return {*} style read from the shape. 10808 */ 10809 VsdxShape.prototype.getStyleFromShape = function () { 10810 /* put */ (this.styleMap[com.mxgraph.io.vsdx.mxVsdxConstants.VSDX_ID] = this.getId().toString()); 10811 this.rotation = Math.round(this.rotation); 10812 if (this.rotation !== 0) { 10813 /* put */ (this.styleMap[mxConstants.STYLE_ROTATION] = ('' + (this.rotation))); 10814 } 10815 var fillcolor = this.getFillColor(); 10816 if (!(function (o1, o2) { if (o1 && o1.equals) { 10817 return o1.equals(o2); 10818 } 10819 else { 10820 return o1 === o2; 10821 } })(fillcolor, "")) { 10822 /* put */ (this.styleMap[mxConstants.STYLE_FILLCOLOR] = fillcolor); 10823 } 10824 else { 10825 /* put */ (this.styleMap[mxConstants.STYLE_FILLCOLOR] = "none"); 10826 } 10827 var id = this.getId(); 10828 this.styleDebug("ID = " + id + " , Fill Color = " + fillcolor); 10829 var gradient = this.getGradient(); 10830 if (!(function (o1, o2) { if (o1 && o1.equals) { 10831 return o1.equals(o2); 10832 } 10833 else { 10834 return o1 === o2; 10835 } })(gradient, "")) { 10836 /* put */ (this.styleMap[mxConstants.STYLE_GRADIENTCOLOR] = gradient); 10837 var gradientDirection = this.getGradientDirection(); 10838 if (!(function (o1, o2) { if (o1 && o1.equals) { 10839 return o1.equals(o2); 10840 } 10841 else { 10842 return o1 === o2; 10843 } })(gradientDirection, "") && !(function (o1, o2) { if (o1 && o1.equals) { 10844 return o1.equals(o2); 10845 } 10846 else { 10847 return o1 === o2; 10848 } })(gradientDirection, mxConstants.DIRECTION_SOUTH)) { 10849 /* put */ (this.styleMap[mxConstants.STYLE_GRADIENT_DIRECTION] = gradientDirection); 10850 } 10851 } 10852 else { 10853 /* put */ (this.styleMap[mxConstants.STYLE_GRADIENTCOLOR] = "none"); 10854 } 10855 var opacity = this.getOpacity(com.mxgraph.io.vsdx.mxVsdxConstants.FILL_FOREGND_TRANS); 10856 if (opacity < 100) { 10857 /* put */ (this.styleMap[mxConstants.STYLE_FILL_OPACITY] = ('' + (opacity))); 10858 } 10859 opacity = this.getOpacity(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_COLOR_TRANS); 10860 if (opacity < 100) { 10861 /* put */ (this.styleMap[mxConstants.STYLE_STROKE_OPACITY] = ('' + (opacity))); 10862 } 10863 var form = this.getForm(); 10864 if (form.hasOwnProperty(mxConstants.STYLE_SHAPE) && ((function (str, searchString, position) { 10865 if (position === void 0) { position = 0; } 10866 return str.substr(position, searchString.length) === searchString; 10867 })(/* get */ (function (m, k) { return m[k] ? m[k] : null; })(form, mxConstants.STYLE_SHAPE), "image;"))) { 10868 /* put */ (this.styleMap[mxConstants.STYLE_WHITE_SPACE] = "wrap"); 10869 } 10870 10871 //this.styleMap.putAll(form); 10872 for (var key in form) 10873 { 10874 this.styleMap[key] = form[key]; 10875 } 10876 10877 if (this.isDashed()) { 10878 /* put */ (this.styleMap[mxConstants.STYLE_DASHED] = "1"); 10879 var dashPattern = this.getDashPattern(); 10880 if (dashPattern != null) { 10881 /* put */ (this.styleMap[mxConstants.STYLE_DASH_PATTERN] = dashPattern); 10882 } 10883 } 10884 var color = this.getStrokeColor(); 10885 var tr = this.getStrokeTransparency(); 10886 this.styleDebug("ID = " + id + " , Color = " + color + " , stroke transparency = " + tr); 10887 if (!(function (o1, o2) { if (o1 && o1.equals) { 10888 return o1.equals(o2); 10889 } 10890 else { 10891 return o1 === o2; 10892 } })(color, "") && tr !== 1) { 10893 /* put */ (this.styleMap[mxConstants.STYLE_STROKECOLOR] = color); 10894 } 10895 else { 10896 } 10897 var lWeight = (Math.round(this.getLineWidth()) | 0); 10898 if (lWeight !== 1) { 10899 /* put */ (this.styleMap[mxConstants.STYLE_STROKEWIDTH] = ('' + (lWeight))); 10900 } 10901 if (this.isShadow()) { 10902 /* put */ (this.styleMap[mxConstants.STYLE_SHADOW] = com.mxgraph.io.vsdx.mxVsdxConstants.TRUE); 10903 } 10904 var topMargin = (Math.round(this.getTopSpacing()) | 0); 10905 if (topMargin !== 0) { 10906 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_TOP] = ('' + (topMargin))); 10907 } 10908 var bottomMargin = (Math.round(this.getBottomSpacing()) | 0); 10909 if (bottomMargin !== 0) { 10910 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_BOTTOM] = ('' + (bottomMargin))); 10911 } 10912 var leftMargin = (Math.round(this.getLeftSpacing()) | 0); 10913 if (leftMargin !== 0) { 10914 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_LEFT] = ('' + (leftMargin))); 10915 } 10916 var rightMargin = (Math.round(this.getRightSpacing()) | 0); 10917 if (rightMargin !== 0) { 10918 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_RIGHT] = ('' + (rightMargin))); 10919 } 10920 var direction = this.getDirection(form); 10921 if (direction !== mxConstants.DIRECTION_EAST) { 10922 /* put */ (this.styleMap[mxConstants.STYLE_DIRECTION] = direction); 10923 } 10924 var flibX = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FLIP_X), "0"); 10925 var flibY = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.FLIP_Y), "0"); 10926 if ((function (o1, o2) { if (o1 && o1.equals) { 10927 return o1.equals(o2); 10928 } 10929 else { 10930 return o1 === o2; 10931 } })("1", flibX)) { 10932 /* put */ (this.styleMap[mxConstants.STYLE_FLIPH] = "1"); 10933 } 10934 if ((function (o1, o2) { if (o1 && o1.equals) { 10935 return o1.equals(o2); 10936 } 10937 else { 10938 return o1 === o2; 10939 } })("1", flibY)) { 10940 /* put */ (this.styleMap[mxConstants.STYLE_FLIPV] = "1"); 10941 } 10942 this.resolveCommonStyles(); 10943 return this.styleMap; 10944 }; 10945 /*private*/ VsdxShape.prototype.getDashPattern = function () { 10946 var pattern = null; 10947 var linePattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN), "0"); 10948 if ((function (o1, o2) { if (o1 && o1.equals) { 10949 return o1.equals(o2); 10950 } 10951 else { 10952 return o1 === o2; 10953 } })(linePattern, "Themed")) { 10954 var theme_12 = this.getTheme(); 10955 if (theme_12 != null) { 10956 pattern = this.isVertex() ? theme_12.getLineDashPattern$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_12.getConnLineDashPattern(this.getQuickStyleVals()); 10957 } 10958 } 10959 else { 10960 pattern = vsdx.Style.getLineDashPattern(/* parseInt */ parseInt(linePattern)); 10961 } 10962 if (pattern != null && !(pattern.length == 0)) { 10963 var str = { str: "", toString: function () { return this.str; } }; 10964 var _loop_4 = function (index162) { 10965 var len = pattern[index162]; 10966 { 10967 /* append */ (function (sb) { return sb.str = sb.str.concat(len.toFixed(2) + " "); })(str); 10968 } 10969 }; 10970 for (var index162 = 0; index162 < pattern.length; index162++) { 10971 _loop_4(index162); 10972 } 10973 return str.str.trim(); 10974 } 10975 return null; 10976 }; 10977 /** 10978 * Checks if the lines of the shape are dashed.<br/> 10979 * The property may to be defined in master shape or line stylesheet.<br/> 10980 * @return {boolean} Returns <code>true</code> if the lines of the shape are dashed. 10981 */ 10982 VsdxShape.prototype.isDashed = function () { 10983 var linePattern = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_PATTERN), "0"); 10984 if ((function (o1, o2) { if (o1 && o1.equals) { 10985 return o1.equals(o2); 10986 } 10987 else { 10988 return o1 === o2; 10989 } })(linePattern, "Themed")) { 10990 var theme_13 = this.getTheme(); 10991 if (theme_13 != null) { 10992 return this.isVertex() ? theme_13.isLineDashed$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_13.isConnLineDashed(this.getQuickStyleVals()); 10993 } 10994 } 10995 else if (!((function (o1, o2) { if (o1 && o1.equals) { 10996 return o1.equals(o2); 10997 } 10998 else { 10999 return o1 === o2; 11000 } })(linePattern, "0") || (function (o1, o2) { if (o1 && o1.equals) { 11001 return o1.equals(o2); 11002 } 11003 else { 11004 return o1 === o2; 11005 } })(linePattern, "1"))) { 11006 return true; 11007 } 11008 return false; 11009 }; 11010 /** 11011 * Returns the line width.<br/> 11012 * The property may to be defined in master shape or line stylesheet.<br/> 11013 * @return {number} Line width in pixels. 11014 */ 11015 VsdxShape.prototype.getLineWidth = function () { 11016 var lineWeight = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.LINE_WEIGHT), "1"); 11017 var lWeight = 1; 11018 try { 11019 if ((function (o1, o2) { if (o1 && o1.equals) { 11020 return o1.equals(o2); 11021 } 11022 else { 11023 return o1 === o2; 11024 } })(lineWeight, "Themed")) { 11025 var theme_14 = this.getTheme(); 11026 if (theme_14 != null) { 11027 lWeight = (this.isVertex() ? theme_14.getLineWidth$com_mxgraph_io_vsdx_theme_QuickStyleVals(this.getQuickStyleVals()) : theme_14.getConnLineWidth(this.getQuickStyleVals())) / 10000.0; 11028 } 11029 } 11030 else { 11031 lWeight = parseFloat(lineWeight); 11032 lWeight = this.getScreenNumericalValue$double(lWeight); 11033 } 11034 } 11035 catch (e) { 11036 } 11037 ; 11038 if (lWeight < 1) { 11039 lWeight *= 2; 11040 } 11041 return lWeight; 11042 }; 11043 /** 11044 * Returns the start arrow size.<br/> 11045 * The property may to be defined in master shape or line stylesheet.<br/> 11046 * Determines the value in pixels of each arrow size category in .vdx. 11047 * @return {number} Size in pixels. 11048 */ 11049 VsdxShape.prototype.getStartArrowSize = function () { 11050 var baSize = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW_SIZE), "4"); 11051 try { 11052 var size = 4; 11053 if ((function (o1, o2) { if (o1 && o1.equals) { 11054 return o1.equals(o2); 11055 } 11056 else { 11057 return o1 === o2; 11058 } })(baSize, "Themed")) { 11059 var theme_15 = this.getTheme(); 11060 if (theme_15 != null) { 11061 size = this.isVertex() ? theme_15.getStartSize(this.getQuickStyleVals()) : theme_15.getConnStartSize(this.getQuickStyleVals()); 11062 } 11063 } 11064 else { 11065 size = parseFloat(baSize); 11066 } 11067 return VsdxShape.arrowSizes_$LI$()[size]; 11068 } 11069 catch (e) { 11070 } 11071 ; 11072 return 4; 11073 }; 11074 /** 11075 * Returns the end arrow size.<br/> 11076 * The property may to be defined in master shape or line stylesheet.<br/> 11077 * Determines the value in pixels of each arrow size category in .vdx. 11078 * @return {number} Size in pixels. 11079 */ 11080 VsdxShape.prototype.getFinalArrowSize = function () { 11081 var eaSize = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW_SIZE), "4"); 11082 try { 11083 var size = 4; 11084 if ((function (o1, o2) { if (o1 && o1.equals) { 11085 return o1.equals(o2); 11086 } 11087 else { 11088 return o1 === o2; 11089 } })(eaSize, "Themed")) { 11090 var theme_16 = this.getTheme(); 11091 if (theme_16 != null) { 11092 size = this.isVertex() ? theme_16.getEndSize(this.getQuickStyleVals()) : theme_16.getConnEndSize(this.getQuickStyleVals()); 11093 } 11094 } 11095 else { 11096 size = parseFloat(eaSize); 11097 } 11098 return VsdxShape.arrowSizes_$LI$()[size]; 11099 } 11100 catch (e) { 11101 } 11102 ; 11103 return 4; 11104 }; 11105 /** 11106 * Returns whether the cell is Rounded.<br/> 11107 * The property may to be defined in master shape or line stylesheet.<br/> 11108 * @return {boolean} Returns <code>true</code> if the cell is Rounded. 11109 */ 11110 VsdxShape.prototype.getRounding = function () { 11111 var val = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.ROUNDING), "0"); 11112 if ((function (o1, o2) { if (o1 && o1.equals) { 11113 return o1.equals(o2); 11114 } 11115 else { 11116 return o1 === o2; 11117 } })("Themed", val)) { 11118 val = "0"; 11119 } 11120 return parseFloat(val); 11121 }; 11122 /** 11123 * Return if the line has shadow.<br/> 11124 * The property may to be defined in master shape or line stylesheet.<br/> 11125 * @return {boolean} Returns <code>mxVdxConstants.TRUE</code> if the line has shadow. 11126 */ 11127 VsdxShape.prototype.isShadow = function () { 11128 var shdw = this.getValue(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.SHDW_PATTERN), "0"); 11129 if ((function (o1, o2) { if (o1 && o1.equals) { 11130 return o1.equals(o2); 11131 } 11132 else { 11133 return o1 === o2; 11134 } })(shdw, "Themed")) { 11135 } 11136 else if (!(function (o1, o2) { if (o1 && o1.equals) { 11137 return o1.equals(o2); 11138 } 11139 else { 11140 return o1 === o2; 11141 } })(shdw, "0")) { 11142 return true; 11143 } 11144 return false; 11145 }; 11146 VsdxShape.prototype.getEdgeStyle$java_util_Map = function (edgeShape) { 11147 var result = ({}); 11148 var edgeName = (function (m, k) { return m[k] ? m[k] : null; })(edgeShape, mxConstants.STYLE_SHAPE); 11149 if ((function (o1, o2) { if (o1 && o1.equals) { 11150 return o1.equals(o2); 11151 } 11152 else { 11153 return o1 === o2; 11154 } })(edgeName, "mxgraph.lean_mapping.electronic_info_flow_edge")) { 11155 /* put */ (result[mxConstants.STYLE_EDGE] = mxConstants.NONE); 11156 return result; 11157 } 11158 else { 11159 /* put */ (result[mxConstants.STYLE_EDGE] = mxConstants.EDGESTYLE_ELBOW); 11160 return result; 11161 } 11162 }; 11163 /** 11164 * Returns the style of the edge. (Orthogonal or straight) 11165 * @return {*} Edge Style. 11166 * @param {*} edgeShape 11167 */ 11168 VsdxShape.prototype.getEdgeStyle = function (edgeShape) { 11169 if (((edgeShape != null && (edgeShape instanceof Object)) || edgeShape === null)) { 11170 return this.getEdgeStyle$java_util_Map(edgeShape); 11171 } 11172 else if (edgeShape === undefined) { 11173 return this.getEdgeStyle$(); 11174 } 11175 else 11176 throw new Error('invalid overload'); 11177 }; 11178 /** 11179 * Returns the master's Id of the Shape. 11180 * @return {string} Master's ID of the shape, null if has not a master. 11181 */ 11182 VsdxShape.prototype.getMasterId = function () { 11183 if (this.shape.hasAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER)) { 11184 return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER); 11185 } 11186 else { 11187 return null; 11188 } 11189 }; 11190 /** 11191 * Returns the masterShape's Id of the shape. 11192 * @return {string} Master Shape's ID of the shape, null if has not a master shape. 11193 */ 11194 VsdxShape.prototype.getShapeMasterId = function () { 11195 if (this.shape.hasAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER_SHAPE)) { 11196 return this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.MASTER_SHAPE); 11197 } 11198 else { 11199 return null; 11200 } 11201 }; 11202 /** 11203 * Checks if a shape contains other shapes inside. 11204 * @return {boolean} Returns <code>true</code> if a shape contains other shapes inside. 11205 */ 11206 VsdxShape.prototype.isGroup = function () { 11207 return (function (o1, o2) { if (o1 && o1.equals) { 11208 return o1.equals(o2); 11209 } 11210 else { 11211 return o1 === o2; 11212 } })(this.shape.getAttribute("Type"), "Group"); 11213 }; 11214 /** 11215 * Checks if a shape contains other shapes inside. 11216 * @return {string} Returns <code>true</code> if a shape contains other shapes inside. 11217 * @param {*} shape 11218 */ 11219 VsdxShape.getType = function (shape) { 11220 return shape.getAttribute("Type"); 11221 }; 11222 VsdxShape.prototype.getMaster = function () { 11223 return this.master; 11224 }; 11225 /** 11226 * Returns the NameU attribute. 11227 * @return {string} Value of the NameU attribute. 11228 */ 11229 VsdxShape.prototype.getNameU = function () { 11230 var result = this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U) || ""; 11231 if ((result == null || (function (o1, o2) { if (o1 && o1.equals) { 11232 return o1.equals(o2); 11233 } 11234 else { 11235 return o1 === o2; 11236 } })(result, "")) && this.masterShape != null) { 11237 result = this.masterShape.getNameU(); 11238 } 11239 return result; 11240 }; 11241 /** 11242 * Returns the Name attribute. 11243 * @return {string} Value of the Name attribute (Human readable name). 11244 */ 11245 VsdxShape.prototype.getName = function () { 11246 var result = this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME); 11247 if ((result == null || (function (o1, o2) { if (o1 && o1.equals) { 11248 return o1.equals(o2); 11249 } 11250 else { 11251 return o1 === o2; 11252 } })(result, "")) && this.masterShape != null) { 11253 result = this.masterShape.getName(); 11254 } 11255 return result; 11256 }; 11257 /** 11258 * Returns the master name of the shape 11259 * @return {string} Master name of the shape 11260 */ 11261 VsdxShape.prototype.getMasterName = function () { 11262 return this.shapeName; 11263 }; 11264 VsdxShape.prototype.setLabelOffset = function (vertex, style) { 11265 var nameU = ""; 11266 var masterNameU = ""; 11267 if (this.shape.hasAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U)) { 11268 nameU = this.shape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U); 11269 } 11270 if (this.getMaster() != null && this.getMaster().getMasterElement() != null) { 11271 if (this.getMaster().getMasterElement().hasAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U)) { 11272 masterNameU = this.getMaster().getMasterElement().getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.NAME_U); 11273 } 11274 } 11275 if ((function (str, searchString, position) { 11276 if (position === void 0) { position = 0; } 11277 return str.substr(position, searchString.length) === searchString; 11278 })(nameU, "Organizational unit") || (function (str, searchString, position) { 11279 if (position === void 0) { position = 0; } 11280 return str.substr(position, searchString.length) === searchString; 11281 })(masterNameU, "Organizational unit")) { 11282 var control = this.shape.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.CONTROL).item(0); 11283 var xEl = null; 11284 var xS = "0.0"; 11285 var yEl = null; 11286 var yS = "-0.4"; 11287 if (control != null) { 11288 xEl = control.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.X).item(0); 11289 if (xEl.hasAttribute("F")) { 11290 xS = xEl.getAttribute("F"); 11291 } 11292 else { 11293 xS = xEl.textContent; 11294 } 11295 yEl = control.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.Y).item(0); 11296 if (yEl.hasAttribute("F")) { 11297 yS = yEl.getAttribute("F"); 11298 } 11299 else { 11300 yS = yEl.textContent; 11301 } 11302 } 11303 var geometry_3 = vertex.getGeometry(); 11304 xS = xS.split("Width/2+").join(""); 11305 xS = xS.split("DL").join(""); 11306 yS = yS.split("Height*").join(""); 11307 if ((function (o1, o2) { if (o1 && o1.equals) { 11308 return o1.equals(o2); 11309 } 11310 else { 11311 return o1 === o2; 11312 } })(xS, "Inh")) { 11313 xS = "0.0"; 11314 } 11315 if ((function (o1, o2) { if (o1 && o1.equals) { 11316 return o1.equals(o2); 11317 } 11318 else { 11319 return o1 === o2; 11320 } })(yS, "Inh")) { 11321 yS = "-0.4"; 11322 } 11323 if (yS.indexOf("txtHeight") != -1) { 11324 yS = "-0.4"; 11325 } 11326 var styleArray = style.split(";"); 11327 var tabHeight = ""; 11328 for (var i = 0; i < styleArray.length; i++) { 11329 var currStyle = styleArray[i]; 11330 currStyle = currStyle.trim(); 11331 if ((function (str, searchString, position) { 11332 if (position === void 0) { position = 0; } 11333 return str.substr(position, searchString.length) === searchString; 11334 })(currStyle, "tabHeight=")) { 11335 tabHeight = currStyle.split("tabHeight=").join(""); 11336 } 11337 } 11338 ; 11339 if ((function (o1, o2) { if (o1 && o1.equals) { 11340 return o1.equals(o2); 11341 } 11342 else { 11343 return o1 === o2; 11344 } })(tabHeight, "")) { 11345 tabHeight = "20"; 11346 } 11347 var tH = parseFloat(tabHeight); 11348 var x = parseFloat(xS); 11349 var y = parseFloat(yS); 11350 var h = geometry_3.height; 11351 var xFinal = geometry_3.width * 0.1 + x * 100; 11352 var yFinal = h - h * y - tH / 2; 11353 var offset = new mxPoint(xFinal, yFinal); 11354 vertex.getGeometry().offset = (offset); 11355 } 11356 else if ((function (str, searchString, position) { 11357 if (position === void 0) { position = 0; } 11358 return str.substr(position, searchString.length) === searchString; 11359 })(nameU, "Domain 3D") || (function (str, searchString, position) { 11360 if (position === void 0) { position = 0; } 11361 return str.substr(position, searchString.length) === searchString; 11362 })(masterNameU, "Domain 3D")) { 11363 var control = this.shape.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.CONTROL).item(0); 11364 var xEl = null; 11365 var xS = "0.0"; 11366 var yEl = null; 11367 var yS = "-0.4"; 11368 if (control != null) { 11369 xEl = control.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.X).item(0); 11370 xS = xEl.getAttribute("F") || ""; 11371 yEl = control.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.Y).item(0); 11372 yS = yEl.getAttribute("F") || ""; 11373 } 11374 var geometry_4 = vertex.getGeometry(); 11375 xS = xS.split("Width/2+").join(""); 11376 xS = xS.split("DL").join(""); 11377 yS = yS.split("Height*").join(""); 11378 if ((function (o1, o2) { if (o1 && o1.equals) { 11379 return o1.equals(o2); 11380 } 11381 else { 11382 return o1 === o2; 11383 } })(xS, "Inh") || (function (o1, o2) { if (o1 && o1.equals) { 11384 return o1.equals(o2); 11385 } 11386 else { 11387 return o1 === o2; 11388 } })(xS, "")) { 11389 xS = "0.0"; 11390 } 11391 if ((function (o1, o2) { if (o1 && o1.equals) { 11392 return o1.equals(o2); 11393 } 11394 else { 11395 return o1 === o2; 11396 } })(yS, "Inh") || (function (o1, o2) { if (o1 && o1.equals) { 11397 return o1.equals(o2); 11398 } 11399 else { 11400 return o1 === o2; 11401 } })(yS, "")) { 11402 yS = "-0.4"; 11403 } 11404 if (yS.indexOf("txtHeight") != -1) { 11405 yS = "-0.4"; 11406 } 11407 var x = parseFloat(xS); 11408 var y = parseFloat(yS); 11409 var h = geometry_4.height; 11410 var xFinal = geometry_4.width * 0.1 + x * 100; 11411 var yFinal = h - h * y; 11412 var offset = new mxPoint(xFinal, yFinal); 11413 vertex.getGeometry().offset = (offset); 11414 } 11415 }; 11416 /** 11417 * Returns the constant that represents the Shape. 11418 * @return {*} String that represent the form. 11419 */ 11420 VsdxShape.prototype.getForm = function () { 11421 var result = ({}); 11422// this.styleDebug("Looking to match shape = " + this.shapeName); 11423// if (this.shapeName != null && !(function (o1, o2) { if (o1 && o1.equals) { 11424// return o1.equals(o2); 11425// } 11426// else { 11427// return o1 === o2; 11428// } })(this.shapeName, "") && VsdxShape.USE_SHAPE_MATCH) { 11429// var trans = mxResources.get(this.shapeName); 11430// if (trans != null && !(function (o1, o2) { if (o1 && o1.equals) { 11431// return o1.equals(o2); 11432// } 11433// else { 11434// return o1 === o2; 11435// } })(trans, "")) { 11436// this.styleDebug("Translation = " + trans); 11437// /* put */ (result[mxConstants.STYLE_SHAPE] = trans); 11438// return result; 11439// } 11440// } 11441 if (this.isVertex()) { 11442 try { 11443 var type = VsdxShape.getType(this.getShape()); 11444 this.styleDebug("shape type = " + type); 11445 if (this.imageData != null || ((function (o1, o2) { if (o1 && o1.equals) { 11446 return o1.equals(o2); 11447 } 11448 else { 11449 return o1 === o2; 11450 } })(com.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN, type) && this.masterShape != null && this.masterShape.imageData != null)) { 11451 var imageData = this.imageData != null ? this.imageData : this.masterShape.imageData; 11452 /* put */ (result["shape"] = "image"); 11453 /* put */ (result["aspect"] = "fixed"); 11454 var iType = (function (m, k) { return m[k] ? m[k] : null; })(imageData, "iType"); 11455 var iData = (function (m, k) { return m[k] ? m[k] : null; })(imageData, "iData"); 11456 11457 var imgOffsetX = parseFloat(this.getValue(this.getCellElement$java_lang_String('ImgOffsetX'), "0")); 11458 var imgOffsetY = parseFloat(this.getValue(this.getCellElement$java_lang_String('ImgOffsetY'), "0")); 11459 var imgWidth = parseFloat(this.getValue(this.getCellElement$java_lang_String('ImgWidth'), "0")); 11460 var imgHeight = parseFloat(this.getValue(this.getCellElement$java_lang_String('ImgHeight'), "0")); 11461 var width = parseFloat(this.getValue(this.getCellElement$java_lang_String('Width'), "0")); 11462 var height = parseFloat(this.getValue(this.getCellElement$java_lang_String('Height'), "0")); 11463 11464 if (imgOffsetX != 0 || imgOffsetY != 0) 11465 { 11466 this.toBeCroppedImg = { 11467 imgOffsetX: imgOffsetX, 11468 imgOffsetY: imgOffsetY, 11469 imgWidth: imgWidth, 11470 imgHeight: imgHeight, 11471 width: width, 11472 height: height, 11473 iType: iType, 11474 iData: iData 11475 }; 11476 } 11477 else 11478 { 11479 /* put */ (result["image"] = "data:image/" + iType + "," + iData); 11480 } 11481 11482 return result; 11483 } 11484 var parsedGeom = this.parseGeom(); 11485 if ((function (o1, o2) { if (o1 && o1.equals) { 11486 return o1.equals(o2); 11487 } 11488 else { 11489 return o1 === o2; 11490 } })(parsedGeom, "")) { 11491 this.styleDebug("No geom found"); 11492 return result; 11493 } 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 11701 VsdxShape.prototype.isVerticalLabel = function () 11702 { 11703 var txtDir = this.getAttribute('TextDirection', 'V', ''); 11704 11705 if (!txtDir && this.masterShape != null) 11706 { 11707 txtDir = this.masterShape.getAttribute('TextDirection', 'V', ''); 11708 } 11709 11710 return txtDir == '1'; 11711 }; 11712 11713 VsdxShape.prototype.isRotatedLabel = function () 11714 { 11715 if (this.isVerticalLabel()) 11716 { 11717 return true; 11718 } 11719 11720 var txtAngleValue = this.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE, "V", ""); 11721 if (this.masterShape != null) { 11722 if ((function (o1, o2) { if (o1 && o1.equals) { 11723 return o1.equals(o2); 11724 } 11725 else { 11726 return o1 === o2; 11727 } })(txtAngleValue, "")) { 11728 txtAngleValue = this.masterShape.getAttribute(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE, "V", ""); 11729 } 11730 } 11731 if (!(function (o1, o2) { if (o1 && o1.equals) { 11732 return o1.equals(o2); 11733 } 11734 else { 11735 return o1 === o2; 11736 } })(txtAngleValue, "0") && !(function (o1, o2) { if (o1 && o1.equals) { 11737 return o1.equals(o2); 11738 } 11739 else { 11740 return o1 === o2; 11741 } })(txtAngleValue, "0.0") && !(function (o1, o2) { if (o1 && o1.equals) { 11742 return o1.equals(o2); 11743 } 11744 else { 11745 return o1 === o2; 11746 } })(txtAngleValue, "")) { 11747 return true; 11748 } 11749 return false; 11750 }; 11751 VsdxShape.prototype.setRootShape = function (shape) { 11752 this.rootShape = shape; 11753 }; 11754 VsdxShape.prototype.getRootShape = function () { 11755 return this.rootShape; 11756 }; 11757 /** 11758 * Returns the coordinates of the begin point of an Edge Shape. 11759 * @param {number} parentHeight Height of the parent of the shape. 11760 * @return {mxPoint} mxPoint that represents the coordinates. 11761 */ 11762 VsdxShape.prototype.getStartXY = function (parentHeight) { 11763 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); 11764 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); 11765 return new mxPoint(startX, startY); 11766 }; 11767 /** 11768 * Returns the coordinates of the end point of an Edge Shape. 11769 * @param {number} parentHeight Height of the parent of the shape. 11770 * @return {mxPoint} mxPoint that represents the coordinates. 11771 */ 11772 VsdxShape.prototype.getEndXY = function (parentHeight) { 11773 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); 11774 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); 11775 return new mxPoint(endX, endY); 11776 }; 11777 /** 11778 * Returns the list of routing points of a edge shape. 11779 * @param {number} parentHeight Height of the parent of the shape. 11780 * @return {mxPoint[]} List of mxPoint that represents the routing points. 11781 * @param {mxPoint} startPoint 11782 * @param {number} rotation 11783 */ 11784 VsdxShape.prototype.getRoutingPoints = function (parentHeight, startPoint, rotation) { 11785 if (this.geomList != null) { 11786 return this.geomList.getRoutingPoints(parentHeight, startPoint, rotation); 11787 } 11788 return null; 11789 }; 11790 /** 11791 * Returns the list of control points of a edge shape. 11792 * @param {number} parentHeight Height of the parent of the shape. 11793 * @return {mxPoint[]} List of mxPoint that represents the control points. 11794 */ 11795 VsdxShape.prototype.getControlPoints = function (parentHeight) { 11796 var startXY = this.getStartXY(parentHeight); 11797 var endXY = this.getEndXY(parentHeight); 11798 var pointList = ([]); 11799 if (this.shape != null) { 11800 var geomList = this.shape.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.GEOM); 11801 if (geomList.length > 0) { 11802 var firstGeom = geomList.item(0); 11803 var firstNURBS = firstGeom.getElementsByTagName(com.mxgraph.io.vsdx.mxVsdxConstants.NURBS_TO).item(0); 11804 var firstE = firstNURBS.getElementsByTagName("E").item(0); 11805 if (firstE != null) { 11806 var f = firstE.getAttribute("F") || ""; 11807 f = f.replace(new RegExp("NURBS\\(", 'g'), ""); 11808 f = f.replace(new RegExp("\\)", 'g'), ""); 11809 f = f.replace(new RegExp(",", 'g'), " "); 11810 f = f.replace(new RegExp("\\s\\s", 'g'), " "); 11811 var pointsS = f.split(" "); 11812 var pointsRaw = (function (s) { var a = []; while (s-- > 0) 11813 a.push(0); return a; })(pointsS.length); 11814 for (var i = 0; i < pointsS.length; i++) { 11815 pointsRaw[i] = parseFloat(pointsS[i]); 11816 } 11817 ; 11818 for (var i = 2; i + 4 < pointsS.length; i = i + 4) { 11819 var currPoint = new mxPoint(); 11820 var rawX = pointsRaw[i + 2]; 11821 var rawY = pointsRaw[i + 3]; 11822 var width = Math.abs(endXY.x - startXY.x); 11823 var widthFixed = Math.min(100, width); 11824 var heightFixed = 100; 11825 var finalX = 0; 11826 finalX = startXY.x + widthFixed * rawX; 11827 currPoint.x = (Math.floor(Math.round(finalX * 100) / 100)); 11828 currPoint.y = (Math.floor(Math.round((startXY.y - heightFixed * rawY) * 100) / 100)); 11829 /* add */ (pointList.push(currPoint)); 11830 } 11831 ; 11832 return pointList; 11833 } 11834 else { 11835 return null; 11836 } 11837 } 11838 } 11839 return null; 11840 }; 11841 /** 11842 * Analyzes a edge shape and returns a string with the style. 11843 * @return {*} style read from the edge shape. 11844 * @param {number} parentHeight 11845 */ 11846 VsdxShape.prototype.getStyleFromEdgeShape = function (parentHeight) { 11847 /* put */ (this.styleMap[com.mxgraph.io.vsdx.mxVsdxConstants.VSDX_ID] = this.getId().toString()); 11848 var edgeShape = this.getForm(); 11849 if (edgeShape != null && !(function (o1, o2) { if (o1 && o1.equals) { 11850 return o1.equals(o2); 11851 } 11852 else { 11853 return o1 === o2; 11854 } })(edgeShape, "")) { 11855 //this.styleMap.putAll(edgeShape); 11856 for (var key in edgeShape) 11857 { 11858 this.styleMap[key] = edgeShape[key]; 11859 } 11860 } 11861 if (this.isDashed()) { 11862 /* put */ (this.styleMap[mxConstants.STYLE_DASHED] = "1"); 11863 var dashPattern = this.getDashPattern(); 11864 if (dashPattern != null) { 11865 /* put */ (this.styleMap[mxConstants.STYLE_DASH_PATTERN] = dashPattern); 11866 } 11867 } 11868 var startArrow = this.getEdgeMarker(true); 11869 if (startArrow != null) { 11870 if ((function (str, searchString, position) { 11871 if (position === void 0) { position = 0; } 11872 return str.substr(position, searchString.length) === searchString; 11873 })(startArrow, VsdxShape.ARROW_NO_FILL_MARKER)) { 11874 startArrow = startArrow.substring(VsdxShape.ARROW_NO_FILL_MARKER.length); 11875 /* put */ (this.styleMap[mxConstants.STYLE_STARTFILL] = "0"); 11876 } 11877 /* put */ (this.styleMap[mxConstants.STYLE_STARTARROW] = startArrow); 11878 } 11879 var endArrow = this.getEdgeMarker(false); 11880 if (endArrow != null) { 11881 if ((function (str, searchString, position) { 11882 if (position === void 0) { position = 0; } 11883 return str.substr(position, searchString.length) === searchString; 11884 })(endArrow, VsdxShape.ARROW_NO_FILL_MARKER)) { 11885 endArrow = endArrow.substring(VsdxShape.ARROW_NO_FILL_MARKER.length); 11886 /* put */ (this.styleMap[mxConstants.STYLE_ENDFILL] = "0"); 11887 } 11888 /* put */ (this.styleMap[mxConstants.STYLE_ENDARROW] = endArrow); 11889 } 11890 var saSize = (Math.round(this.getStartArrowSize()) | 0); 11891 if (saSize !== 6) { 11892 /* put */ (this.styleMap[mxConstants.STYLE_STARTSIZE] = ('' + (saSize))); 11893 } 11894 var faSize = (Math.round(this.getFinalArrowSize()) | 0); 11895 if (faSize !== 6) { 11896 /* put */ (this.styleMap[mxConstants.STYLE_ENDSIZE] = ('' + (faSize))); 11897 } 11898 var lWeight = (Math.round(this.getLineWidth()) | 0); 11899 if (lWeight !== 1.0) { 11900 /* put */ (this.styleMap[mxConstants.STYLE_STROKEWIDTH] = ('' + (lWeight))); 11901 } 11902 var color = this.getStrokeColor(); 11903 if (!(function (o1, o2) { if (o1 && o1.equals) { 11904 return o1.equals(o2); 11905 } 11906 else { 11907 return o1 === o2; 11908 } })(color, "")) { 11909 /* put */ (this.styleMap[mxConstants.STYLE_STROKECOLOR] = color); 11910 } 11911 if (this.isShadow()) { 11912 /* put */ (this.styleMap[mxConstants.STYLE_SHADOW] = com.mxgraph.io.vsdx.mxVsdxConstants.TRUE); 11913 } 11914 if (this.isConnectorBigNameU(this.getNameU())) { 11915 /* put */ (this.styleMap[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_ARROW); 11916 var fillcolor = this.getFillColor(); 11917 if (!(function (o1, o2) { if (o1 && o1.equals) { 11918 return o1.equals(o2); 11919 } 11920 else { 11921 return o1 === o2; 11922 } })(fillcolor, "")) { 11923 /* put */ (this.styleMap[mxConstants.STYLE_FILLCOLOR] = fillcolor); 11924 } 11925 } 11926 var topMargin = (Math.round(this.getTopSpacing()) | 0); 11927 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_TOP] = ('' + (topMargin))); 11928 var bottomMargin = (Math.round(this.getBottomSpacing()) | 0); 11929 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_BOTTOM] = ('' + (bottomMargin))); 11930 var leftMargin = (Math.round(this.getLeftSpacing()) | 0); 11931 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_LEFT] = ('' + (leftMargin))); 11932 var rightMargin = (Math.round(this.getRightSpacing()) | 0); 11933 /* put */ (this.styleMap[mxConstants.STYLE_SPACING_RIGHT] = ('' + (rightMargin))); 11934 var verticalAlign = this.getAlignVertical(); 11935 /* put */ (this.styleMap[mxConstants.STYLE_VERTICAL_ALIGN] = verticalAlign); 11936 /* put */ (this.styleMap["html"] = "1"); 11937 this.resolveCommonStyles(); 11938 return this.styleMap; 11939 }; 11940 /** 11941 * Analyzes a edge shape and returns a string with the style. 11942 * @return {*} style read from the edge shape. 11943 */ 11944 VsdxShape.prototype.resolveCommonStyles = function () { 11945 var lbkgnd = this.getTextBkgndColor(this.getCellElement$java_lang_String(com.mxgraph.io.vsdx.mxVsdxConstants.TEXT_BKGND)); 11946 if (!(function (o1, o2) { if (o1 && o1.equals) { 11947 return o1.equals(o2); 11948 } 11949 else { 11950 return o1 === o2; 11951 } })(lbkgnd, "")) { 11952 var isFullyTransparent = this.getValue(this.getCellElement$java_lang_String('TextBkgndTrans'), '0') == '1'; 11953 11954 if (!isFullyTransparent) 11955 { 11956 /* put */ (this.styleMap[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR] = lbkgnd); 11957 } 11958 } 11959 /* put */ (this.styleMap[mxConstants.STYLE_ROUNDED] = this.getRounding() > 0 ? com.mxgraph.io.vsdx.mxVsdxConstants.TRUE : com.mxgraph.io.vsdx.mxVsdxConstants.FALSE); 11960 return this.styleMap; 11961 }; 11962 /** 11963 * Returns the arrow of the line. 11964 * @return {string} Type of arrow. 11965 * @param {boolean} start 11966 */ 11967 VsdxShape.prototype.getEdgeMarker = function (start) { 11968 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"); 11969 var val = 0; 11970 try { 11971 if ((function (o1, o2) { if (o1 && o1.equals) { 11972 return o1.equals(o2); 11973 } 11974 else { 11975 return o1 === o2; 11976 } })(marker, "Themed")) { 11977 var theme_17 = this.getTheme(); 11978 if (theme_17 != null) { 11979 val = this.isVertex() ? theme_17.getEdgeMarker(start, this.getQuickStyleVals()) : theme_17.getConnEdgeMarker(start, this.getQuickStyleVals()); 11980 } 11981 } 11982 else { 11983 val = parseInt(marker); 11984 } 11985 } 11986 catch (e) { 11987 } 11988 ; 11989 var 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$(), val); 11994 if (val > 0 && type == null) { 11995 type = (function (m, k) { if (m.entries == null) 11996 m.entries = []; for (var i = 0; i < m.entries.length; i++) 11997 if (m.entries[i].key.equals != null && m.entries[i].key.equals(k) || m.entries[i].key === k) { 11998 return m.entries[i].value; 11999 } return null; })(VsdxShape.arrowTypes_$LI$(), 1); 12000 } 12001 return type; 12002 }; 12003 VsdxShape.prototype.getCellElement$java_lang_String = function (key) { 12004 var elem = _super.prototype.getCellElement$java_lang_String.call(this, key); 12005 if (elem == null && this.masterShape != null) { 12006 return this.masterShape.getCellElement$java_lang_String(key); 12007 } 12008 return elem; 12009 }; 12010 VsdxShape.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String = function (cellKey, index, sectKey) { 12011 var elem = _super.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String.call(this, cellKey, index, sectKey); 12012 if (elem == null && this.masterShape != null) { 12013 return this.masterShape.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey); 12014 } 12015 return elem; 12016 }; 12017 VsdxShape.prototype.getCellElement = function (cellKey, index, sectKey) { 12018 if (((typeof cellKey === 'string') || cellKey === null) && ((typeof index === 'string') || index === null) && ((typeof sectKey === 'string') || sectKey === null)) { 12019 return this.getCellElement$java_lang_String$java_lang_String$java_lang_String(cellKey, index, sectKey); 12020 } 12021 else if (((typeof cellKey === 'string') || cellKey === null) && index === undefined && sectKey === undefined) { 12022 return this.getCellElement$java_lang_String(cellKey); 12023 } 12024 else 12025 throw new Error('invalid overload'); 12026 }; 12027 /** 12028 * Creates a sub shape for <b>shape</b> that contains the label. Used internally, when the label is positioned by an anchor. 12029 * @param graph 12030 * @param shape the shape we want to create the label for 12031 * @param {mxCell} parent 12032 * @param parentHeight 12033 * @return {mxCell} label sub-shape 12034 */ 12035 VsdxShape.prototype.createLabelSubShape = function (graph, parent) { 12036 var txtWV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH), this.getWidth()); 12037 var txtHV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT), this.getHeight()); 12038 var txtLocPinXV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_X), txtWV / 2.0); 12039 var txtLocPinYV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_Y), txtHV / 2.0); 12040 var txtPinXV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X), txtLocPinXV); 12041 var txtPinYV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y), txtLocPinYV); 12042 var txtAngleV = this.getValueAsDouble(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE), 0); 12043 var textLabel = this.getTextLabel(); 12044 if (textLabel != null && !(textLabel.length === 0)) { 12045 var styleMap = mxUtils.clone(this.getStyleMap()) || {}; 12046 /* put */ (styleMap[mxConstants.STYLE_FILLCOLOR] = mxConstants.NONE); 12047 /* put */ (styleMap[mxConstants.STYLE_STROKECOLOR] = mxConstants.NONE); 12048 /* put */ (styleMap[mxConstants.STYLE_GRADIENTCOLOR] = mxConstants.NONE); 12049 if (!styleMap.hasOwnProperty("align")) 12050 (styleMap["align"] = "center"); 12051 if (!styleMap.hasOwnProperty("verticalAlign")) 12052 (styleMap["verticalAlign"] = "middle"); 12053 if (!styleMap.hasOwnProperty("whiteSpace")) 12054 (styleMap["whiteSpace"] = "wrap"); 12055 /* remove */ delete styleMap["shape"]; 12056 /* remove */ delete styleMap["image"]; 12057 12058 if (this.isVerticalLabel()) 12059 { 12060 txtAngleV += Math.PI + 0.01; //TODO Added 0.01 since we don't override the parent rotation if labRot is zero. Why? 12061 styleMap['horizontal'] = '0'; 12062 } 12063 12064 var rotation = this.getRotation(); 12065 if (txtAngleV !== 0) { 12066 var labRot = 360 - (function (x) { return x * 180 / Math.PI; })(txtAngleV); 12067 labRot = Math.round(((labRot + rotation) % 360.0) * 100.0) / 100.0; 12068 if (labRot !== 0.0) { 12069 /* put */ (styleMap["rotation"] = ('' + (labRot))); 12070 } 12071 } 12072 var style = "text;" + com.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(styleMap, "="); 12073 var y = parent.getGeometry().height - (txtPinYV + txtHV - txtLocPinYV); 12074 var x = txtPinXV - txtLocPinXV; 12075 if (rotation > 0) { 12076 var tmpGeo = new mxGeometry(x, y, txtWV, txtHV); 12077 var pgeo = parent.getGeometry(); 12078 var hw = pgeo.width / 2; 12079 var hh = pgeo.height / 2; 12080 com.mxgraph.online.Utils.rotatedGeometry(tmpGeo, rotation, hw, hh); 12081 x = tmpGeo.x; 12082 y = tmpGeo.y; 12083 } 12084 var v1 = graph.insertVertex(parent, null, textLabel, 12085 Math.round(x * 100) / 100, Math.round(y * 100) / 100, 12086 Math.round(txtWV * 100) / 100, Math.round(txtHV * 100) / 100, 12087 style + ";html=1;"); 12088 return v1; 12089 } 12090 return null; 12091 }; 12092 VsdxShape.prototype.getLblEdgeOffset = function (view, points) { 12093 if (points != null && points.length > 1) { 12094 //find mxGraph label offset 12095 var state = new mxCellState(); 12096 state.absolutePoints = (points); 12097 view.updateEdgeBounds(state); 12098 var mxOffset = view.getPoint(state); 12099 var p0 = points[0]; 12100 var pe = points[points.length - 1]; 12101 var txtWV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH), this.getWidth()); 12102 var txtHV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT), this.getHeight()); 12103 var txtLocPinXV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_X), 0); 12104 var txtLocPinYV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_Y), 0); 12105 var txtPinXV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X), 0); 12106 var txtPinYV = this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(com.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y), 0); 12107 var y = (this.getHeight() - (p0.y - pe.y)) / 2 + p0.y - mxOffset.y - (txtPinYV - txtLocPinYV + txtHV / 2); 12108 var x = txtPinXV - txtLocPinXV + txtWV / 2 + (p0.x - mxOffset.x); 12109 //FIXME one file has txtPinX/Y values extremely high which cause draw.io to hang 12110 // <Cell N='TxtPinX' V='-1.651384506429589E199' F='SETATREF(Controls.TextPosition)'/> 12111 // <Cell N='TxtPinY' V='1.183491078740126E185' F='SETATREF(Controls.TextPosition.Y)'/> 12112 if (Math.abs(x) > 1.0E11) 12113 return null; 12114 return new mxPoint(Math.floor(Math.round(x * 100) / 100), Math.floor(Math.round(y * 100) / 100)); 12115 } 12116 else { 12117 return null; 12118 } 12119 }; 12120 VsdxShape.prototype.getShapeIndex = function () { 12121 return this.shapeIndex; 12122 }; 12123 VsdxShape.prototype.setShapeIndex = function (shapeIndex) { 12124 this.shapeIndex = shapeIndex; 12125 }; 12126 return VsdxShape; 12127 }(com.mxgraph.io.vsdx.Shape)); 12128 VsdxShape.__static_initialized = false; 12129 VsdxShape.ARROW_NO_FILL_MARKER = "0"; 12130 /** 12131 * Number of d.p. to round non-integers to 12132 */ 12133 VsdxShape.maxDp = 2; 12134 //TODO FIXME In online, matching fails which gives better results! 12135 VsdxShape.USE_SHAPE_MATCH = false; 12136 VsdxShape.stencilTemplate = "<shape h=\"htemplate\" w=\"wtemplate\" aspect=\"variable\" strokewidth=\"inherit\"><connections></connections><background></background><foreground></foreground></shape>"; 12137 vsdx.VsdxShape = VsdxShape; 12138 VsdxShape["__class"] = "com.mxgraph.io.vsdx.VsdxShape"; 12139 })(vsdx = io.vsdx || (io.vsdx = {})); 12140 })(io = mxgraph.io || (mxgraph.io = {})); 12141 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 12142})(com || (com = {})); 12143var com; 12144(function (com) { 12145 var mxgraph; 12146 (function (mxgraph) { 12147 var online; 12148 (function (online) { 12149 /** 12150 * A very fast and memory efficient class to encode and decode to and from BASE64 in full accordance 12151 * with RFC 2045.<br><br> 12152 * On Windows XP sp1 with 1.4.2_04 and later ;), this encoder and decoder is about 10 times faster 12153 * on small arrays (10 - 1000 bytes) and 2-3 times as fast on larger arrays (10000 - 1000000 bytes) 12154 * compared to <code>sun.misc.Encoder()/Decoder()</code>.<br><br> 12155 * 12156 * On byte arrays the encoder is about 20% faster than Jakarta Commons Base64 Codec for encode and 12157 * about 50% faster for decoding large arrays. This implementation is about twice as fast on very small 12158 * arrays (< 30 bytes). If source/destination is a <code>String</code> this 12159 * version is about three times as fast due to the fact that the Commons Codec result has to be recoded 12160 * to a <code>String</code> from <code>byte[]</code>, which is very expensive.<br><br> 12161 * 12162 * This encode/decode algorithm doesn't create any temporary arrays as many other codecs do, it only 12163 * allocates the resulting array. This produces less garbage and it is possible to handle arrays twice 12164 * as large as algorithms that create a temporary array. (E.g. Jakarta Commons Codec). It is unknown 12165 * whether Sun's <code>sun.misc.Encoder()/Decoder()</code> produce temporary arrays but since performance 12166 * is quite low it probably does.<br><br> 12167 * 12168 * The encoder produces the same output as the Sun one except that the Sun's encoder appends 12169 * a trailing line separator if the last character isn't a pad. Unclear why but it only adds to the 12170 * length and is probably a side effect. Both are in conformance with RFC 2045 though.<br> 12171 * Commons codec seem to always att a trailing line separator.<br><br> 12172 * 12173 * <b>Note!</b> 12174 * The encode/decode method pairs (types) come in three versions with the <b>exact</b> same algorithm and 12175 * thus a lot of code redundancy. This is to not create any temporary arrays for transcoding to/from different 12176 * format types. The methods not used can simply be commented out.<br><br> 12177 * 12178 * There is also a "fast" version of all decode methods that works the same way as the normal ones, but 12179 * har a few demands on the decoded input. Normally though, these fast verions should be used if the source if 12180 * the input is known and it hasn't bee tampered with.<br><br> 12181 * 12182 * If you find the code useful or you find a bug, please send me a note at base64 @ miginfocom . com. 12183 * 12184 * Licence (BSD): 12185 * ============== 12186 * 12187 * Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (base64 @ miginfocom . com) 12188 * All rights reserved. 12189 * 12190 * Redistribution and use in source and binary forms, with or without modification, 12191 * are permitted provided that the following conditions are met: 12192 * Redistributions of source code must retain the above copyright notice, this list 12193 * of conditions and the following disclaimer. 12194 * Redistributions in binary form must reproduce the above copyright notice, this 12195 * list of conditions and the following disclaimer in the documentation and/or other 12196 * materials provided with the distribution. 12197 * Neither the name of the MiG InfoCom AB nor the names of its contributors may be 12198 * used to endorse or promote products derived from this software without specific 12199 * prior written permission. 12200 * 12201 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 12202 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 12203 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 12204 * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 12205 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 12206 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 12207 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 12208 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 12209 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 12210 * OF SUCH DAMAGE. 12211 * 12212 * @version 2.2 12213 * @author Mikael Grev 12214 * Date: 2004-aug-02 12215 * Time: 11:31:11 12216 * @class 12217 */ 12218 var mxBase64 = (function () { 12219 function mxBase64() { 12220 } 12221 mxBase64.__static_initialize = function () { if (!mxBase64.__static_initialized) { 12222 mxBase64.__static_initialized = true; 12223 mxBase64.__static_initializer_0(); 12224 } }; 12225 mxBase64.CA_$LI$ = function () { mxBase64.__static_initialize(); if (mxBase64.CA == null) 12226 mxBase64.CA = ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").split(''); return mxBase64.CA; }; 12227 ; 12228 mxBase64.IA_$LI$ = function () { mxBase64.__static_initialize(); if (mxBase64.IA == null) 12229 mxBase64.IA = (function (s) { var a = []; while (s-- > 0) 12230 a.push(0); return a; })(256); return mxBase64.IA; }; 12231 ; 12232 mxBase64.__static_initializer_0 = function () { 12233 /* fill */ (function (a, v) { for (var i = 0; i < a.length; i++) 12234 a[i] = v; })(mxBase64.IA_$LI$(), -1); 12235 for (var i = 0, iS = mxBase64.CA_$LI$().length; i < iS; i++) 12236 mxBase64.IA_$LI$()[(mxBase64.CA_$LI$()[i]).charCodeAt(0)] = i; 12237 mxBase64.IA_$LI$()[('=').charCodeAt(0)] = 0; 12238 }; 12239 /** 12240 * Encodes a raw byte array into a BASE64 <code>char[]</code> representation i accordance with RFC 2045. 12241 * @param {Array} sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned. 12242 * @param {boolean} lineSep Optional "\r\n" after 76 characters, unless end of file.<br> 12243 * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a 12244 * little faster. 12245 * @return {Array} A BASE64 encoded array. Never <code>null</code>. 12246 */ 12247 mxBase64.encodeToChar = function (sArr, start, lineSep) { 12248 var sLen = sArr != null ? sArr.length - start : 0; 12249 if (sLen === 0) 12250 return new Array(0); 12251 var eLen = ((sLen / 3 | 0)) * 3; 12252 var cCnt = (((sLen - 1) / 3 | 0) + 1) << 2; 12253 var dLen = cCnt + (lineSep ? ((cCnt - 1) / 76 | 0) << 1 : 0); 12254 var dArr = new Array(dLen); 12255 for (var s = start, d = 0, cc = 0; s < eLen + start;) { 12256 var i = (sArr[s++] & 255) << 16 | (sArr[s++] & 255) << 8 | (sArr[s++] & 255); 12257 dArr[d++] = mxBase64.CA_$LI$()[(i >>> 18) & 63]; 12258 dArr[d++] = mxBase64.CA_$LI$()[(i >>> 12) & 63]; 12259 dArr[d++] = mxBase64.CA_$LI$()[(i >>> 6) & 63]; 12260 dArr[d++] = mxBase64.CA_$LI$()[i & 63]; 12261 if (lineSep && ++cc === 19 && d < dLen - 2) { 12262 dArr[d++] = '\r'; 12263 dArr[d++] = '\n'; 12264 cc = 0; 12265 } 12266 } 12267 ; 12268 var left = sLen - eLen; 12269 if (left > 0) { 12270 var i = ((sArr[eLen + start] & 255) << 10) | (left === 2 ? ((sArr[sLen + start - 1] & 255) << 2) : 0); 12271 dArr[dLen - 4] = mxBase64.CA_$LI$()[i >> 12]; 12272 dArr[dLen - 3] = mxBase64.CA_$LI$()[(i >>> 6) & 63]; 12273 dArr[dLen - 2] = left === 2 ? mxBase64.CA_$LI$()[i & 63] : '='; 12274 dArr[dLen - 1] = '='; 12275 } 12276 return dArr; 12277 }; 12278 mxBase64.decode$char_A = function (sArr) { 12279 var sLen = sArr != null ? sArr.length : 0; 12280 if (sLen === 0) 12281 return []; 12282 var sepCnt = 0; 12283 for (var i = 0; i < sLen; i++) 12284 if (mxBase64.IA_$LI$()[(sArr[i]).charCodeAt(0)] < 0) 12285 sepCnt++; 12286 ; 12287 if ((sLen - sepCnt) % 4 !== 0) 12288 return null; 12289 var pad = 0; 12290 for (var i = sLen; i > 1 && mxBase64.IA_$LI$()[(sArr[--i]).charCodeAt(0)] <= 0;) 12291 if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(sArr[i]) == '='.charCodeAt(0)) 12292 pad++; 12293 ; 12294 var len = ((sLen - sepCnt) * 6 >> 3) - pad; 12295 var dArr = (function (s) { var a = []; while (s-- > 0) 12296 a.push(0); return a; })(len); 12297 for (var s = 0, d = 0; d < len;) { 12298 var i = 0; 12299 for (var j = 0; j < 4; j++) { 12300 var c = mxBase64.IA_$LI$()[(sArr[s++]).charCodeAt(0)]; 12301 if (c >= 0) 12302 i |= c << (18 - j * 6); 12303 else 12304 j--; 12305 } 12306 ; 12307 dArr[d++] = ((i >> 16) | 0); 12308 if (d < len) { 12309 dArr[d++] = ((i >> 8) | 0); 12310 if (d < len) 12311 dArr[d++] = (i | 0); 12312 } 12313 } 12314 ; 12315 return dArr; 12316 }; 12317 /** 12318 * Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with 12319 * and without line separators. 12320 * @param {Array} sArr The source array. <code>null</code> or length 0 will return an empty array. 12321 * @return {Array} The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters 12322 * (including '=') isn't divideable by 4. (I.e. definitely corrupted). 12323 */ 12324 mxBase64.decode = function (sArr) { 12325 if (((sArr != null && sArr instanceof Array && (sArr.length == 0 || sArr[0] == null || (typeof sArr[0] === 'string'))) || sArr === null)) { 12326 return com.mxgraph.online.mxBase64.decode$char_A(sArr); 12327 } 12328 else if (((sArr != null && sArr instanceof Array && (sArr.length == 0 || sArr[0] == null || (typeof sArr[0] === 'number'))) || sArr === null)) { 12329 return com.mxgraph.online.mxBase64.decode$byte_A(sArr); 12330 } 12331 else if (((typeof sArr === 'string') || sArr === null)) { 12332 return com.mxgraph.online.mxBase64.decode$java_lang_String(sArr); 12333 } 12334 else 12335 throw new Error('invalid overload'); 12336 }; 12337 mxBase64.decodeFast$char_A = function (sArr) { 12338 var sLen = sArr.length; 12339 if (sLen === 0) 12340 return []; 12341 var sIx = 0; 12342 var eIx = sLen - 1; 12343 while ((sIx < eIx && mxBase64.IA_$LI$()[(sArr[sIx]).charCodeAt(0)] < 0)) 12344 sIx++; 12345 while ((eIx > 0 && mxBase64.IA_$LI$()[(sArr[eIx]).charCodeAt(0)] < 0)) 12346 eIx--; 12347 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; 12348 var cCnt = eIx - sIx + 1; 12349 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; 12350 var len = ((cCnt - sepCnt) * 6 >> 3) - pad; 12351 var dArr = (function (s) { var a = []; while (s-- > 0) 12352 a.push(0); return a; })(len); 12353 var d = 0; 12354 for (var cc = 0, eLen = ((len / 3 | 0)) * 3; d < eLen;) { 12355 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)]; 12356 dArr[d++] = ((i >> 16) | 0); 12357 dArr[d++] = ((i >> 8) | 0); 12358 dArr[d++] = (i | 0); 12359 if (sepCnt > 0 && ++cc === 19) { 12360 sIx += 2; 12361 cc = 0; 12362 } 12363 } 12364 ; 12365 if (d < len) { 12366 var i = 0; 12367 for (var j = 0; sIx <= eIx - pad; j++) 12368 i |= mxBase64.IA_$LI$()[(sArr[sIx++]).charCodeAt(0)] << (18 - j * 6); 12369 for (var r = 16; d < len; r -= 8) 12370 dArr[d++] = ((i >> r) | 0); 12371 } 12372 return dArr; 12373 }; 12374 /** 12375 * Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as 12376 * fast as {@link #decode(char[])}. The preconditions are:<br> 12377 * + The array must have a line length of 76 chars OR no line separators at all (one line).<br> 12378 * + Line separator must be "\r\n", as specified in RFC 2045 12379 * + The array must not contain illegal characters within the encoded string<br> 12380 * + The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br> 12381 * @param {Array} sArr The source array. Length 0 will return an empty array. <code>null</code> will throw an exception. 12382 * @return {Array} The decoded array of bytes. May be of length 0. 12383 */ 12384 mxBase64.decodeFast = function (sArr) { 12385 if (((sArr != null && sArr instanceof Array && (sArr.length == 0 || sArr[0] == null || (typeof sArr[0] === 'string'))) || sArr === null)) { 12386 return com.mxgraph.online.mxBase64.decodeFast$char_A(sArr); 12387 } 12388 else if (((sArr != null && sArr instanceof Array && (sArr.length == 0 || sArr[0] == null || (typeof sArr[0] === 'number'))) || sArr === null)) { 12389 return com.mxgraph.online.mxBase64.decodeFast$byte_A(sArr); 12390 } 12391 else if (((typeof sArr === 'string') || sArr === null)) { 12392 return com.mxgraph.online.mxBase64.decodeFast$java_lang_String(sArr); 12393 } 12394 else 12395 throw new Error('invalid overload'); 12396 }; 12397 /** 12398 * Encodes a raw byte array into a BASE64 <code>byte[]</code> representation i accordance with RFC 2045. 12399 * @param {Array} sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned. 12400 * @param {boolean} lineSep Optional "\r\n" after 76 characters, unless end of file.<br> 12401 * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a 12402 * little faster. 12403 * @return {Array} A BASE64 encoded array. Never <code>null</code>. 12404 */ 12405 mxBase64.encodeToByte = function (sArr, lineSep) { 12406 var sLen = sArr != null ? sArr.length : 0; 12407 if (sLen === 0) 12408 return []; 12409 var eLen = ((sLen / 3 | 0)) * 3; 12410 var cCnt = (((sLen - 1) / 3 | 0) + 1) << 2; 12411 var dLen = cCnt + (lineSep ? ((cCnt - 1) / 76 | 0) << 1 : 0); 12412 var dArr = (function (s) { var a = []; while (s-- > 0) 12413 a.push(0); return a; })(dLen); 12414 for (var s = 0, d = 0, cc = 0; s < eLen;) { 12415 var i = (sArr[s++] & 255) << 16 | (sArr[s++] & 255) << 8 | (sArr[s++] & 255); 12416 dArr[d++] = (mxBase64.CA_$LI$()[(i >>> 18) & 63]).charCodeAt(0); 12417 dArr[d++] = (mxBase64.CA_$LI$()[(i >>> 12) & 63]).charCodeAt(0); 12418 dArr[d++] = (mxBase64.CA_$LI$()[(i >>> 6) & 63]).charCodeAt(0); 12419 dArr[d++] = (mxBase64.CA_$LI$()[i & 63]).charCodeAt(0); 12420 if (lineSep && ++cc === 19 && d < dLen - 2) { 12421 dArr[d++] = ('\r').charCodeAt(0); 12422 dArr[d++] = ('\n').charCodeAt(0); 12423 cc = 0; 12424 } 12425 } 12426 ; 12427 var left = sLen - eLen; 12428 if (left > 0) { 12429 var i = ((sArr[eLen] & 255) << 10) | (left === 2 ? ((sArr[sLen - 1] & 255) << 2) : 0); 12430 dArr[dLen - 4] = (mxBase64.CA_$LI$()[i >> 12]).charCodeAt(0); 12431 dArr[dLen - 3] = (mxBase64.CA_$LI$()[(i >>> 6) & 63]).charCodeAt(0); 12432 dArr[dLen - 2] = left === 2 ? (mxBase64.CA_$LI$()[i & 63]).charCodeAt(0) : ('=').charCodeAt(0); 12433 dArr[dLen - 1] = ('=').charCodeAt(0); 12434 } 12435 return dArr; 12436 }; 12437 mxBase64.decode$byte_A = function (sArr) { 12438 var sLen = sArr.length; 12439 var sepCnt = 0; 12440 for (var i = 0; i < sLen; i++) 12441 if (mxBase64.IA_$LI$()[sArr[i] & 255] < 0) 12442 sepCnt++; 12443 ; 12444 if ((sLen - sepCnt) % 4 !== 0) 12445 return null; 12446 var pad = 0; 12447 for (var i = sLen; i > 1 && mxBase64.IA_$LI$()[sArr[--i] & 255] <= 0;) 12448 if (sArr[i] == '='.charCodeAt(0)) 12449 pad++; 12450 ; 12451 var len = ((sLen - sepCnt) * 6 >> 3) - pad; 12452 var dArr = (function (s) { var a = []; while (s-- > 0) 12453 a.push(0); return a; })(len); 12454 for (var s = 0, d = 0; d < len;) { 12455 var i = 0; 12456 for (var j = 0; j < 4; j++) { 12457 var c = mxBase64.IA_$LI$()[sArr[s++] & 255]; 12458 if (c >= 0) 12459 i |= c << (18 - j * 6); 12460 else 12461 j--; 12462 } 12463 ; 12464 dArr[d++] = ((i >> 16) | 0); 12465 if (d < len) { 12466 dArr[d++] = ((i >> 8) | 0); 12467 if (d < len) 12468 dArr[d++] = (i | 0); 12469 } 12470 } 12471 ; 12472 return dArr; 12473 }; 12474 mxBase64.decodeFast$byte_A = function (sArr) { 12475 var sLen = sArr.length; 12476 if (sLen === 0) 12477 return []; 12478 var sIx = 0; 12479 var eIx = sLen - 1; 12480 while ((sIx < eIx && mxBase64.IA_$LI$()[sArr[sIx] & 255] < 0)) 12481 sIx++; 12482 while ((eIx > 0 && mxBase64.IA_$LI$()[sArr[eIx] & 255] < 0)) 12483 eIx--; 12484 var pad = sArr[eIx] == '='.charCodeAt(0) ? (sArr[eIx - 1] == '='.charCodeAt(0) ? 2 : 1) : 0; 12485 var cCnt = eIx - sIx + 1; 12486 var sepCnt = sLen > 76 ? (sArr[76] == '\r'.charCodeAt(0) ? (cCnt / 78 | 0) : 0) << 1 : 0; 12487 var len = ((cCnt - sepCnt) * 6 >> 3) - pad; 12488 var dArr = (function (s) { var a = []; while (s-- > 0) 12489 a.push(0); return a; })(len); 12490 var d = 0; 12491 for (var cc = 0, eLen = ((len / 3 | 0)) * 3; d < eLen;) { 12492 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++]]; 12493 dArr[d++] = ((i >> 16) | 0); 12494 dArr[d++] = ((i >> 8) | 0); 12495 dArr[d++] = (i | 0); 12496 if (sepCnt > 0 && ++cc === 19) { 12497 sIx += 2; 12498 cc = 0; 12499 } 12500 } 12501 ; 12502 if (d < len) { 12503 var i = 0; 12504 for (var j = 0; sIx <= eIx - pad; j++) 12505 i |= mxBase64.IA_$LI$()[sArr[sIx++]] << (18 - j * 6); 12506 for (var r = 16; d < len; r -= 8) 12507 dArr[d++] = ((i >> r) | 0); 12508 } 12509 return dArr; 12510 }; 12511 /** 12512 * Encodes a raw byte array into a BASE64 <code>String</code> representation i accordance with RFC 2045. 12513 * @param {Array} sArr The bytes to convert. If <code>null</code> or length 0 an empty array will be returned. 12514 * @param {boolean} lineSep Optional "\r\n" after 76 characters, unless end of file.<br> 12515 * No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a 12516 * little faster. 12517 * @return {string} A BASE64 encoded array. Never <code>null</code>. 12518 */ 12519 mxBase64.encodeToString = function (sArr, start, lineSep) { 12520 return mxBase64.encodeToChar(sArr, start, lineSep).join(''); 12521 }; 12522 mxBase64.decode$java_lang_String = function (str) { 12523 var sLen = str != null ? str.length : 0; 12524 if (sLen === 0) 12525 return []; 12526 var sepCnt = 0; 12527 for (var i = 0; i < sLen; i++) 12528 if (mxBase64.IA_$LI$()[(str.charAt(i)).charCodeAt(0)] < 0) 12529 sepCnt++; 12530 ; 12531 if ((sLen - sepCnt) % 4 !== 0) 12532 return null; 12533 var pad = 0; 12534 for (var i = sLen; i > 1 && mxBase64.IA_$LI$()[(str.charAt(--i)).charCodeAt(0)] <= 0;) 12535 if ((function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(str.charAt(i)) == '='.charCodeAt(0)) 12536 pad++; 12537 ; 12538 var len = ((sLen - sepCnt) * 6 >> 3) - pad; 12539 var dArr = (function (s) { var a = []; while (s-- > 0) 12540 a.push(0); return a; })(len); 12541 for (var s = 0, d = 0; d < len;) { 12542 var i = 0; 12543 for (var j = 0; j < 4; j++) { 12544 var c = mxBase64.IA_$LI$()[(str.charAt(s++)).charCodeAt(0)]; 12545 if (c >= 0) 12546 i |= c << (18 - j * 6); 12547 else 12548 j--; 12549 } 12550 ; 12551 dArr[d++] = ((i >> 16) | 0); 12552 if (d < len) { 12553 dArr[d++] = ((i >> 8) | 0); 12554 if (d < len) 12555 dArr[d++] = (i | 0); 12556 } 12557 } 12558 ; 12559 return dArr; 12560 }; 12561 mxBase64.decodeFast$java_lang_String = function (s) { 12562 var sLen = s.length; 12563 if (sLen === 0) 12564 return []; 12565 var sIx = 0; 12566 var eIx = sLen - 1; 12567 while ((sIx < eIx && mxBase64.IA_$LI$()[(function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(sIx)) & 255] < 0)) 12568 sIx++; 12569 while ((eIx > 0 && mxBase64.IA_$LI$()[(function (c) { return c.charCodeAt == null ? c : c.charCodeAt(0); })(s.charAt(eIx)) & 255] < 0)) 12570 eIx--; 12571 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; 12572 var cCnt = eIx - sIx + 1; 12573 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; 12574 var len = ((cCnt - sepCnt) * 6 >> 3) - pad; 12575 var dArr = (function (s) { var a = []; while (s-- > 0) 12576 a.push(0); return a; })(len); 12577 var d = 0; 12578 for (var cc = 0, eLen = ((len / 3 | 0)) * 3; d < eLen;) { 12579 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)]; 12580 dArr[d++] = ((i >> 16) | 0); 12581 dArr[d++] = ((i >> 8) | 0); 12582 dArr[d++] = (i | 0); 12583 if (sepCnt > 0 && ++cc === 19) { 12584 sIx += 2; 12585 cc = 0; 12586 } 12587 } 12588 ; 12589 if (d < len) { 12590 var i = 0; 12591 for (var j = 0; sIx <= eIx - pad; j++) 12592 i |= mxBase64.IA_$LI$()[(s.charAt(sIx++)).charCodeAt(0)] << (18 - j * 6); 12593 for (var r = 16; d < len; r -= 8) 12594 dArr[d++] = ((i >> r) | 0); 12595 } 12596 return dArr; 12597 }; 12598 return mxBase64; 12599 }()); 12600 mxBase64.__static_initialized = false; 12601 online.mxBase64 = mxBase64; 12602 mxBase64["__class"] = "com.mxgraph.online.mxBase64"; 12603 })(online = mxgraph.online || (mxgraph.online = {})); 12604 })(mxgraph = com.mxgraph || (com.mxgraph = {})); 12605})(com || (com = {})); 12606com.mxgraph.online.mxBase64.IA_$LI$(); 12607com.mxgraph.online.mxBase64.CA_$LI$(); 12608com.mxgraph.online.mxBase64.__static_initialize(); 12609com.mxgraph.io.vsdx.VsdxShape.__com_mxgraph_io_vsdx_VsdxShape_LOGGER_$LI$(); 12610com.mxgraph.io.vsdx.VsdxShape.arrowTypes_$LI$(); 12611com.mxgraph.io.vsdx.VsdxShape.arrowSizes_$LI$(); 12612com.mxgraph.io.vsdx.VsdxShape.OFFSET_ARRAY_$LI$(); 12613com.mxgraph.io.vsdx.VsdxShape.__static_initialize(); 12614com.mxgraph.io.vsdx.Shape.UNICODE_LINE_SEP_$LI$(); 12615com.mxgraph.io.vsdx.Style.lineDashPatterns_$LI$(); 12616com.mxgraph.io.vsdx.Style.styleTypes_$LI$(); 12617com.mxgraph.io.vsdx.Style.__static_initialize(); 12618com.mxgraph.online.Constants.MAX_AREA_$LI$(); 12619com.mxgraph.io.vsdx.theme.Color.NONE_$LI$(); 12620com.mxgraph.io.vsdx.mxVsdxUtils.conversionFactor_$LI$(); 12621com.mxgraph.io.vsdx.mxVsdxTheme.colorIds_$LI$(); 12622com.mxgraph.io.vsdx.mxVsdxTheme.themesIds_$LI$(); 12623com.mxgraph.io.vsdx.mxVsdxTheme.__static_initialize(); 12624com.mxgraph.io.vsdx.mxVsdxConstants.MY_SET_$LI$(); 12625com.mxgraph.io.vsdx.mxVsdxConstants.SET_VALUES_$LI$(); 12626com.mxgraph.io.vsdx.mxPropertiesManager.defaultColors_$LI$(); 12627com.mxgraph.io.vsdx.mxPropertiesManager.__static_initialize(); 12628com.mxgraph.io.mxVsdxCodec.vsdxPlaceholder_$LI$(); 12629com.mxgraph.io.mxVsdxCodec.parsererrorNS_$LI$(); 12630 12631EditorUi.prototype.doImportVisio = function(file, done, onerror, filename) 12632{ 12633 filename = filename || file.name; 12634 12635 if (filename != null && /(\.vs(x|sx?))($|\?)/i.test(filename)) 12636 { 12637 new com.mxgraph.io.mxVssxCodec(this).decodeVssx(file, done, null, onerror); 12638 } 12639 else 12640 { 12641 new com.mxgraph.io.mxVsdxCodec(this).decodeVsdx(file, done, null, onerror); 12642 } 12643}; 12644