/**
   * Serialises out the String. There are special rules about where we can and can't split onto
   * Continue records.
   */
  public void serialize(ContinuableRecordOutput out) {
    int numberOfRichTextRuns = 0;
    int extendedDataSize = 0;
    if (isRichText() && field_4_format_runs != null) {
      numberOfRichTextRuns = field_4_format_runs.size();
    }
    if (isExtendedText() && field_5_ext_rst != null) {
      extendedDataSize = 4 + field_5_ext_rst.getDataSize();
    }

    // Serialise the bulk of the String
    // The writeString handles tricky continue stuff for us
    out.writeString(field_3_string, numberOfRichTextRuns, extendedDataSize);

    if (numberOfRichTextRuns > 0) {

      // This will ensure that a run does not split a continue
      for (int i = 0; i < numberOfRichTextRuns; i++) {
        if (out.getAvailableSpace() < 4) {
          out.writeContinue();
        }
        FormatRun r = field_4_format_runs.get(i);
        r.serialize(out);
      }
    }

    if (extendedDataSize > 0) {
      field_5_ext_rst.serialize(out);
    }
  }
  private void serializeTXORecord(ContinuableRecordOutput out) {

    out.writeShort(field_1_options);
    out.writeShort(field_2_textOrientation);
    out.writeShort(field_3_reserved4);
    out.writeShort(field_4_reserved5);
    out.writeShort(field_5_reserved6);
    out.writeShort(_text.length());
    out.writeShort(getFormattingDataLength());
    out.writeInt(field_8_reserved7);

    if (_linkRefPtg != null) {
      int formulaSize = _linkRefPtg.getSize();
      out.writeShort(formulaSize);
      out.writeInt(_unknownPreFormulaInt);
      _linkRefPtg.write(out);
      if (_unknownPostFormulaByte != null) {
        out.writeByte(_unknownPostFormulaByte.byteValue());
      }
    }
  }
 private static void writeFormatData(ContinuableRecordOutput out, HSSFRichTextString str) {
   int nRuns = str.numFormattingRuns();
   for (int i = 0; i < nRuns; i++) {
     out.writeShort(str.getIndexOfFormattingRun(i));
     int fontIndex = str.getFontOfFormattingRun(i);
     out.writeShort(fontIndex == str.NO_FONT ? 0 : fontIndex);
     out.writeInt(0); // skip reserved
   }
   out.writeShort(str.length());
   out.writeShort(0);
   out.writeInt(0); // skip reserved
 }
    protected void serialize(ContinuableRecordOutput out) {
      int dataSize = getDataSize();

      out.writeContinueIfRequired(8);
      out.writeShort(reserved);
      out.writeShort(dataSize);
      out.writeShort(formattingFontIndex);
      out.writeShort(formattingOptions);

      out.writeContinueIfRequired(6);
      out.writeShort(numberOfRuns);
      out.writeShort(phoneticText.length());
      out.writeShort(phoneticText.length());

      out.writeContinueIfRequired(phoneticText.length() * 2);
      StringUtil.putUnicodeLE(phoneticText, out);

      for (int i = 0; i < phRuns.length; i++) {
        phRuns[i].serialize(out);
      }

      out.write(extraData);
    }
 private void serializeTrailingRecords(ContinuableRecordOutput out) {
   out.writeContinue();
   out.writeStringData(_text.getString());
   out.writeContinue();
   writeFormatData(out, _text);
 }
Beispiel #6
0
 protected void serialize(ContinuableRecordOutput out) {
   out.writeShort(_text.length());
   out.writeStringData(_text);
 }
 private void serialize(ContinuableRecordOutput out) {
   out.writeContinueIfRequired(6);
   out.writeShort(phoneticTextFirstCharacterOffset);
   out.writeShort(realTextFirstCharacterOffset);
   out.writeShort(realTextLength);
 }