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)); }
public StyleEndOn(WP6Document doc, int index) : base(doc, index) { info = new NormalStylePacket(doc, prefixIds[0] - 1); hash = BitConverter.ToInt16(nonDeletableInfo, 0); systemStyleNumber = nonDeletableInfo[2]; }
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; }
private void button1_Click(object sender, EventArgs e) { string path = textBox1.Text; doc = new WP6Document(path); this.Close(); }
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 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; } } }
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 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(); } } }
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; }
public static FixedLengthFunction getFunction(WP6Document doc, int index) { FixedLengthGroup _name = (FixedLengthGroup)Enum.Parse(typeof(FixedLengthGroup), doc.data[index].ToString()); switch (_name) { case FixedLengthGroup.attribute_on: return new AttributeOn(doc, index, 3); case FixedLengthGroup.attribute_off: return new AttributeOff(doc, index, 3); case FixedLengthGroup.extended_character: return new ExtendedCharacter(doc, index, 4); case FixedLengthGroup.undo: return new Undo(doc, index, 5); case FixedLengthGroup.highlight_on: return new HighlightOn(doc, index, 6); case FixedLengthGroup.highlight_off: return new HighlightOff(doc, index, 6); case FixedLengthGroup.reserved1: case FixedLengthGroup.reserved2: return new FixedLengthFunction(doc, index, 3); //return empty function case FixedLengthGroup.reserved3: case FixedLengthGroup.reserved4: case FixedLengthGroup.reserved5: return new FixedLengthFunction(doc, index, 4); //return empty function case FixedLengthGroup.reserved6: case FixedLengthGroup.reserved7: return new FixedLengthFunction(doc, index, 5); //return empty function case FixedLengthGroup.reserved8: case FixedLengthGroup.reserved9: return new FixedLengthFunction(doc, index, 8); //return empty function } return null; }
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); }
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 HypertextBookmarkNamePacket(WP6Document document, int prefixID) : base(document, prefixID) { if (prefixID > 0) { bookmarkName = getWPWordString(); } }
public CrossReferenceTagPacket(WP6Document document, int prefixID) : base(document, prefixID) { if (prefixID > -1) { targetname = getWPWordString(); } }
public PageNumberFormatStringPacket(WP6Document document, int prefixID) : base(document, prefixID) { if (prefixID > -1) { pageNumberFormatString = getWPWordString(); } }
public SetThousandsSeparatorCharacter(WP6Document doc, int index) : base(doc, index) { separator = ((char)nonDeletableInfo[0]).ToString(); if (nonDeletableInfo[1] > 0) { separator += ((char)nonDeletableInfo[1]).ToString(); } }
public NormalStylePacket(WP6Document document, int prefixID) : base(document, prefixID) { _document = document; if (prefixID > -1) { getContents(); } }
public SetLineHeight(WP6Document doc, int index) : base(doc, index) { linesPerInch = BitConverter.ToInt16(nonDeletableInfo, 0); if (nonDeletableInfo.Length > 2) { minimumLinesPerInch = BitConverter.ToInt16(nonDeletableInfo, 2); } }
public DocumentArea(WP6Document doc) { document = doc; data = document.data; index = document.fileHeader.ptrDocumentArea; stop = data.Length; WPStream = new List <WPToken>(); parseDocumentArea(); }
/// <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(); }
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; }
public DocumentArea(WP6Document doc) { document = doc; data = document.data; index = document.fileHeader.ptrDocumentArea; stop= data.Length; WPStream = new List<WPToken>(); parseDocumentArea(); }
public HighlightOn(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_on; }
public FontSizeChange(WP6Document doc, int index) : base(doc, index) { oldDesiredTypefaceDescriptor = new FontTypefaceDescriptorPoolPacket(doc, prefixIds[0] - 1); desiredPointSize = BitConverter.ToInt16(nonDeletableInfo, 0); hashOfMatchedTypefaceDesscriptor = BitConverter.ToInt16(nonDeletableInfo, 2); matchedFontIndex = BitConverter.ToInt16(nonDeletableInfo, 4); matchedPointSizeOfFont = BitConverter.ToInt16(nonDeletableInfo, 6); }
/// <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(); }
public FontFaceChange(WP6Document doc, int index) : base(doc, index) { fontDescriptor = new FontTypefaceDescriptorPoolPacket(doc, prefixIds[0] - 1); oldMatchedPointSize = BitConverter.ToInt16(nonDeletableInfo, 0); hashOfMatchedTypefaceDesscriptor = BitConverter.ToInt16(nonDeletableInfo, 2); matchedFontIndex = BitConverter.ToInt16(nonDeletableInfo, 4); matchedPointSizeOfFont = BitConverter.ToInt16(nonDeletableInfo, 6); }
public IndexMarkPacket(WP6Document document, int prefixID) : base(document, prefixID) { if (prefixID > -1) { indexName = getWPWordString(); heading = getWPWordString(); subheading = getWPWordString(); } }
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]; } }
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(); }
public TableOfAuthoritiesMarkPacket(WP6Document document, int prefixID) : base(document, prefixID) { if (prefixID > -1) { childPID = new GeneralWPText_Packet(document, prefixID); shortFormName = getWPWordString(); TOASectionName = getWPWordString(); } }
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(); } }
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 }
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(); }
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(); } }
public PrefixTimeStamp(WP6Document document, int prefixID) : base(document, prefixID) { date = ToDateTime(BitConverter.ToInt32(_data, dataIndex)); build = BitConverter.ToInt32(_data, dataIndex + 4); minor = _data[dataIndex + 8]; patch = _data[dataIndex + 9]; version = BitConverter.ToInt16(_data, dataIndex + 10); wpVersion = version.ToString() + "." + minor.ToString() + "." + patch.ToString() + "." + build.ToString(); }
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))); } }
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); } }
static void Main(string[] args) { Console.OutputEncoding = System.Text.Encoding.Unicode; // used for testing only string TestingURL = ""; string FileName = "WPReaderTest.wpd"; WP6Document doc = new WP6Document(TestingURL + FileName); Console.WriteLine("Press any key to exit..."); Console.ReadKey(); }
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]; }
public BeginHiddenText(WP6Document doc, int index) : base(doc, index) { sbyte num = (sbyte)nonDeletableInfo[0]; if (num >= 0 && num < 8) { outlineLevelNumber = num; } noParagraphNumbers = num == 8; outlineLevelBit4 = num == 0x10; hiddenTableCellInformation = num == -1; hiddenByHideSelection = num == -2; // I have no idea what these properites are used for... levelNumberAtTimeOfHide = nonDeletableInfo[1]; }
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]; } } }
public static VariableLengthFunction getfunction(WP6Document doc, int index) { functionGroups functionGroup = (functionGroups)Enum.Parse(typeof(functionGroups), doc.data[index].ToString()); switch (functionGroup) { case functionGroups.EOL: return new EOLFunction(doc, index); case functionGroups.page: return ParsePageGroupFunction.getFunction(doc, index); case functionGroups.column: return ParseColumnGroupFunction.getFunction(doc, index); case functionGroups.paragraph: return ParseParagrapghGroupFunction.getFunction(doc, index); case functionGroups.character: return ParseCharacterGroupFunction.getFunction(doc, index); case functionGroups.cross_reference: return new Cross_ReferenceFunction(doc, index); case functionGroups.header_footer: return new Header_FooterFunction(doc, index); case functionGroups.footnote_endnote: return ParseFootnote_EndnoteFunction.getFunction(doc, index); case functionGroups.set_number: return new SetNumberFunction(doc, index); case functionGroups.numbering_method: return new NumberingMethodFunction(doc, index); case functionGroups.display_number: return new DisplayNumberFunction(doc, index); case functionGroups.increment_number: return new IncrementNumberFunction(doc, index); case functionGroups.decrement_number: return new DecrementNumberFunction(doc, index); case functionGroups.style: return ParseStyleGroupFunction.getFunction(doc, index); case functionGroups.merge: return new MergeFunction(doc, index); case functionGroups.box: return new BoxFunction(doc, index); case functionGroups.tab: return new TabFunction(doc, index); case functionGroups.platform: return new PlatformFunction(doc, index); case functionGroups.formatter: return new FormatterFunction(doc, index); } return null; }
public static Footnote_EndnoteFunction getFunction(WP6Document doc, int index) { WP6_FunctionKey key = new WP6_FunctionKey(doc.data[index], doc.data[index+1]); if (WP6_FunctionNames.map.ContainsKey(key)) { Footnote_EndnoteGroup name = (Footnote_EndnoteGroup)WP6_FunctionNames.map[key]; switch (name) { case Footnote_EndnoteGroup.footnote_on: return new FootnoteOn(doc, index); // 0x D7 00 215 0 case Footnote_EndnoteGroup.footnote_off: return new FootnoteOff(doc, index); // 0x D7 01 215 1 case Footnote_EndnoteGroup.endnote_on: return new EndNoteOn(doc, index); // 0x D7 02 215 2 case Footnote_EndnoteGroup.endnote_off: return new EndnoteOff(doc, index); // 0x D7 03 215 3 } } return null; }
public static PageGroupFunction getFunction(WP6Document doc, int index) { WP6_FunctionKey key = new WP6_FunctionKey(doc.data[index], doc.data[index+1]); if (WP6_FunctionNames.map.ContainsKey(key)) { PageGroup name = (PageGroup)WP6_FunctionNames.map[key]; switch (name) { case PageGroup.top_margin_set: return new TopMarginSet(doc, index); case PageGroup.bottom_margin_set: return new BottomMarginSet(doc, index); default: return new PageGroupFunction(doc, index); } } return new PageGroupFunction(doc, index); // return empty page group function if not in name list }