/**
   * Method to convert a set of &quot;Device&quot; <code>Document</code> objects into a <code>
   * SxcDocument</code> object and returns it as a <code>Document</code>.
   *
   * <p>This method is not thread safe for performance reasons. This method should not be called
   * from within two threads. It would be best to call this method only once per object instance.
   *
   * @return document An <code>SxcDocument</code> consisting of the data converted from the input
   *     stream.
   * @throws ConvertException If any conversion error occurs.
   * @throws IOException If any I/O error occurs.
   */
  public Document deserialize() throws ConvertException, IOException {

    // Get the name of the WorkBook from the ConvertData.
    String[] worksheetNames = getWorksheetNames(cd);
    String workbookName = getWorkbookName(cd);

    // Create a document
    SxcDocument sxcDoc = new SxcDocument(workbookName);
    sxcDoc.initContentDOM();
    sxcDoc.initSettingsDOM();

    // Default to an initial 5 entries in the catalog.
    styleCat = new StyleCatalog(5);

    doc = sxcDoc.getContentDOM();
    settings = sxcDoc.getSettingsDOM();
    initFontTable();
    // Little fact for the curious reader: workbookName should
    // be the name of the StarCalc file minus the file extension suffix.

    // Create a Decoder to decode the DeviceContent to a spreadsheet document
    // TODO - we aren't using a password in StarCalc, so we can
    // use any value for password here.  If StarCalc XML supports
    // passwords in the future, we should try to get the correct
    // password value here.

    decoder = createDecoder(workbookName, worksheetNames, "password");

    Debug.log(Debug.TRACE, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
    Debug.log(Debug.TRACE, "<DEBUGLOG>");

    decoder.addDeviceContent(cd);
    decode();

    Debug.log(Debug.TRACE, "</DEBUGLOG>");

    return sxcDoc;
  }