public Comment_AnnotationPacket(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     if (prefixID > -1)
     {
         text = new GeneralWPText_Packet(document, childID[0] - 1);
         if (_data[dataIndex] == 0)
         {
             commentType = CommentType.comment;
         }
         else
         {
             commentType = CommentType.annotation;
             commentTime = new DateTime(BitConverter.ToInt16(_data, dataIndex + 1), _data[dataIndex + 3],
                                        _data[dataIndex + 4], _data[dataIndex + 5], _data[dataIndex + 6], _data[dataIndex + 7]);
             color.red     = (double)_data[dataIndex + 11] / 255;
             color.green   = (double)_data[dataIndex + 12] / 255;
             color.blue    = (double)_data[dataIndex + 13] / 255;
             color.shading = (double)_data[dataIndex + 14] / 255;
             dataIndex    += 14; //this is not what the spec says but is what actually works!!!
             userInitials  = getWPWordString();
             userName      = getWPWordString();
         }
     }
 }
Example #2
0
        public MarkTextForGenerateDefinitionPacket(WP6Document document, int prefixID) :
            base(document, prefixID)
        {
            _document  = document;
            type       = (TypeOfMarkedTextDefinition)_data[dataIndex];
            numberMode = (NumberMode)_data[dataIndex + 1];
            dataIndex += 2;
            switch (type)
            {
            case TypeOfMarkedTextDefinition.ToC:
            {
                ParseToCDefinition();
                break;
            }

            case TypeOfMarkedTextDefinition.Index:
            {
                ParseIndexDefinition();
                break;
            }

            case TypeOfMarkedTextDefinition.List:
            {
                ParseListDefinition();
                break;
            }

            case TypeOfMarkedTextDefinition.ToA:
            {
                ParseToADefinition();
                break;
            }
            }
        }
Example #3
0
 public Undo(WP6Document doc, int index, int size)
     : base(doc, index, size)
 {
     undoType = (UndoType)Enum.Parse(typeof(UndoType), functionData[0].ToString());
     // bytes 1 and 2 are not useful for external applications
     name = FixedLengthGroup.undo;
 }
Example #4
0
 public NativeFileNamePacket(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     if (prefixID > -1)   // test to see if there actually is a prefixID associated with the calling function
     {
         if (index.flags.HasFlag(IndexFlags.childPacketIDs))
         {
             childIDTag = new short[childIDCount];
             for (int i = 0; i < childIDCount; i++)
             {
                 childIDTag[i] = BitConverter.ToInt16(_data, dataIndex);
                 dataIndex    += 2;
             }
             filename = getWPWordString();
         }
         else
         {
             filename = getWPWordString();
         }
     }
     else
     {
         filename = "";
     }
 }
        public static ParagraphGroupFunction getFunction(WP6Document doc, int index)
        {
            WP6_FunctionKey key = new WP6_FunctionKey(doc.data[index], doc.data[index + 1]);

            if (WP6_FunctionNames.map.ContainsKey(key))
            {
                ParagraphGroup name = (ParagraphGroup)WP6_FunctionNames.map[key];
                switch (name)
                {
                case ParagraphGroup.set_line_height:            // xD3 00 (211 00)
                    return(new SetLineHeight(doc, index));

                case ParagraphGroup.set_line_spacing:
                    return(new SetLineSpacing(doc, index));

                case ParagraphGroup.begin_generated_text:
                    return(new BeginGeneratedText(doc, index));

                case ParagraphGroup.end_of_generated_text:
                    return(new EndOfGeneratedText(doc, index));

                case ParagraphGroup.define_marked_text:
                    return(new DefineMarkedText(doc, index));

                default:
                    return(new ParagraphGroupFunction(doc, index));
                }
            }
            return(new ParagraphGroupFunction(doc, index));
        }
Example #6
0
 public StyleBeginOn(WP6Document doc, int index)
     : base(doc, index)
 {
     info = new NormalStylePacket(doc, prefixIds[0] - 1);
     hash = BitConverter.ToInt16(nonDeletableInfo, 0);
     systemStyleNumber = nonDeletableInfo[2];
 }
Example #7
0
 public Color(WP6Document doc, int index)
     : base(doc, index)
 {
     color.red   = (double)nonDeletableInfo[0] / 255;
     color.green = (double)nonDeletableInfo[1] / 255;
     color.blue  = (double)nonDeletableInfo[2] / 255;
 }
Example #8
0
 public HypertextBeginOn(WP6Document doc, int index)
     : base(doc, index)
 {
     filename_or_macro_PID = new NativeFileNamePacket(doc, prefixIds[0] - 1);  // WP starts index areas with 1
     bookmarkPID           = new HypertextBookmarkNamePacket(doc, prefixIds[1] - 1);
     hypertextAction       = nonDeletableInfo[0];
 }
 public PageNumberFormatStringPacket(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     if (prefixID > -1)
     {
         pageNumberFormatString = getWPWordString();
     }
 }
 public CrossReferenceTagPacket(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     if (prefixID > -1)
     {
         targetname = getWPWordString();
     }
 }
 public HypertextBookmarkNamePacket(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     if (prefixID > 0)
     {
         bookmarkName = getWPWordString();
     }
 }
 public SetThousandsSeparatorCharacter(WP6Document doc, int index)
     : base(doc, index)
 {
     separator = ((char)nonDeletableInfo[0]).ToString();
     if (nonDeletableInfo[1] > 0)
     {
         separator += ((char)nonDeletableInfo[1]).ToString();
     }
 }
Example #13
0
 public DocumentArea(WP6Document doc)
 {
     document = doc;
     data     = document.data;
     index    = document.fileHeader.ptrDocumentArea;
     stop     = data.Length;
     WPStream = new List <WPToken>();
     parseDocumentArea();
 }
Example #14
0
 /// <summary>
 /// Use this constructor to parse other data packets containing WP text
 /// </summary>
 /// <param name="doc"></param>
 /// <param name="data"></param>
 /// <param name="index"></param>
 public DocumentArea(WP6Document doc, int index, int stop)
 {
     document   = doc;
     data       = document.data;
     this.index = index;
     this.stop  = stop;
     WPStream   = new List <WPToken>();
     parseDocumentArea();
 }
Example #15
0
 public HighlightOff(WP6Document doc, int index, int size)
     : base(doc, index, size)
 {
     redValue       = functionData[0];
     greenValue     = functionData[1];
     blueValue      = functionData[2];
     percentShading = functionData[3];
     name           = FixedLengthGroup.highlight_off;
 }
Example #16
0
 public NormalStylePacket(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     _document = document;
     if (prefixID > -1)
     {
         getContents();
     }
 }
Example #17
0
        }                                                //measurement in WPUs

        public SetLineHeight(WP6Document doc, int index)
            : base(doc, index)
        {
            linesPerInch = BitConverter.ToInt16(nonDeletableInfo, 0);
            if (nonDeletableInfo.Length > 2)
            {
                minimumLinesPerInch = BitConverter.ToInt16(nonDeletableInfo, 2);
            }
        }
Example #18
0
 public VariableLengthFunction(WP6Document doc, int index)
 {
     document      = doc;
     _index        = index;
     _startIndex   = index;
     _data         = document.data;
     prefixIds     = new int[0]; // initialize null array in case no prefix IDs exist
     prefixIdCount = 0;          // set to 0 in case no prefix IDs exist
     parseFunction();
 }
Example #19
0
        public SetLanguage(WP6Document doc, int index)
            : base(doc, index)
        {
            string languageCode = ((char)nonDeletableInfo[0]).ToString() + ((char)nonDeletableInfo[1]).ToString();

            if (Languages.map.ContainsKey(languageCode))
            {
                language = Languages.map[languageCode];
            }
        }
Example #20
0
 public IndexMarkPacket(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     if (prefixID > -1)
     {
         indexName  = getWPWordString();
         heading    = getWPWordString();
         subheading = getWPWordString();
     }
 }
Example #21
0
 public Header_FooterFunction(WP6Document doc, int index)
     : base(doc, index)
 {
     // for now, ignore the possible second prefixID (user assistant)
     if (prefixIds[0] > 0)
     {
         content = new GeneralWPText_Packet(document, prefixIds[0] - 1);
         // WP numbers prefixIDs beginning with 1, so need to subtract 1 to get correct ID
     }
     occurrence = (Header_FooterOccurrence)nonDeletableInfo[0];  // cast to enum
 }
Example #22
0
 public FixedLengthFunction(WP6Document doc, int index, int size)
 {
     this.size     = size;
     document      = doc;
     _index        = index;
     _data         = document.data;
     name          = FixedLengthGroup.none;
     functionGroup = functionGroups.fixedLength;
     codeValue     = (_data[_index + 2] << 8 | _data[_index + 1]) + PUA;
     parseFunction();
 }
Example #23
0
 public BookmarkPacket(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     if (prefixID > -1)
     {
         dataIndex   += 2; //skip past reserved 2 bytes
         flags        = (BookmarkDataFlags)_data[dataIndex];
         dataIndex   += 2; // skip another reserved byte
         bookmarkName = getWPWordString();
     }
 }
Example #24
0
        public StartOfDelayedCodes(WP6Document doc, int index)
            : base(doc, index)
        {
            info = new List <DelayedCodesInfo>();
            short numIds = nonDeletableInfo[0];

            for (int i = 1; i <= numIds; i++)
            {
                info.Add(new DelayedCodesInfo(BitConverter.ToInt16(nonDeletableInfo, i),
                                              BitConverter.ToInt16(nonDeletableInfo, i + 2), BitConverter.ToInt16(nonDeletableInfo, i + 4)));
            }
        }
Example #25
0
 public TableOfAuthorityEntry(WP6Document doc, int index)
     : base(doc, index)
 {
     if (flags.HasFlag(flagsByte.prefixID))
     {
         TOAPacket     = new TableOfAuthoritiesMarkPacket(doc, prefixIds[0]);
         shortFormName = TOAPacket.shortFormName;
     }
     else
     {
         shortFormName = UtilityMethods.getWPWordString(doc.data, _startIndex, _startIndex + size - 1);
     }
 }
Example #26
0
 public SetDotLeaderCharacters(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     if (nonDeletableInfo[1] > 0)
     {
         dotLeaderCharacter = new ExtendedCharacter(nonDeletableInfo[1], nonDeletableInfo[0]).content;
     }
     else
     {
         dotLeaderCharacter = ((char)nonDeletableInfo[0]).ToString();
     }
     numSpacesBetweenCharacters = nonDeletableInfo[2];
 }
Example #27
0
        public static StyleGroupFunction getFunction(WP6Document doc, int index)
        {
            WP6_FunctionKey key = new WP6_FunctionKey(doc.data[index], doc.data[index + 1]);

            if (WP6_FunctionNames.map.ContainsKey(key))
            {
                StyleGroup name = (StyleGroup)WP6_FunctionNames.map[key];
                switch (name)
                {
                case StyleGroup.style_begin_on:
                    return(new StyleBeginOn(doc, index));               //  0xDD 00   221 0

                case StyleGroup.style_begin_off:
                    return(new StyleBeginOff(doc, index));              // 0xDD 01    221 1

                case StyleGroup.style_end_on:
                    return(new StyleEndOn(doc, index));                 // 0xDD 02    221 2

                case StyleGroup.style_end_off:
                    return(new StyleEndOff(doc, index));                // 0xDD 03    221 3

                case StyleGroup.paragraph_style_begin_on_part_1:
                    return(new ParagraphStyleBeginOn_Part1(doc, index));    // 0xDD 04  221 4

                case StyleGroup.paragraph_style_begin_off_part_1:
                    return(new ParagraphStyleBeginOff_Part1(doc, index));     // 0xDD 05    221 5

                case StyleGroup.paragraph_style_begin_on_part_2:
                    return(new ParagraphStyleBeginOn_Part2(doc, index));        // 0xDD 06  221 6

                case StyleGroup.paragraph_style_begin_off_part_2:
                    return(new ParagraphStyleBeginOff_Part2(doc, index));       // 0xDD 07  221 7

                case StyleGroup.paragraph_style_end_on:
                    return(new ParagraphStyleEndOn(doc, index));                // 0xDD 08  221 8

                case StyleGroup.paragraph_style_end_off:
                    return(new ParagraphStyleEndOff(doc, index));               // 0xDD09   221 9

                case StyleGroup.global_on:
                    return(new GlobalOn(doc, index));                           // 0xDD0A   221 10

                case StyleGroup.global_off:
                    return(new GlobalOff(doc, index));                          // 0xDD0B   221 11

                default:
                    return(new StyleGroupFunction(doc, index));
                }
            }
            return(new StyleGroupFunction(doc, index));
        }
Example #28
0
 public GeneralWPText_Packet(WP6Document document, int prefixID) :
     base(document, prefixID)
 {
     if (prefixID > -1)
     {
         packetText = new DocumentArea[numTextBlocks];
         for (int i = 0; i < numTextBlocks; i++)
         {
             byte[] currentTextBlock = new byte[sizeofBlock[i]];
             Array.Copy(_data, dataIndex, currentTextBlock, 0, currentTextBlock.Length);
             packetText[i] = new DocumentArea(document, dataIndex, currentTextBlock.Length + dataIndex);
             dataIndex    += sizeofBlock[i];
         }
     }
 }