gt:                         Object[] arrobject = new Object[4];
context: /*
   * Decompiled with CFR 0_114.
   * 
   * Could not load the following classes:
   *  com.stimulsoft.base.IStiEnum
   *  com.stimulsoft.base.StiEnumSet
   *  com.stimulsoft.base.drawing.StiAdvancedBorder
   *  com.stimulsoft.base.drawing.StiBorder
   *  com.stimulsoft.base.drawing.StiBorderSide
   *  com.stimulsoft.base.drawing.StiBrush
   *  com.stimulsoft.base.drawing.StiColor
   *  com.stimulsoft.base.drawing.StiColorEnum
   *  com.stimulsoft.base.drawing.StiGradientBrush
   *  com.stimulsoft.base.drawing.StiTextOptions
   *  com.stimulsoft.base.drawing.enums.StiBorderSides
   *  com.stimulsoft.base.drawing.enums.StiPenStyle
   *  com.stimulsoft.base.drawing.enums.StiTextHorAlignment
   *  com.stimulsoft.base.drawing.enums.StiVertAlignment
   *  com.stimulsoft.base.exception.StiException
   *  com.stimulsoft.base.localization.StiLocalization
   *  com.stimulsoft.base.system.StiFont
   *  com.stimulsoft.base.system.geometry.StiRectangle
   *  com.stimulsoft.base.utils.StiBidirectionalConvert
   *  com.stimulsoft.base.utils.StiBidirectionalConvert$Mode
   *  com.stimulsoft.base.utils.StiMath
   *  com.stimulsoft.base.utils.StiXmlHelper
   *  com.stimulsoft.lib.utils.StiStringUtil
   */
  package com.stimulsoft.report.export.service;
  
  import com.stimulsoft.base.IStiEnum;
  import com.stimulsoft.base.StiEnumSet;
  import com.stimulsoft.base.drawing.StiAdvancedBorder;
  import com.stimulsoft.base.drawing.StiBorder;
  import com.stimulsoft.base.drawing.StiBorderSide;
  import com.stimulsoft.base.drawing.StiBrush;
  import com.stimulsoft.base.drawing.StiColor;
  import com.stimulsoft.base.drawing.StiColorEnum;
  import com.stimulsoft.base.drawing.StiGradientBrush;
  import com.stimulsoft.base.drawing.StiTextOptions;
  import com.stimulsoft.base.drawing.enums.StiBorderSides;
  import com.stimulsoft.base.drawing.enums.StiPenStyle;
  import com.stimulsoft.base.drawing.enums.StiTextHorAlignment;
  import com.stimulsoft.base.drawing.enums.StiVertAlignment;
  import com.stimulsoft.base.exception.StiException;
  import com.stimulsoft.base.localization.StiLocalization;
  import com.stimulsoft.base.system.StiFont;
  import com.stimulsoft.base.system.geometry.StiRectangle;
  import com.stimulsoft.base.utils.StiBidirectionalConvert;
  import com.stimulsoft.base.utils.StiMath;
  import com.stimulsoft.base.utils.StiXmlHelper;
  import com.stimulsoft.lib.utils.StiStringUtil;
  import com.stimulsoft.report.StiImageCache;
  import com.stimulsoft.report.StiNameValidator;
  import com.stimulsoft.report.StiReport;
  import com.stimulsoft.report.components.StiComponent;
  import com.stimulsoft.report.components.StiComponentsCollection;
  import com.stimulsoft.report.components.StiMargins;
  import com.stimulsoft.report.components.StiPage;
  import com.stimulsoft.report.components.StiPagesCollection;
  import com.stimulsoft.report.components.StiWatermark;
  import com.stimulsoft.report.components.complexcomponents.StiContainer;
  import com.stimulsoft.report.components.interfaces.IStiBorder;
  import com.stimulsoft.report.components.interfaces.IStiBrush;
  import com.stimulsoft.report.components.interfaces.IStiExportImageExtended;
  import com.stimulsoft.report.components.interfaces.IStiFont;
  import com.stimulsoft.report.components.interfaces.IStiText;
  import com.stimulsoft.report.components.interfaces.IStiTextBrush;
  import com.stimulsoft.report.components.interfaces.IStiTextHorAlignment;
  import com.stimulsoft.report.components.interfaces.IStiTextOptions;
  import com.stimulsoft.report.components.interfaces.IStiVertAlignment;
  import com.stimulsoft.report.components.simplecomponents.StiImage;
  import com.stimulsoft.report.components.simplecomponents.StiImageHelper;
  import com.stimulsoft.report.components.simplecomponents.StiRectanglePrimitive;
  import com.stimulsoft.report.components.simplecomponents.StiRichText;
  import com.stimulsoft.report.components.simplecomponents.StiShape;
  import com.stimulsoft.report.components.simplecomponents.StiText;
  import com.stimulsoft.report.enums.StiExportFormat;
  import com.stimulsoft.report.export.service.StiExportService;
  import com.stimulsoft.report.export.settings.StiExportSettings;
  import com.stimulsoft.report.export.settings.StiXpsExportSettings;
  import com.stimulsoft.report.export.tools.StiExportUtils;
  import com.stimulsoft.report.export.tools.StiImageFormat;
  import com.stimulsoft.report.export.tools.StiPagesRange;
  import com.stimulsoft.report.export.tools.pdf.PdfFonts;
  import com.stimulsoft.report.options.ExportOptions;
  import com.stimulsoft.report.units.StiUnit;
  import java.awt.image.BufferedImage;
  import java.io.ByteArrayOutputStream;
  import java.io.IOException;
  import java.io.OutputStream;
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.Collection;
  import java.util.Date;
  import java.util.Hashtable;
  import java.util.Locale;
  import java.util.Set;
  import java.util.zip.ZipEntry;
  import java.util.zip.ZipOutputStream;
  import javax.xml.parsers.DocumentBuilder;
  import javax.xml.parsers.DocumentBuilderFactory;
  import javax.xml.parsers.ParserConfigurationException;
  import javax.xml.transform.TransformerException;
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  import org.w3c.dom.Node;
  
  public final class StiXpsExportService
  extends StiExportService {
      private static final char ALIGN_WIDTH_SYMBOL = '\u0007';
      private static final double HI_TO_DPI = 0.9599999785423279;
      double FONT_CORRECT_VALUE = 1.279999666213996;
      private StiImageCache imageCache = null;
      private Hashtable<Integer, Integer> pageImages = null;
      private Hashtable<Integer, Integer> pageFonts = null;
      private Hashtable<String, Integer> pageBookmarks = null;
      int indexPage = 0;
      private PdfFonts pdfFont = null;
      private StiBidirectionalConvert bidi = null;
      private final int precision_digits = 3;
      private boolean reduceFontSize = true;
      private boolean useImageComparer = true;
      private float imageQuality = 0.75f;
      private float imageResolution = 96.0f;
  
      private boolean isWordWrapSymbol(StringBuilder stringBuilder, int n) {
          char c = ' ';
          if (n < stringBuilder.length() - 1) {
              c = stringBuilder.charAt(n + 1);
          }
          return this.isWordWrapSymbol(stringBuilder.charAt(n), c);
      }
  
      private boolean isWordWrapSymbol(char c, char c2) {
          int n = Character.getType(c);
          int n2 = Character.getType(c2);
          return n == 21 || n == 22 && n2 != 24 || n == 20 || n == 29 || n == 30 || n == 12;
      }
  
      private String floatToString(double d) {
          int n = 3;
          if (Math.abs(d) < 1.0) {
              n = 5;
          }
          Double d2 = StiMath.round((double)d, (int)n);
          return d2.toString();
      }
  
      private void prepareData() {
          this.bidi = new StiBidirectionalConvert(StiBidirectionalConvert.Mode.Xps);
          this.pdfFont = new PdfFonts();
          this.pdfFont.setStandardPdfFonts(false);
          this.pdfFont.setMaxSymbols(32767);
          this.pdfFont.setFontList(new ArrayList<PdfFonts.pfontInfo>());
          this.imageCache = new StiImageCache(this.useImageComparer, StiImageFormat.Jpeg, this.imageQuality);
      }
  
      private float getTabsSize(IStiTextOptions iStiTextOptions, double d, double d2) {
          if (iStiTextOptions != null && iStiTextOptions.getTextOptions() != null) {
              double d3 = d2;
              float f = 750.0f / (float)d;
              float f2 = f * iStiTextOptions.getTextOptions().getDistanceBetweenTabs();
              float f3 = f * iStiTextOptions.getTextOptions().getFirstTabOffset() + f2;
              if (d2 < (double)f3) {
                  d3 = f3;
              } else if (iStiTextOptions.getTextOptions().getDistanceBetweenTabs() > 0.0f) {
                  int n = (int)((d2 - (double)f3) / (double)f2);
                  d3 = f3 + (float)(++n) * f2;
              }
              return (float)(d3 - d2);
          }
          return 0.0f;
      }
  
      static String convertToEscapeSequence(String string) {
          String string2 = "\r\n\b\f";
          String string3 = "rnbf";
          if (string == null) {
              return "";
          }
          String string4 = "";
          for (int i = 0; i < string.length(); ++i) {
              boolean bl = false;
              for (int j = 0; j < string2.length(); ++j) {
                  if (string.charAt(i) != string2.charAt(j)) continue;
                  string4 = string4 + "\\" + string3.charAt(j);
                  bl = true;
                  break;
              }
              if (bl) continue;
              string4 = string4 + string.charAt(i);
          }
          return string4;
      }
  
      private String getLineStyleDash(StiPenStyle stiPenStyle) {
          String string = "";
          switch (stiPenStyle) {
              case Dot: {
                  string = "1.1 1.1";
                  break;
              }
              case Dash: {
                  string = "3 1";
                  break;
              }
              case DashDot: {
                  string = "3 1 1 1";
                  break;
              }
              case DashDotDot: {
                  string = "3 1 1 1 1 1";
              }
          }
          return string;
      }
  
      private Document writeContentTypes() throws ParserConfigurationException {
          DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
          Document document = documentBuilder.newDocument();
          Element element = document.createElement("Types");
          document.appendChild(element);
          element.setAttribute("xmlns", "http://schemas.openxmlformats.org/package/2006/content-types");
          Element element2 = document.createElement("Default");
          element.appendChild(element2);
          element2.setAttribute("Extension", "jpg");
          element2.setAttribute("ContentType", "image/jpeg");
          element2 = document.createElement("Default");
          element.appendChild(element2);
          element2.setAttribute("Extension", "png");
          element2.setAttribute("ContentType", "image/png");
          element2 = document.createElement("Default");
          element.appendChild(element2);
          element2.setAttribute("Extension", "rels");
          element2.setAttribute("ContentType", "application/vnd.openxmlformats-package.relationships+xml");
          element2 = document.createElement("Default");
          element.appendChild(element2);
          element2.setAttribute("Extension", "xml");
          element2.setAttribute("ContentType", "application/xml");
          element2 = document.createElement("Default");
          element.appendChild(element2);
          element2.setAttribute("Extension", "fdseq");
          element2.setAttribute("ContentType", "application/vnd.ms-package.xps-fixeddocumentsequence+xml");
          element2 = document.createElement("Default");
          element.appendChild(element2);
          element2.setAttribute("Extension", "fpage");
          element2.setAttribute("ContentType", "application/vnd.ms-package.xps-fixedpage+xml");
          element2 = document.createElement("Default");
          element.appendChild(element2);
          element2.setAttribute("Extension", "ttf");
          element2.setAttribute("ContentType", "application/vnd.ms-opentype");
          element2 = document.createElement("Default");
          element.appendChild(element2);
          element2.setAttribute("Extension", "fdoc");
          element2.setAttribute("ContentType", "application/vnd.ms-package.xps-fixeddocument+xml");
          Element element3 = document.createElement("Override");
          element.appendChild(element3);
          element3.setAttribute("PartName", "/docProps/core.xml");
          element3.setAttribute("ContentType", "application/vnd.openxmlformats-package.core-properties+xml");
          return document;
      }
  
      private Document writeMainRels() throws ParserConfigurationException {
          DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
          Document document = documentBuilder.newDocument();
          Element element = document.createElement("Relationships");
          document.appendChild(element);
          element.setAttribute("xmlns", "http://schemas.openxmlformats.org/package/2006/relationships");
          Element element2 = document.createElement("Relationship");
          element.appendChild(element2);
          element2.setAttribute("Id", "rId1");
          element2.setAttribute("Type", "http://schemas.microsoft.com/xps/2005/06/fixedrepresentation");
          element2.setAttribute("Target", "FixedDocSeq.fdseq");
          element2 = document.createElement("Relationship");
          element.appendChild(element2);
          element2.setAttribute("Id", "rId2");
          element2.setAttribute("Type", "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties");
          element2.setAttribute("Target", "docProps/core.xml");
          return document;
      }
  
      private Document writeDocPropsCore(StiReport stiReport) throws ParserConfigurationException {
          Element element;
          DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
          Document document = documentBuilder.newDocument();
          Element element2 = document.createElement("cp:coreProperties");
          document.appendChild(element2);
          element2.setAttribute("xmlns:cp", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties");
          element2.setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/");
          element2.setAttribute("xmlns:dcterms", "http://purl.org/dc/terms/");
          element2.setAttribute("xmlns:dcmitype", "http://purl.org/dc/dcmitype/");
          element2.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance");
          String string = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'", Locale.ENGLISH).format(new Date());
          Element element3 = document.createElement("dcterms:created");
          element2.appendChild(element3);
          element3.setAttribute("xsi:type", "dcterms:W3CDTF");
          element3.setTextContent(string);
          Element element4 = document.createElement("dcterms:modified");
          element2.appendChild(element4);
          element4.setAttribute("xsi:type", "dcterms:W3CDTF");
          element4.setTextContent(string);
          if (stiReport.getReportName() != null && stiReport.getReportName().length() > 0) {
              element = document.createElement("dc:title");
              element2.appendChild(element);
              element.setTextContent(stiReport.getReportName());
          }
          if (stiReport.getReportAlias() != null && stiReport.getReportAlias().length() > 0) {
              element = document.createElement("dc:subject");
              element2.appendChild(element);
              element.setTextContent(stiReport.getReportAlias());
          }
          if (stiReport.getReportDescription() != null && stiReport.getReportDescription().length() > 0) {
              element = document.createElement("dc:description");
              element2.appendChild(element);
              element.setTextContent(stiReport.getReportDescription());
          }
          element = document.createElement("dc:creator");
          element2.appendChild(element);
          element.setTextContent(StiExportUtils.getReportVersion());
          return document;
      }
  
      private Document writeFixedDocSeq() throws ParserConfigurationException {
          DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
          Document document = documentBuilder.newDocument();
          Element element = document.createElement("FixedDocumentSequence");
          document.appendChild(element);
          element.setAttribute("xmlns", "http://schemas.microsoft.com/xps/2005/06");
          Element element2 = document.createElement("DocumentReference");
          element.appendChild(element2);
          element2.setAttribute("Source", "/Documents/1/FixedDoc.fdoc");
          return document;
      }
  
      private Document writeFixedDoc(StiPagesCollection stiPagesCollection) throws ParserConfigurationException {
          DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
          Document document = documentBuilder.newDocument();
          Element element = document.createElement("FixedDocument");
          document.appendChild(element);
          element.setAttribute("xmlns", "http://schemas.microsoft.com/xps/2005/06");
          for (int i = 0; i < stiPagesCollection.size(); ++i) {
              Element element2 = document.createElement("PageContent");
              element.appendChild(element2);
              element2.setAttribute("Source", String.format("Pages/%s.fpage", i + 1));
              ArrayList<String> arrayList = new ArrayList<String>();
              for (String string : this.pageBookmarks.keySet()) {
                  if (this.pageBookmarks.get(string) != i) continue;
                  arrayList.add(string);
              }
              if (arrayList.size() <= 0) continue;
              Element element3 = document.createElement("PageContent.LinkTargets");
              element2.appendChild(element3);
              for (String string2 : arrayList) {
                  Element element4 = document.createElement("LinkTarget");
                  element3.appendChild(element4);
                  element4.setAttribute("Name", string2);
              }
          }
          return document;
      }
  
      private Document writePage(StiPage stiPage, StiReport stiReport) throws ParserConfigurationException {
          double d;
          Object object;
          DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
          DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
          Document document = documentBuilder.newDocument();
          double d2 = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiPage.getPageHeight() * (double)stiPage.getSegmentPerHeight());
          double d3 = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiPage.getPageWidth() * (double)stiPage.getSegmentPerWidth());
          double d4 = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiPage.getMargins().getLeft());
          double d5 = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiPage.getMargins().getRight());
          double d6 = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiPage.getMargins().getTop());
          double d7 = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiPage.getMargins().getBottom());
          Element element = document.createElement("FixedPage");
          document.appendChild(element);
          element.setAttribute("xmlns", "http://schemas.microsoft.com/xps/2005/06");
          element.setAttribute("Width", String.format("%s", this.floatToString(d3)));
          element.setAttribute("Height", String.format("%s", this.floatToString(d2)));
          element.setAttribute("xml:lang", "en-EN");
          Element element2 = document.createElement("Canvas");
          element.appendChild(element2);
          this.writeHyperlinksData(element2, stiPage, false);
          if (stiPage.getBrush() != null) {
              object = new StiXpsData();
              object.x = 0.0;
              object.y = 0.0;
              object.width = d3;
              object.height = d2;
              object.component = new StiContainer();
              ((StiContainer)object.component).setBrush(stiPage.getBrush());
              ((StiContainer)object.component).setBorder(null);
              this.writeBorderFill(element2, (StiXpsData)object, document);
          }
          this.writeWatermark(element2, stiPage.getWatermark(), true, d3, d2, document);
          for (StiComponent stiComponent : stiPage.getComponents()) {
              if (!stiComponent.getEnabled()) continue;
              d = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiComponent.getLeft());
              double d8 = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiComponent.getTop());
              double d9 = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiComponent.getRight());
              double d10 = 0.9599999785423279 * stiReport.getUnit().ConvertToHInches(stiComponent.getBottom());
              StiXpsData stiXpsData = new StiXpsData();
              stiXpsData.x = d;
              stiXpsData.y = d8;
              stiXpsData.width = d9 - d;
              stiXpsData.height = d10 - d8;
              stiXpsData.y += d6;
              stiXpsData.x += d4;
              stiXpsData.component = stiComponent;
              if (!(stiComponent instanceof StiShape)) {
                  this.writeBorderFill(element2, stiXpsData, document);
              }
              if (stiComponent instanceof StiText && !stiComponent.isExportAsImage(StiExportFormat.Xps)) {
                  this.writeText(element2, stiXpsData, document);
              }
              if (stiComponent.isExportAsImage(StiExportFormat.Xps)) {
                  this.writeImage(element2, stiXpsData, document);
              }
              this.writeBorderStroke(element2, stiXpsData, document);
          }
          if (stiPage.getBorder() != null) {
              object = new StiXpsData();
              object.x = d4;
              object.y = d6;
              object.width = d3 - d4 - d5;
              object.height = d2 - d6 - d7;
              object.component = new StiContainer();
              ((StiContainer)object.component).setBorder(stiPage.getBorder());
              this.writeBorderStroke(element2, (StiXpsData)object, document);
          }
          this.writeWatermark(element2, stiPage.getWatermark(), false, d3, d2, document);
          double d11 = d3 / 794.0 * 5.0;
          d = d2 / 1123.0 * 5.0;
          if (d11 > d) {
              d11 = d;
          } else {
              d = d11;
          }
          Element element3 = document.createElement("Canvas");
          element2.appendChild(element3);
          element3.setAttribute("RenderTransform", String.format("%s,0,0,%s,%s,%s", this.floatToString(d11), this.floatToString(d), this.floatToString(d3 / 2.0), this.floatToString(d2 / 2.0)));
          Element element4 = document.createElement("Canvas");
          element3.appendChild(element4);
          element4.setAttribute("RenderTransform", "0.707,-0.707,0.707,0.707,0,0");
          Element element5 = document.createElement("Path");
          element4.appendChild(element5);
          element5.setAttribute("Stroke", "#40646464");
          element5.setAttribute("StrokeThickness", String.format("%s", this.floatToString(3.0)));
          element5.setAttribute("StrokeStartLineCap", "Round");
          element5.setAttribute("StrokeEndLineCap", "Round");
          element5.setAttribute("StrokeLineJoin", "Round");
          StringBuilder stringBuilder = new StringBuilder();
          stringBuilder.append("M 0,0 L 0,30 L 10,30 L 20,20 L 20,10 L 10,0 Z");
          stringBuilder.append("M 50,0 L 30,0 L 30,30 L 50,30 M 30,20 L 40,20 ");
          stringBuilder.append("M 60,0 L 60,30 L 70,20 L 80,30 L 80,0 ");
          stringBuilder.append("M 90,5 L 90,25 L 95,30 L 105,30 L 110,25 L 110,5 L 105,0 L 95,0 Z");
          element5.setAttribute("Data", stringBuilder.toString());
          element5.setAttribute("RenderTransform", String.format("1,0,0,-1,-55,15", new Object[0]));
          return document;
      }
  
      private void writeBorderFill(Element element, StiXpsData stiXpsData, Document document) {
          StiRichText stiRichText;
          IStiBrush iStiBrush;
          StiColor stiColor = StiColorEnum.Transparent.color();
          IStiBrush iStiBrush2 = iStiBrush = stiXpsData.component instanceof IStiBrush ? (IStiBrush)((Object)stiXpsData.component) : null;
          if (iStiBrush != null && iStiBrush.getBrush() != null) {
              stiColor = StiBrush.ToColor((StiBrush)iStiBrush.getBrush());
          }
          StiRichText stiRichText2 = stiRichText = stiXpsData.component instanceof StiRichText ? (StiRichText)stiXpsData.component : null;
          if (stiRichText != null) {
              stiColor = stiRichText.getBackColor();
          }
          if (stiColor.getA() != 0) {
              Element element2 = document.createElement("Path");
              element.appendChild(element2);
              element2.setAttribute("Data", String.format("M %s,%s L %s,%s L %s,%s L %s,%s Z ", this.floatToString(stiXpsData.x), this.floatToString(stiXpsData.y), this.floatToString(stiXpsData.x), this.floatToString(stiXpsData.y + stiXpsData.height), this.floatToString(stiXpsData.x + stiXpsData.width), this.floatToString(stiXpsData.y + stiXpsData.height), this.floatToString(stiXpsData.x + stiXpsData.width), this.floatToString(stiXpsData.y)));
              if (!(stiXpsData.component instanceof StiText) && !(stiXpsData.component instanceof StiImage)) {
                  this.writeHyperlinksData(element2, stiXpsData.component, false);
              }
              Element element3 = document.createElement("Path.Fill");
              element2.appendChild(element3);
              if (iStiBrush != null && iStiBrush.getBrush() != null && iStiBrush.getBrush() instanceof StiGradientBrush) {
                  StiGradientBrush stiGradientBrush = (StiGradientBrush)iStiBrush.getBrush();
                  double d = 1.0;
                  double d2 = 1.0;
                  double d3 = stiGradientBrush.getAngle();
                  if (d3 < 0.0) {
                      d3 += 360.0;
                  }
                  if (d3 >= 270.0 && d3 < 360.0) {
                      d3 = 360.0 - d3;
                      d2 = -1.0;
                  }
                  if (d3 >= 180.0 && d3 < 270.0) {
                      d3 -= 180.0;
                      d2 = -1.0;
                      d = -1.0;
                  }
                  if (d3 >= 90.0 && d3 < 180.0) {
                      d3 = 180.0 - d3;
                      d = -1.0;
                  }
                  d3 = d3 * 3.141592653589793 / 180.0;
                  double d4 = stiXpsData.x + stiXpsData.width / 2.0;
                  double d5 = stiXpsData.y + stiXpsData.height / 2.0;
                  double d6 = Math.sqrt(stiXpsData.width * stiXpsData.width + stiXpsData.height * stiXpsData.height) / 2.0;
                  double d7 = Math.atan2(stiXpsData.height, stiXpsData.width);
                  double d8 = 1.5707963267948966 - d3 + d7;
                  double d9 = d6 * Math.sin(d8);
                  double d10 = d9 * Math.cos(d3) * d;
                  double d11 = d9 * Math.sin(d3) * d2;
                  double d12 = d4 - d10;
                  double d13 = d4 + d10;
                  double d14 = d5 - d11;
                  double d15 = d5 + d11;
                  Element element4 = document.createElement("LinearGradientBrush");
                  element3.appendChild(element4);
                  element4.setAttribute("MappingMode", "Absolute");
                  element4.setAttribute("StartPoint", String.format("%s,%s", this.floatToString(d12), this.floatToString(d14)));
                  element4.setAttribute("EndPoint", String.format("%s,%s", this.floatToString(d13), this.floatToString(d15)));
                  Element element5 = document.createElement("LinearGradientBrush.GradientStops");
                  element4.appendChild(element5);
                  Element element6 = document.createElement("GradientStop");
                  element5.appendChild(element6);
                  element6.setAttribute("Color", stiGradientBrush.getStartColor().toArgbHTML());
                  element6.setAttribute("Offset", "0");
                  element6 = document.createElement("GradientStop");
                  element5.appendChild(element6);
                  element6.setAttribute("Color", stiGradientBrush.getEndColor().toArgbHTML());
                  element6.setAttribute("Offset", "1");
              } else {
                  Element element7 = document.createElement("SolidColorBrush");
                  element3.appendChild(element7);
                  element7.setAttribute("Color", stiColor.toArgbHTML());
              }
          } else if (this.writeHyperlinksData(element, stiXpsData.component, true) && !(stiXpsData.component instanceof StiText) && !(stiXpsData.component instanceof StiImage)) {
              Element element8 = document.createElement("Path");
              element.appendChild(element8);
              element8.setAttribute("Data", String.format("M %s,%s L %s,%s L %s,%s L %s,%s Z ", this.floatToString(stiXpsData.x), this.floatToString(stiXpsData.y), this.floatToString(stiXpsData.x), this.floatToString(stiXpsData.y + stiXpsData.height), this.floatToString(stiXpsData.x + stiXpsData.width), this.floatToString(stiXpsData.y + stiXpsData.height), this.floatToString(stiXpsData.x + stiXpsData.width), this.floatToString(stiXpsData.y)));
              this.writeHyperlinksData(element8, stiXpsData.component, false);
          }
      }
  
      private void writeBorderStroke(Element element, StiXpsData stiXpsData, Document document) {
          IStiBorder iStiBorder;
          IStiBorder iStiBorder2 = iStiBorder = stiXpsData.component instanceof IStiBorder ? (IStiBorder)((Object)stiXpsData.component) : null;
          if (iStiBorder != null) {
              boolean bl;
              StiAdvancedBorder stiAdvancedBorder;
              if (iStiBorder.getBorder().getDropShadow() && iStiBorder.getBorder().getShadowBrush() != null && (stiAdvancedBorder = StiBrush.ToColor((StiBrush)iStiBorder.getBorder().getShadowBrush())).getA() != 0) {
                  double d = iStiBorder.getBorder().getShadowSize();
                  Element element2 = document.createElement("Path");
                  element.appendChild(element2);
                  element2.setAttribute("Data", String.format("M %s,%s L %s,%s L %s,%s L %s,%s L %s,%s L %s,%s Z ", this.floatToString(stiXpsData.x + d), this.floatToString(stiXpsData.y + stiXpsData.height), this.floatToString(stiXpsData.x + stiXpsData.width), this.floatToString(stiXpsData.y + stiXpsData.height), this.floatToString(stiXpsData.x + stiXpsData.width), this.floatToString(stiXpsData.y + d), this.floatToString(stiXpsData.x + stiXpsData.width + d), this.floatToString(stiXpsData.y + d), this.floatToString(stiXpsData.x + stiXpsData.width + d), this.floatToString(stiXpsData.y + stiXpsData.height + d), this.floatToString(stiXpsData.x + d), this.floatToString(stiXpsData.y + stiXpsData.height + d)));
                  Element element3 = document.createElement("Path.Fill");
                  element2.appendChild(element3);
                  Element element4 = document.createElement("SolidColorBrush");
                  element3.appendChild(element4);
                  element4.setAttribute("Color", stiAdvancedBorder.toArgbHTML());
              }
              stiAdvancedBorder = iStiBorder.getBorder() instanceof StiAdvancedBorder ? (StiAdvancedBorder)iStiBorder.getBorder() : null;
              boolean bl2 = stiAdvancedBorder != null;
              StiRectanglePrimitive stiRectanglePrimitive = new StiRectanglePrimitive();
              if (stiXpsData.component instanceof StiRectanglePrimitive) {
                  stiRectanglePrimitive = (StiRectanglePrimitive)stiXpsData.component;
              }
              boolean bl3 = iStiBorder.getBorder().isLeftBorderSidePresent() && stiRectanglePrimitive.getLeftSide();
              boolean bl4 = iStiBorder.getBorder().isRightBorderSidePresent() && stiRectanglePrimitive.getRightSide();
              boolean bl5 = iStiBorder.getBorder().isTopBorderSidePresent() && stiRectanglePrimitive.getTopSide();
              boolean bl6 = iStiBorder.getBorder().isBottomBorderSidePresent() && stiRectanglePrimitive.getBottomSide();
              boolean bl7 = bl = !iStiBorder.getBorder().getSide().containsOnly((IStiEnum)StiBorderSides.None) && iStiBorder.getBorder().getStyle() != StiPenStyle.None;
              if (bl2) {
                  bl = !stiAdvancedBorder.getSide().containsOnly((IStiEnum)StiBorderSides.None);
              }
              StiBorderSide stiBorderSide = new StiBorderSide(iStiBorder.getBorder().getColor(), iStiBorder.getBorder().getSize(), iStiBorder.getBorder().getStyle());
              double d = 0.0;
              if (stiBorderSide.getStyle() == StiPenStyle.Double) {
                  d = 0.8999999761581421;
              }
              if (bl) {
                  String string;
                  StringBuilder stringBuilder = new StringBuilder();
                  if (bl3) {
                      if (bl2) {
                          stiBorderSide = stiAdvancedBorder.getLeftSide();
                          d = stiBorderSide.getStyle() == StiPenStyle.Double ? 0.9f : 0.0f;
                      }
                      string = String.format("M %s,%s L %s,%s ", this.floatToString(stiXpsData.x - d), this.floatToString(stiXpsData.y - d), this.floatToString(stiXpsData.x - d), this.floatToString(stiXpsData.y + d + stiXpsData.height));
                      if (stiBorderSide.getStyle() == StiPenStyle.Double) {
                          Object[] arrobject = new Object[4];
                          arrobject[0] = this.floatToString(stiXpsData.x + d);
                          arrobject[1] = this.floatToString(stiXpsData.y + (bl5 ? d : - d));
                          arrobject[2] = this.floatToString(stiXpsData.x + d);
                          arrobject[3] = this.floatToString(stiXpsData.y + (bl6 ? - d : d) + stiXpsData.height);
                          string = string + String.format("M %s,%s L %s,%s ", arrobject);
                      }
                      if (bl2) {
                          this.writeBorderSide(element, stiBorderSide, string, document);
                      } else {
                          stringBuilder.append(string);
                      }
                  }
                  if (bl4) {
                      if (bl2) {
                          stiBorderSide = stiAdvancedBorder.getRightSide();
                          d = stiBorderSide.getStyle() == StiPenStyle.Double ? 0.9f : 0.0f;
                      }
                      string = String.format("M %s,%s L %s,%s ", this.floatToString(stiXpsData.x + d + stiXpsData.width), this.floatToString(stiXpsData.y - d), this.floatToString(stiXpsData.x + d + stiXpsData.width), this.floatToString(stiXpsData.y + d + stiXpsData.height));
                      if (stiBorderSide.getStyle() == StiPenStyle.Double) {
                          Object[] arrobject = new Object[4];
                          arrobject[0] = this.floatToString(stiXpsData.x - d + stiXpsData.width);
                          arrobject[1] = this.floatToString(stiXpsData.y + (bl5 ? d : - d));
                          arrobject[2] = this.floatToString(stiXpsData.x - d + stiXpsData.width);
                          arrobject[3] = this.floatToString(stiXpsData.y + (bl6 ? - d : d) + stiXpsData.height);
                          string = string + String.format("M %s,%s L %s,%s ", arrobject);
                      }
                      if (bl2) {
                          this.writeBorderSide(element, stiBorderSide, string, document);
                      } else {
                          stringBuilder.append(string);
                      }
                  }
                  if (bl5) {
                      if (bl2) {
                          stiBorderSide = stiAdvancedBorder.getTopSide();
                          d = stiBorderSide.getStyle() == StiPenStyle.Double ? 0.9f : 0.0f;
                      }
                      string = String.format("M %s,%s L %s,%s ", this.floatToString(stiXpsData.x - d), this.floatToString(stiXpsData.y - d), this.floatToString(stiXpsData.x + d + stiXpsData.width), this.floatToString(stiXpsData.y - d));
                      if (stiBorderSide.getStyle() == StiPenStyle.Double) {
                          Object[] arrobject = new Object[4];
                          arrobject[0] = this.floatToString(stiXpsData.x + (bl3 ? d : - d));
                          arrobject[1] = this.floatToString(stiXpsData.y + d);
                          arrobject[2] = this.floatToString(stiXpsData.x + (bl4 ? - d : d) + stiXpsData.width);
                          arrobject[3] = this.floatToString(stiXpsData.y + d);
                          string = string + String.format("M %s,%s L %s,%s ", arrobject);
                      }
                      if (bl2) {
                          this.writeBorderSide(element, stiBorderSide, string, document);
                      } else {
                          stringBuilder.append(string);
                      }
                  }
                  if (bl6) {
                      if (bl2) {
                          stiBorderSide = stiAdvancedBorder.getBottomSide();
                          d = stiBorderSide.getStyle() == StiPenStyle.Double ? 0.9f : 0.0f;
                      }
                      string = String.format("M %s,%s L %s,%s ", this.floatToString(stiXpsData.x - d), this.floatToString(stiXpsData.y + d + stiXpsData.height), this.floatToString(stiXpsData.x + d + stiXpsData.width), this.floatToString(stiXpsData.y + d + stiXpsData.height));
                      if (stiBorderSide.getStyle() == StiPenStyle.Double) {
  