public ExternalNameRecord(RecordInputStream in1)
        {
            field_1_option_flag = in1.ReadShort();
            field_2_ixals       = in1.ReadShort();
            field_3_not_used    = in1.ReadShort();
            int numChars = in1.ReadUByte();

            field_4_name = StringUtil.ReadUnicodeString(in1, numChars);

            // the record body can take different forms.
            // The form is dictated by the values of 3-th and 4-th bits in field_1_option_flag
            if (!IsOLELink && !IsStdDocumentNameIdentifier)
            {
                // another switch: the fWantAdvise bit specifies whether the body describes
                // an external defined name or a DDE data item
                if (IsAutomaticLink)
                {
                    if (in1.Available() > 0)
                    {
                        //body specifies DDE data item
                        int nColumns = in1.ReadUByte() + 1;
                        int nRows    = in1.ReadShort() + 1;

                        int totalCount = nRows * nColumns;
                        _ddeValues = ConstantValueParser.Parse(in1, totalCount);
                        _nColumns  = nColumns;
                        _nRows     = nRows;
                    }
                }
                else
                {
                    //body specifies an external defined name
                    int formulaLen = in1.ReadUShort();
                    field_5_name_definition = Formula.Read(formulaLen, in1);
                }
            }
            //int nameLength = in1.ReadUByte();
            //int multibyteFlag = in1.ReadUByte();
            //if (multibyteFlag == 0)
            //{
            //    field_4_name = in1.ReadCompressedUnicode(nameLength);
            //}
            //else
            //{
            //    field_4_name = in1.ReadUnicodeLEString(nameLength);
            //}
            //if (!HasFormula)
            //{
            //    if (!IsStdDocumentNameIdentifier && !IsOLELink && IsAutomaticLink)
            //    {
            //        // both need to be incremented
            //        int nColumns = in1.ReadUByte() + 1;
            //        int nRows = in1.ReadShort() + 1;

            //        int totalCount = nRows * nColumns;
            //        _ddeValues = ConstantValueParser.Parse(in1, totalCount);
            //        _nColumns = nColumns;
            //        _nRows = nRows;
            //    }

            //    if (in1.Remaining > 0)
            //    {
            //        throw ReadFail("Some Unread data (is formula present?)");
            //    }
            //    field_5_name_definition = null;
            //    return;
            //}
            //int nBytesRemaining = in1.Available();
            //if (in1.Remaining <= 0)
            //{
            //    throw ReadFail("Ran out of record data trying to read formula.");
            //}
            //short formulaLen = in1.ReadShort();
            //nBytesRemaining -= 2;
            //field_5_name_definition = Frame.Utils.NPOI.SS.Formula.Formula.Read(formulaLen, in1, nBytesRemaining);
        }
Exemple #2
0
 /**
  * Constructs a Units record and Sets its fields appropriately.
  *
  * @param in the RecordInputstream to Read the record from
  */
 public UnitsRecord(RecordInputStream in1)
 {
     field_1_units = in1.ReadShort();
 }
Exemple #3
0
 /**
  * Read constructor
  */
 public UncalcedRecord(RecordInputStream in1)
 {
     _reserved = in1.ReadShort();
 }
        /**
         * Constructs an Codepage record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public InterfaceHdrRecord(RecordInputStream in1)
        {
            _codepage = in1.ReadShort();
        }
Exemple #5
0
        /**
         * Constructs a VCENTER record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public VCenterRecord(RecordInputStream in1)
        {
            field_1_vcenter = in1.ReadShort();
        }
 /**
  * @param in the RecordInputstream to Read the record from
  */
 public RefSubRecord(RecordInputStream in1)
     : this(in1.ReadShort(), in1.ReadShort(), in1.ReadShort())
 {
 }
Exemple #7
0
        /**
         * Constructs an HideObj record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public HideObjRecord(RecordInputStream in1)
        {
            field_1_hide_obj = in1.ReadShort();
        }
        /**
         * Constructs a DateWindow1904 record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public DateWindow1904Record(RecordInputStream in1)
        {
            field_1_window = in1.ReadShort();
        }
        /**
         * Constructs a Protect record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public ObjectProtectRecord(RecordInputStream in1)
        {
            field_1_protect = in1.ReadShort();
        }
Exemple #10
0
        /**
         * Constructs a PrintHeaders record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public PrintHeadersRecord(RecordInputStream in1)
        {
            field_1_print_headers = in1.ReadShort();
        }
Exemple #11
0
 public PrintSizeRecord(RecordInputStream in1)
 {
     printSize = in1.ReadShort();
 }
Exemple #12
0
        /**
         * Constructs a RefMode record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public RefModeRecord(RecordInputStream in1)
        {
            field_1_mode = in1.ReadShort();
        }
Exemple #13
0
        /**
         * Constructs a CalcCountRecord and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         *
         */

        public CalcCountRecord(RecordInputStream in1)
        {
            field_1_iterations = in1.ReadShort();
        }
Exemple #14
0
 private RkRec(RecordInputStream in1)
 {
     xf = in1.ReadShort();
     rk = in1.ReadInt();
 }
Exemple #15
0
        /**
         * Constructs a GridSet record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public GridsetRecord(RecordInputStream in1)
        {
            field_1_gridset_flag = in1.ReadShort();
        }
Exemple #16
0
        /**
         * Constructs a BlankRecord and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */

        public BlankRecord(RecordInputStream in1)
        {
            field_1_row = in1.ReadUShort();
            field_2_col = in1.ReadShort();
            field_3_xf  = in1.ReadShort();
        }
Exemple #17
0
 /**
  * Constructs a Extern Sheet Sub Record record and Sets its fields appropriately.
  *
  * @param in the RecordInputstream to Read the record from
  */
 public ExternSheetSubRecord(RecordInputStream in1)
 {
     field_1_index_to_supbook             = in1.ReadShort();
     field_2_index_to_first_supbook_sheet = in1.ReadShort();
     field_3_index_to_last_supbook_sheet  = in1.ReadShort();
 }
Exemple #18
0
        /**
         * Constructs a CountryRecord and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */

        public CountryRecord(RecordInputStream in1)
        {
            field_1_default_country = in1.ReadShort();
            field_2_current_country = in1.ReadShort();
        }
Exemple #19
0
        /**
         * Constructs a SCL record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public SCLRecord(RecordInputStream in1)
        {
            field_1_numerator   = in1.ReadShort();
            field_2_denominator = in1.ReadShort();
        }
 public InfoSubRecord(RecordInputStream in1)
 {
     field_1_stream_pos        = in1.ReadInt();
     field_2_bucket_sst_offset = in1.ReadShort();
     field_3_zero = in1.ReadShort();
 }
Exemple #21
0
        /**
         * Constructs an Iteration record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public IterationRecord(RecordInputStream in1)
        {
            _flags = in1.ReadShort();
        }
Exemple #22
0
        /**
         * Constructs a DBCellRecord and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public DSFRecord(RecordInputStream in1) : this(in1.ReadShort())
        {
        }
Exemple #23
0
        /**
         * Constructs a Password record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public PasswordRecord(RecordInputStream in1)
        {
            field_1_password = in1.ReadShort();
        }
        /**
         * Constructs a ProtectionRev4 record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public ProtectionRev4Record(RecordInputStream in1) :
            this(in1.ReadShort())
        {
        }
Exemple #25
0
        /**
         * Constructs a CalcModeRecord and Sets its fields appropriately
         * @param in the RecordInputstream to Read the record from
         */

        public CalcModeRecord(RecordInputStream in1)
        {
            field_1_calcmode = in1.ReadShort();
        }
Exemple #26
0
        /**
         * Constructs a Precision record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public PrecisionRecord(RecordInputStream in1)
        {
            field_1_precision = in1.ReadShort();
        }
Exemple #27
0
        /**
         * Read hyperlink from input stream
         *
         * @param in the stream to Read from
         */
        public HyperlinkRecord(RecordInputStream in1)
        {
            _range = new CellRangeAddress(in1);

            // 16-byte GUID
            _guid = new GUID(in1);

            /*
             * streamVersion (4 bytes): An unsigned integer that specifies the version number
             * of the serialization implementation used to save this structure. This value MUST equal 2.
             */
            int streamVersion = in1.ReadInt();

            if (streamVersion != 0x00000002)
            {
                throw new RecordFormatException("Stream Version must be 0x2 but found " + streamVersion);
            }
            _linkOpts = in1.ReadInt();

            if ((_linkOpts & HLINK_LABEL) != 0)
            {
                int label_len = in1.ReadInt();
                _label = in1.ReadUnicodeLEString(label_len);
            }
            if ((_linkOpts & HLINK_TARGET_FRAME) != 0)
            {
                int len = in1.ReadInt();
                _targetFrame = in1.ReadUnicodeLEString(len);
            }
            if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) != 0)
            {
                _moniker = null;
                int nChars = in1.ReadInt();
                _address = in1.ReadUnicodeLEString(nChars);
            }
            if ((_linkOpts & HLINK_URL) != 0 && (_linkOpts & HLINK_UNC_PATH) == 0)
            {
                _moniker = new GUID(in1);

                if (URL_MONIKER.Equals(_moniker))
                {
                    int length = in1.ReadInt();

                    /*
                     * The value of <code>length<code> be either the byte size of the url field
                     * (including the terminating NULL character) or the byte size of the url field plus 24.
                     * If the value of this field is set to the byte size of the url field,
                     * then the tail bytes fields are not present.
                     */
                    int remaining = in1.Remaining;
                    if (length == remaining)
                    {
                        int nChars = length / 2;
                        _address = in1.ReadUnicodeLEString(nChars);
                    }
                    else
                    {
                        int nChars = (length - TAIL_SIZE) / 2;
                        _address = in1.ReadUnicodeLEString(nChars);

                        /*
                         * TODO: make sense of the remaining bytes
                         * According to the spec they consist of:
                         * 1. 16-byte  GUID: This field MUST equal
                         *    {0xF4815879, 0x1D3B, 0x487F, 0xAF, 0x2C, 0x82, 0x5D, 0xC4, 0x85, 0x27, 0x63}
                         * 2. Serial version, this field MUST equal 0 if present.
                         * 3. URI Flags
                         */
                        _uninterpretedTail = ReadTail(URL_uninterpretedTail, in1);
                    }
                }
                else if (FILE_MONIKER.Equals(_moniker))
                {
                    _fileOpts = in1.ReadShort();

                    int len = in1.ReadInt();
                    _shortFilename     = StringUtil.ReadCompressedUnicode(in1, len);
                    _uninterpretedTail = ReadTail(FILE_uninterpretedTail, in1);
                    int size = in1.ReadInt();
                    if (size > 0)
                    {
                        int charDataSize = in1.ReadInt();

                        //From the spec: An optional unsigned integer that MUST be 3 if present
                        int optFlags = in1.ReadUShort();
                        if (optFlags != 0x0003)
                        {
                            throw new RecordFormatException("Expected 0x3 but found " + optFlags);
                        }
                        _address = StringUtil.ReadUnicodeLE(in1, charDataSize / 2);
                    }
                    else
                    {
                        _address = null;
                    }
                }
                else if (STD_MONIKER.Equals(_moniker))
                {
                    _fileOpts = in1.ReadShort();

                    int len = in1.ReadInt();

                    byte[] path_bytes = new byte[len];
                    in1.ReadFully(path_bytes);

                    _address = Encoding.UTF8.GetString(path_bytes);
                }
            }

            if ((_linkOpts & HLINK_PLACE) != 0)
            {
                int len = in1.ReadInt();
                _textMark = in1.ReadUnicodeLEString(len);
            }

            if (in1.Remaining > 0)
            {
                Console.WriteLine(HexDump.ToHex(in1.ReadRemainder()));
            }
        }
        /**
         * Constructs a Protect record and Sets its fields appropriately.
         * @param in the RecordInputstream to Read the record from
         */

        public ScenarioProtectRecord(RecordInputStream in1)
        {
            field_1_protect = in1.ReadShort();
        }