/** * Gets the data */ public virtual byte[] getData() { byte[] data = new byte[18]; int options = 0; if (promptBoxVisible) { options |= PROMPT_BOX_VISIBLE_MASK; } if (promptBoxAtCell) { options |= PROMPT_BOX_AT_CELL_MASK; } if (validityDataCached) { options |= VALIDITY_DATA_CACHED_MASK; } IntegerHelper.getTwoBytes(options, data, 0); IntegerHelper.getFourBytes(objectId, data, 10); IntegerHelper.getFourBytes(numDVRecords, data, 14); return(data); }
/** * Gets the data */ public virtual byte[] getData() { // Compute the length of the data byte[] f1Bytes = formula1 != null?formula1.getBytes() : new byte[0]; byte[] f2Bytes = formula2 != null?formula2.getBytes() : new byte[0]; int dataLength = 4 + // the options promptTitle.Length * 2 + 3 + // the prompt title errorTitle.Length * 2 + 3 + // the error title promptText.Length * 2 + 3 + // the prompt text errorText.Length * 2 + 3 + // the error text f1Bytes.Length + 2 + // first formula f2Bytes.Length + 2 + // second formula +4 + // unused bytes 10; // cell range byte[] data = new byte[dataLength]; // The position int pos = 0; // The options int options = 0; options |= type.getValue(); options |= errorStyle.getValue() << 4; options |= condition.getValue() << 20; if (stringListGiven) { options |= STRING_LIST_GIVEN_MASK; } if (emptyCellsAllowed) { options |= EMPTY_CELLS_ALLOWED_MASK; } if (suppressArrow) { options |= SUPPRESS_ARROW_MASK; } if (showPrompt) { options |= SHOW_PROMPT_MASK; } if (showError) { options |= SHOW_ERROR_MASK; } // The text IntegerHelper.getFourBytes(options, data, pos); pos += 4; IntegerHelper.getTwoBytes(promptTitle.Length, data, pos); pos += 2; data[pos] = (byte)0x1; // unicode indicator pos++; StringHelper.getUnicodeBytes(promptTitle, data, pos); pos += promptTitle.Length * 2; IntegerHelper.getTwoBytes(errorTitle.Length, data, pos); pos += 2; data[pos] = (byte)0x1; // unicode indicator pos++; StringHelper.getUnicodeBytes(errorTitle, data, pos); pos += errorTitle.Length * 2; IntegerHelper.getTwoBytes(promptText.Length, data, pos); pos += 2; data[pos] = (byte)0x1; // unicode indicator pos++; StringHelper.getUnicodeBytes(promptText, data, pos); pos += promptText.Length * 2; IntegerHelper.getTwoBytes(errorText.Length, data, pos); pos += 2; data[pos] = (byte)0x1; // unicode indicator pos++; StringHelper.getUnicodeBytes(errorText, data, pos); pos += errorText.Length * 2; // Formula 1 IntegerHelper.getTwoBytes(f1Bytes.Length, data, pos); pos += 4; System.Array.Copy(f1Bytes, 0, data, pos, f1Bytes.Length); pos += f1Bytes.Length; // Formula 2 IntegerHelper.getTwoBytes(f2Bytes.Length, data, pos); pos += 4; System.Array.Copy(f2Bytes, 0, data, pos, f2Bytes.Length); pos += f2Bytes.Length; // The cell ranges IntegerHelper.getTwoBytes(1, data, pos); pos += 2; IntegerHelper.getTwoBytes(row1, data, pos); pos += 2; IntegerHelper.getTwoBytes(row2, data, pos); pos += 2; IntegerHelper.getTwoBytes(column1, data, pos); pos += 2; IntegerHelper.getTwoBytes(column2, data, pos); pos += 2; return(data); }
/** * Sets the child * * @param dir the child */ public void setChild(int dir) { child = dir; IntegerHelper.getFourBytes(child, data, CHILD_POS); }
/** * Sets the next block * * @param nxt the next block */ public void setNext(int nxt) { next = nxt; IntegerHelper.getFourBytes(next, data, NEXT_POS); }
/** * Sets the previous block * * @param prev the previous block */ public void setPrevious(int prev) { previous = prev; IntegerHelper.getFourBytes(prev, data, PREVIOUS_POS); }
/** * Sets the size of the file * * @param s the size */ public void setSize(int s) { size = s; IntegerHelper.getFourBytes(s, data, SIZE_POS); }
/** * Sets the number of the start block * * @param sb the number of the start block */ public void setStartBlock(int sb) { startBlock = sb; IntegerHelper.getFourBytes(sb, data, START_BLOCK_POS); }