Пример #1
0
        /**
         * @param ris the RecordInputstream to read the record from
         */
        public NameCommentRecord(RecordInputStream ris)
        {
            ILittleEndianInput in1 = ris;

            field_1_record_type       = in1.ReadShort();
            field_2_frt_cell_ref_flag = in1.ReadShort();
            field_3_reserved          = in1.ReadLong();
            int field_4_name_length    = in1.ReadShort();
            int field_5_comment_length = in1.ReadShort();

            if (in1.ReadByte() == 0)
            {
                field_6_name_text = StringUtil.ReadCompressedUnicode(in1, field_4_name_length);
            }
            else
            {
                field_6_name_text = StringUtil.ReadUnicodeLE(in1, field_4_name_length);
            }
            if (in1.ReadByte() == 0)
            {
                field_7_comment_text = StringUtil.ReadCompressedUnicode(in1, field_5_comment_length);
            }
            else
            {
                field_7_comment_text = StringUtil.ReadUnicodeLE(in1, field_5_comment_length);
            }
        }
Пример #2
0
        /**
         * Constructs a CommonObjectData record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public CommonObjectDataSubRecord(ILittleEndianInput in1, int size)
        {
            if (size != 18)
            {
                throw new RecordFormatException("Expected size 18 but got (" + size + ")");
            }
            field_1_objectType = in1.ReadShort();
            field_2_objectId   = in1.ReadUShort();
            field_3_option     = in1.ReadShort();
            field_4_reserved1  = in1.ReadInt();
            field_5_reserved2  = in1.ReadInt();
            field_6_reserved3  = in1.ReadInt();
        }
Пример #3
0
        /**
         * Reads a 16 bit, signed value
         */

        public short ReadShort()
        {
            CheckRecordPosition(LittleEndianConsts.SHORT_SIZE);
            _currentDataOffset += LittleEndianConsts.SHORT_SIZE;
            pos += LittleEndianConsts.SHORT_SIZE;
            return(_dataInput.ReadShort());
        }
Пример #4
0
        public ColorGradientFormatting(ILittleEndianInput in1)
        {
            in1.ReadShort(); // Ignored
            in1.ReadByte();  // Reserved
            int numI = in1.ReadByte();
            int numG = in1.ReadByte();

            if (numI != numG)
            {
                //log.Log(POILogger.WARN, "Inconsistent Color Gradient defintion, found " + numI + " vs " + numG + " entries");
            }
            options = (byte)in1.ReadByte();

            thresholds = new ColorGradientThreshold[numI];
            for (int i = 0; i < thresholds.Length; i++)
            {
                thresholds[i] = new ColorGradientThreshold(in1);
            }
            colors = new ExtendedColor[numG];
            for (int i = 0; i < colors.Length; i++)
            {
                in1.ReadDouble(); // Slightly pointless step counter
                colors[i] = new ExtendedColor(in1);
            }
        }
Пример #5
0
 public FtCfSubRecord(ILittleEndianInput in1, int size)
 {
     if (size != length)
     {
         throw new RecordFormatException("Unexpected size (" + size + ")");
     }
     flags = in1.ReadShort();
 }
Пример #6
0
 public FtPioGrbitSubRecord(ILittleEndianInput in1, int size)
 {
     if (size != length)
     {
         throw new RecordFormatException("Unexpected size (" + size + ")");
     }
     flags = in1.ReadShort();
 }
Пример #7
0
 public ScrollableObjectSubRecord(ILittleEndianInput in1, int size)
 {
     if (size != this.DataSize)
     {
         throw new RecordFormatException(string.Format(CultureInfo.CurrentCulture, "Expected size {0} but got ({1})", this.DataSize, size));
     }
     in1.ReadInt();
     field_1_iVal     = in1.ReadShort();
     field_2_iMin     = in1.ReadShort();
     field_3_iMax     = in1.ReadShort();
     field_4_dInc     = in1.ReadShort();
     field_5_dPage    = in1.ReadShort();
     field_6_fHoriz   = in1.ReadShort();
     field_7_dxScroll = in1.ReadShort();
     field_8_options  = in1.ReadShort();
 }
 public ScrollableObjectSubRecord(ILittleEndianInput in1, int size)
 {
     if (size !=this.DataSize)
     {
         throw new RecordFormatException(string.Format(CultureInfo.CurrentCulture, "Expected size {0} but got ({1})", this.DataSize, size));
     }
     in1.ReadInt();
     field_1_iVal=in1.ReadShort();
     field_2_iMin=in1.ReadShort();
     field_3_iMax=in1.ReadShort();
     field_4_dInc=in1.ReadShort();
     field_5_dPage=in1.ReadShort();
     field_6_fHoriz = in1.ReadShort();
     field_7_dxScroll = in1.ReadShort();
     field_8_options = in1.ReadShort();
 }
Пример #9
0
        internal StandardEncryptionHeader(ILittleEndianInput is1)
        {
            Flags           = (is1.ReadInt());
            SizeExtra       = (is1.ReadInt());
            CipherAlgorithm = (CipherAlgorithm.FromEcmaId(is1.ReadInt()));
            HashAlgorithm   = (HashAlgorithm.FromEcmaId(is1.ReadInt()));
            int keySize = is1.ReadInt();

            if (keySize == 0)
            {
                // for the sake of inheritance of the cryptoAPI classes
                // see 2.3.5.1 RC4 CryptoAPI Encryption Header
                // If Set to 0x00000000, it MUST be interpreted as 0x00000028 bits.
                keySize = 0x28;
            }
            KeySize        = (keySize);
            BlockSize      = (keySize);
            CipherProvider = (CipherProvider.FromEcmaId(is1.ReadInt()));

            is1.ReadLong(); // skip reserved

            // CSPName may not always be specified
            // In some cases, the salt value of the EncryptionVerifier is the next chunk of data
            ((ByteArrayInputStream)is1).Mark(LittleEndianConsts.INT_SIZE + 1);
            int CheckForSalt = is1.ReadInt();

            ((ByteArrayInputStream)is1).Reset();

            if (CheckForSalt == 16)
            {
                CspName = ("");
            }
            else
            {
                StringBuilder builder = new StringBuilder();
                while (true)
                {
                    char c = (char)is1.ReadShort();
                    if (c == 0)
                    {
                        break;
                    }
                    builder.Append(c);
                }
                CspName = (builder.ToString());
            }

            ChainingMode = (ChainingMode.ecb);
            KeySalt      = (null);
        }
Пример #10
0
 public DataSpaceVersionInfo(ILittleEndianInput is1)
 {
     featureIdentifier   = ReadUnicodeLPP4(is1);
     readerVersionMajor  = is1.ReadShort();
     readerVersionMinor  = is1.ReadShort();
     updaterVersionMajor = is1.ReadShort();
     updaterVersionMinor = is1.ReadShort();
     writerVersionMajor  = is1.ReadShort();
     writerVersionMinor  = is1.ReadShort();
 }
Пример #11
0
            public TransformInfoHeader(ILittleEndianInput is1)
            {
                int length = is1.ReadInt();

                transformType       = is1.ReadInt();
                transformerId       = ReadUnicodeLPP4(is1);
                transformerName     = ReadUnicodeLPP4(is1);
                readerVersionMajor  = is1.ReadShort();
                readerVersionMinor  = is1.ReadShort();
                updaterVersionMajor = is1.ReadShort();
                updaterVersionMinor = is1.ReadShort();
                writerVersionMajor  = is1.ReadShort();
                writerVersionMinor  = is1.ReadShort();
            }
Пример #12
0
            /**
             * Read in the actual token (array) values. This occurs
             * AFTER the last Ptg in the expression.
             * See page 304-305 of Excel97-2007BinaryFileFormat(xls)Specification.pdf
             */
            public ArrayPtg FinishReading(ILittleEndianInput in1)
            {
                int   nColumns = in1.ReadUByte();
                short nRows    = in1.ReadShort();

                //The token_1_columns and token_2_rows do not follow the documentation.
                //The number of physical rows and columns is actually +1 of these values.
                //Which is not explicitly documented.
                nColumns++;
                nRows++;

                int totalCount = nRows * nColumns;

                Object[] arrayValues = ConstantValueParser.Parse(in1, totalCount);

                ArrayPtg result = new ArrayPtg(_reserved0, _reserved1, _reserved2, nColumns, nRows, arrayValues);

                result.PtgClass = this.PtgClass;
                return(result);
            }
Пример #13
0
        /** Creates new Threshold */
        protected Threshold(ILittleEndianInput in1)
        {
            type = (byte)in1.ReadByte();
            short formulaLen = in1.ReadShort();

            if (formulaLen > 0)
            {
                formula = Formula.Read(formulaLen, in1);
            }
            else
            {
                formula = Formula.Create(null);
            }
            // Value is only there for non-formula, non min/max thresholds
            if (formulaLen == 0 && type != RangeType.MIN.id &&
                type != RangeType.MAX.id)
            {
                value = in1.ReadDouble();
            }
        }
Пример #14
0
        public IconMultiStateFormatting(ILittleEndianInput in1)
        {
            in1.ReadShort(); // Ignored
            in1.ReadByte();  // Reserved
            int num = in1.ReadByte();
            int set = in1.ReadByte();

            iconSet = IconSet.ById(set);
            if (iconSet.num != num)
            {
                //log.Log(POILogger.WARN, "Inconsistent Icon Set defintion, found " + iconSet + " but defined as " + num + " entries");
            }
            options = (byte)in1.ReadByte();

            thresholds = new Threshold[iconSet.num];
            for (int i = 0; i < thresholds.Length; i++)
            {
                thresholds[i] = new IconMultiStateThreshold(in1);
            }
        }
Пример #15
0
 public AttrPtg(ILittleEndianInput in1)
 {
     field_1_options = (byte)in1.ReadByte();
     field_2_data    = in1.ReadShort();
     if (IsOptimizedChoose)
     {
         int   nCases    = field_2_data;
         int[] jumpTable = new int[nCases];
         for (int i = 0; i < jumpTable.Length; i++)
         {
             jumpTable[i] = in1.ReadUShort();
         }
         _jumpTable        = jumpTable;
         _chooseFuncOffset = in1.ReadUShort();
     }
     else
     {
         _jumpTable        = null;
         _chooseFuncOffset = -1;
     }
 }
Пример #16
0
        public AttrPtg(ILittleEndianInput in1)
        {
            field_1_options =(byte)in1.ReadByte();
            field_2_data = in1.ReadShort();
            if (IsOptimizedChoose)
            {
                int nCases = field_2_data;
                int[] jumpTable = new int[nCases];
                for (int i = 0; i < jumpTable.Length; i++)
                {
                    jumpTable[i] = in1.ReadUShort();
                }
                _jumpTable = jumpTable;
                _chooseFuncOffset = in1.ReadUShort();
            }
            else
            {
                _jumpTable = null;
                _chooseFuncOffset = -1;
            }

        }
Пример #17
0
        public static String ReadUnicodeLPP4(ILittleEndianInput is1)
        {
            int length = is1.ReadInt();

            if (length % 2 != 0)
            {
                throw new EncryptedDocumentException(
                          "UNICODE-LP-P4 structure is a multiple of 4 bytes. "
                          + "If PAdding is present, it MUST be exactly 2 bytes long");
            }

            String result = StringUtil.ReadUnicodeLE(is1, length / 2);

            if (length % 4 == 2)
            {
                // PAdding (variable): A Set of bytes that MUST be of the correct size such that the size of the
                // UNICODE-LP-P4 structure is a multiple of 4 bytes. If PAdding is present, it MUST be exactly
                // 2 bytes long, and each byte MUST be 0x00.
                is1.ReadShort();
            }

            return(result);
        }
Пример #18
0
        public DataBarFormatting(ILittleEndianInput in1)
        {
            in1.ReadShort(); // Ignored
            in1.ReadByte();  // Reserved
            options = (byte)in1.ReadByte();

            percentMin = (byte)in1.ReadByte();
            percentMax = (byte)in1.ReadByte();
            if (percentMin < 0 || percentMin > 100)
            {
                //log.Log(POILogger.WARN, "Inconsistent Minimum Percentage found " + percentMin);
                Console.WriteLine("Inconsistent Minimum Percentage found " + percentMin);
            }

            if (percentMax < 0 || percentMax > 100)
            {
                //log.Log(POILogger.WARN, "Inconsistent Minimum Percentage found " + percentMin);
                Console.WriteLine("Inconsistent Minimum Percentage found " + percentMin);
            }

            color        = new ExtendedColor(in1);
            thresholdMin = new DataBarThreshold(in1);
            thresholdMax = new DataBarThreshold(in1);
        }
Пример #19
0
 /**Creates new function pointer from a byte array
  * usually called while reading an excel file.
  */
 public static FuncVarPtg Create(ILittleEndianInput in1)
 {
     return(Create(in1.ReadByte(), in1.ReadShort()));
 }
Пример #20
0
        /**
         * Constructs an EmbeddedObjectRef record and Sets its fields appropriately.
         *
         * @param in the record input stream.
         */
        public EmbeddedObjectRefSubRecord(ILittleEndianInput in1, int size)
        {
            // Much guess-work going on here due to lack of any documentation.
            // See similar source code in OOO:
            // http://lxr.go-oo.org/source/sc/sc/source/filter/excel/xiescher.cxx
            // 1223 void XclImpOleObj::ReadPictFmla( XclImpStream& rStrm, sal_uInt16 nRecSize )

            int streamIdOffset = in1.ReadShort(); // OOO calls this 'nFmlaLen'
            int remaining      = size - LittleEndianConsts.SHORT_SIZE;

            int dataLenAfterFormula = remaining - streamIdOffset;
            int formulaSize         = in1.ReadUShort();

            remaining          -= LittleEndianConsts.SHORT_SIZE;
            field_1_unknown_int = in1.ReadInt();
            remaining          -= LittleEndianConsts.INT_SIZE;
            byte[] formulaRawBytes = ReadRawData(in1, formulaSize);
            remaining     -= formulaSize;
            field_2_refPtg = ReadRefPtg(formulaRawBytes);
            if (field_2_refPtg == null)
            {
                // common case
                // field_2_n16 seems to be 5 here
                // The formula almost looks like tTbl but the row/column values seem like garbage.
                field_2_unknownFormulaData = formulaRawBytes;
            }
            else
            {
                field_2_unknownFormulaData = null;
            }


            int stringByteCount;

            if (remaining >= dataLenAfterFormula + 3)
            {
                int tag = in1.ReadByte();
                stringByteCount = LittleEndianConsts.BYTE_SIZE;
                if (tag != 0x03)
                {
                    throw new RecordFormatException("Expected byte 0x03 here");
                }
                int nChars = in1.ReadUShort();
                stringByteCount += LittleEndianConsts.SHORT_SIZE;
                if (nChars > 0)
                {
                    // OOO: the 4th way Xcl stores a unicode string: not even a Grbit byte present if Length 0
                    field_3_unicode_flag = (in1.ReadByte() & 0x01) != 0;
                    stringByteCount     += LittleEndianConsts.BYTE_SIZE;
                    if (field_3_unicode_flag)
                    {
                        field_4_ole_classname = StringUtil.ReadUnicodeLE(in1, nChars);
                        stringByteCount      += nChars * 2;
                    }
                    else
                    {
                        field_4_ole_classname = StringUtil.ReadCompressedUnicode(in1, nChars);
                        stringByteCount      += nChars;
                    }
                }
                else
                {
                    field_4_ole_classname = "";
                }
            }
            else
            {
                field_4_ole_classname = null;
                stringByteCount       = 0;
            }
            remaining -= stringByteCount;
            // Pad to next 2-byte boundary
            if (((stringByteCount + formulaSize) % 2) != 0)
            {
                int b = in1.ReadByte();
                remaining -= LittleEndianConsts.BYTE_SIZE;
                if (field_2_refPtg != null && field_4_ole_classname == null)
                {
                    field_4_unknownByte = (byte)b;
                }
            }
            int nUnexpectedPadding = remaining - dataLenAfterFormula;

            if (nUnexpectedPadding > 0)
            {
                Console.WriteLine("Discarding " + nUnexpectedPadding + " unexpected padding bytes ");
                ReadRawData(in1, nUnexpectedPadding);
                remaining -= nUnexpectedPadding;
            }

            // Fetch the stream ID
            if (dataLenAfterFormula >= 4)
            {
                field_5_stream_id = in1.ReadInt();
                remaining        -= LittleEndianConsts.INT_SIZE;
            }
            else
            {
                field_5_stream_id = null;
            }

            field_6_unknown = ReadRawData(in1, remaining);
        }
Пример #21
0
            internal ExtRst(ILittleEndianInput in1, int expectedLength)
            {
                reserved = in1.ReadShort();

                // Old style detection (Reserved = 0xFF)
                if (reserved == -1)
                {
                    populateEmpty();
                    return;
                }

                // Spot corrupt records
                if (reserved != 1)
                {
                    _logger.Log(POILogger.WARN, "Warning - ExtRst has wrong magic marker, expecting 1 but found " + reserved + " - ignoring");
                    // Grab all the remaining data, and ignore it
                    for (int i = 0; i < expectedLength - 2; i++)
                    {
                        in1.ReadByte();
                    }
                    // And make us be empty
                    populateEmpty();
                    return;
                }

                // Carry on Reading in as normal
                short stringDataSize = in1.ReadShort();

                formattingFontIndex = in1.ReadShort();
                formattingOptions   = in1.ReadShort();

                // RPHSSub
                numberOfRuns = in1.ReadUShort();
                short length1 = in1.ReadShort();
                // No really. Someone Clearly forgot to read
                //  the docs on their datastructure...
                short length2 = in1.ReadShort();

                // And sometimes they write out garbage :(
                if (length1 == 0 && length2 > 0)
                {
                    length2 = 0;
                }
                if (length1 != length2)
                {
                    throw new InvalidOperationException(
                              "The two length fields of the Phonetic Text don't agree! " +
                              length1 + " vs " + length2
                              );
                }
                phoneticText = StringUtil.ReadUnicodeLE(in1, length1);

                int RunData = stringDataSize - 4 - 6 - (2 * phoneticText.Length);
                int numRuns = (RunData / 6);

                phRuns = new PhRun[numRuns];
                for (int i = 0; i < phRuns.Length; i++)
                {
                    phRuns[i] = new PhRun(in1);
                }

                int extraDataLength = RunData - (numRuns * 6);

                if (extraDataLength < 0)
                {
                    //System.err.Println("Warning - ExtRst overran by " + (0-extraDataLength) + " bytes");
                    extraDataLength = 0;
                }
                extraData = new byte[extraDataLength];
                for (int i = 0; i < extraData.Length; i++)
                {
                    extraData[i] = (byte)in1.ReadByte();
                }
            }
Пример #22
0
 public FormatRun(ILittleEndianInput in1) :
     this(in1.ReadShort(), in1.ReadShort())
 {
 }
Пример #23
0
        /**
         * Constructs an EmbeddedObjectRef record and Sets its fields appropriately.
         *
         * @param in the record input stream.
         */
        public EmbeddedObjectRefSubRecord(ILittleEndianInput in1, int size)
        {
            // Much guess-work going on here due to lack of any documentation.
            // See similar source code in OOO:
            // http://lxr.go-oo.org/source/sc/sc/source/filter/excel/xiescher.cxx
            // 1223 void XclImpOleObj::ReadPictFmla( XclImpStream& rStrm, sal_uInt16 nRecSize )

            int streamIdOffset = in1.ReadShort(); // OOO calls this 'nFmlaLen'
            int remaining = size - LittleEndianConsts.SHORT_SIZE;

            int dataLenAfterFormula = remaining - streamIdOffset;
            int formulaSize = in1.ReadUShort();

            remaining -= LittleEndianConsts.SHORT_SIZE;
            field_1_unknown_int = in1.ReadInt();
            remaining -= LittleEndianConsts.INT_SIZE;
            byte[] formulaRawBytes = ReadRawData(in1, formulaSize);
            remaining -= formulaSize;
            field_2_refPtg = ReadRefPtg(formulaRawBytes);
            if (field_2_refPtg == null)
            {
                // common case
                // field_2_n16 seems to be 5 here
                // The formula almost looks like tTbl but the row/column values seem like garbage.
                field_2_unknownFormulaData = formulaRawBytes;
            }
            else
            {
                field_2_unknownFormulaData = null;
            }


            int stringByteCount;
            if (remaining >= dataLenAfterFormula + 3)
            {
                int tag = in1.ReadByte();
                stringByteCount = LittleEndianConsts.BYTE_SIZE;
                if (tag != 0x03)
                {
                    throw new RecordFormatException("Expected byte 0x03 here");
                }
                int nChars = in1.ReadUShort();
                stringByteCount += LittleEndianConsts.SHORT_SIZE;
                if (nChars > 0)
                {
                    // OOO: the 4th way Xcl stores a unicode string: not even a Grbit byte present if Length 0
                    field_3_unicode_flag = (in1.ReadByte() & 0x01) != 0;
                    stringByteCount += LittleEndianConsts.BYTE_SIZE;
                    if (field_3_unicode_flag)
                    {
                        field_4_ole_classname = StringUtil.ReadUnicodeLE(in1,nChars);
                        stringByteCount += nChars * 2;
                    }
                    else
                    {
                        field_4_ole_classname = StringUtil.ReadCompressedUnicode(in1,nChars);
                        stringByteCount += nChars;
                    }
                }
                else
                {
                    field_4_ole_classname = "";
                }
            }
            else
            {
                field_4_ole_classname = null;
                stringByteCount = 0;
            }
            remaining -= stringByteCount;
            // Pad to next 2-byte boundary
            if (((stringByteCount + formulaSize) % 2) != 0)
            {
                int b = in1.ReadByte();
                remaining -= LittleEndianConsts.BYTE_SIZE;
                if (field_2_refPtg != null && field_4_ole_classname == null)
                {
                    field_4_unknownByte = (byte)b;
                }
            }
            int nUnexpectedPadding = remaining - dataLenAfterFormula;

            if (nUnexpectedPadding > 0)
            {
                logger.Log(POILogger.ERROR, "Discarding " + nUnexpectedPadding + " unexpected padding bytes ");
                ReadRawData(in1, nUnexpectedPadding);
                remaining -= nUnexpectedPadding;
            }

            // Fetch the stream ID
            if (dataLenAfterFormula >= 4)
            {
                field_5_stream_id = in1.ReadInt();
                remaining -= LittleEndianConsts.INT_SIZE;
            }
            else
            {
                field_5_stream_id = null;
            }

            field_6_unknown = ReadRawData(in1, remaining);
        }
Пример #24
0
 public Ref3DPtg(ILittleEndianInput in1)
 {
     field_1_index_extern_sheet = in1.ReadShort();
     ReadCoordinates(in1);
 }
Пример #25
0
            /**
             * Read in the actual token (array) values. This occurs
             * AFTER the last Ptg in the expression.
             * See page 304-305 of Excel97-2007BinaryFileFormat(xls)Specification.pdf
             */
            public ArrayPtg FinishReading(ILittleEndianInput in1)
            {
                int nColumns = in1.ReadUByte();
                short nRows = in1.ReadShort();
                //The token_1_columns and token_2_rows do not follow the documentation.
                //The number of physical rows and columns is actually +1 of these values.
                //Which is not explicitly documented.
                nColumns++;
                nRows++;

                int totalCount = nRows * nColumns;
                Object[] arrayValues = ConstantValueParser.Parse(in1, totalCount);

                ArrayPtg result = new ArrayPtg(_reserved0, _reserved1, _reserved2, nColumns, nRows, arrayValues);
                result.PtgClass = this.PtgClass;
                return result;
            }
Пример #26
0
 public MemAreaPtg(ILittleEndianInput in1)
 {
     field_1_reserved  = in1.ReadInt();
     field_2_subex_len = in1.ReadShort();
 }
Пример #27
0
        public EncryptionInfo(ILittleEndianInput dis, bool isCryptoAPI)
        {
            EncryptionMode encryptionMode;

            _versionMajor = dis.ReadShort();
            _versionMinor = dis.ReadShort();

            if (!isCryptoAPI &&
                VersionMajor == EncryptionMode.BinaryRC4.VersionMajor &&
                VersionMinor == EncryptionMode.BinaryRC4.VersionMinor)
            {
                encryptionMode   = EncryptionMode.BinaryRC4;
                _encryptionFlags = -1;
            }
            else if (!isCryptoAPI &&
                     VersionMajor == EncryptionMode.Agile.VersionMajor &&
                     VersionMinor == EncryptionMode.Agile.VersionMinor)
            {
                encryptionMode   = EncryptionMode.Agile;
                _encryptionFlags = dis.ReadInt();
            }
            else if (!isCryptoAPI &&
                     2 <= VersionMajor && VersionMajor <= 4 &&
                     VersionMinor == EncryptionMode.Standard.VersionMinor)
            {
                encryptionMode   = EncryptionMode.Standard;
                _encryptionFlags = dis.ReadInt();
            }
            else if (isCryptoAPI &&
                     2 <= VersionMajor && VersionMajor <= 4 &&
                     VersionMinor == EncryptionMode.CryptoAPI.VersionMinor)
            {
                encryptionMode   = EncryptionMode.CryptoAPI;
                _encryptionFlags = dis.ReadInt();
            }
            else
            {
                _encryptionFlags = dis.ReadInt();
                throw new EncryptedDocumentException(
                          "Unknown encryption: version major: " + VersionMajor +
                          " / version minor: " + VersionMinor +
                          " / fCrypto: " + flagCryptoAPI.IsSet(EncryptionFlags) +
                          " / fExternal: " + flagExternal.IsSet(EncryptionFlags) +
                          " / fDocProps: " + flagDocProps.IsSet(EncryptionFlags) +
                          " / fAES: " + flagAES.IsSet(EncryptionFlags));
            }

            IEncryptionInfoBuilder eib;

            try
            {
                eib = GetBuilder(encryptionMode);
            }
            catch (Exception e)
            {
                throw new IOException(e.Message, e);
            }

            eib.Initialize(this, dis);
            _header    = eib.GetHeader();
            _verifier  = eib.GetVerifier();
            _decryptor = eib.GetDecryptor();
            _encryptor = eib.GetEncryptor();
        }
Пример #28
0
 public ExpPtg(ILittleEndianInput in1)
 {
     field_1_first_row = in1.ReadShort();
     field_2_first_col = in1.ReadShort();
 }
Пример #29
0
 public MemAreaPtg(ILittleEndianInput in1)
 {
     field_1_reserved = in1.ReadInt();
     field_2_subex_len = in1.ReadShort();
 }
Пример #30
0
 public ExpPtg(ILittleEndianInput in1)
 {
     field_1_first_row = in1.ReadShort();
     field_2_first_col = in1.ReadShort();
 }
Пример #31
0
 public Area3DPtg(ILittleEndianInput in1)
 {
     field_1_index_extern_sheet = in1.ReadShort();
     ReadCoordinates(in1);
 }
Пример #32
0
        /** Creates new NamePtg */

        public NamePtg(ILittleEndianInput in1)
        {
            field_1_label_index = in1.ReadShort();
            field_2_zero        = in1.ReadShort();
        }
Пример #33
0
        /**
         * Constructs a CommonObjectData record and Sets its fields appropriately.
         *
         * @param in the RecordInputstream to Read the record from
         */

        public CommonObjectDataSubRecord(ILittleEndianInput in1, int size)
        {
            if (size != 18)
            {
                throw new RecordFormatException("Expected size 18 but got (" + size + ")");
            }
            field_1_objectType = in1.ReadShort();
            field_2_objectId = in1.ReadUShort();
            field_3_option = in1.ReadShort();
            field_4_reserved1 = in1.ReadInt();
            field_5_reserved2 = in1.ReadInt();
            field_6_reserved3 = in1.ReadInt();
        }
Пример #34
0
         /**Creates new function pointer from a byte array
  * usually called while reading an excel file.
  */
 public static FuncVarPtg Create(ILittleEndianInput in1)  {
     return Create(in1.ReadByte(), in1.ReadShort());
 }
Пример #35
0
        /** Creates new NamePtg */

        public NamePtg(ILittleEndianInput in1)
        {
            field_1_label_index = in1.ReadShort();
            field_2_zero = in1.ReadShort();
        }