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));
        }
Ejemplo n.º 2
0
        public void parseDocumentArea()
        {
            while (index < stop)
            {
                if (data[index] > 0 && data[index] < 33)
                {
                    // parse default extended international characters
                    WP6_FunctionKey key = new WP6_FunctionKey(data[index], 0);
                    index++;
                    if (WP6_DefaultExtendedInternationalCharacters.map.ContainsKey(key))
                    {
                        WPStream.Add(new Character((WP6_DefaultExtendedInternationalCharacters.map[key]).ToString()));
                    }
                }
                // add ascii character
                else if (data[index] > 32 && data[index] < 127)
                {
                    WPStream.Add(new Character(data, index));
                    index++;
                }

                // parse single-byte function
                else if (data[index] > 127 && data[index] < 208)
                {
                    SingleByteFunction sbf = new SingleByteFunction(data, index);
                    if (!sbf.name.Equals(functionGroups.none))
                    {
                        WPStream.Add(sbf);
                    }
                    index++;
                }

                //parse variable-length multi-byte functions
                else if (data[index] > 207 && data[index] < 227)
                {
                    VariableLengthFunction function = ParseVariableLengthFunction.getfunction(document, index);
                    index += function.size;
                    if (!function.name.Equals(functionGroups.none))
                    {
                        WPStream.Add(function);
                    }
                }

                // parse fixed-length functions
                else if (data[index] > 239 && data[index] <= 255)
                {
                    FixedLengthFunction function = ParseFixedLengthFunction.getFunction(document, index);
                    index += function.size;
                    if (!function.name.Equals(functionGroups.none))
                    {
                        WPStream.Add(function);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public virtual void getName()
        {
            WP6_FunctionKey key = new WP6_FunctionKey(group, subGroup);

            if (WP6_FunctionNames.map.ContainsKey(key))
            {
                name = WP6_FunctionNames.map[key];
            }
            else
            {
                name = functionGroups.none;
            }
        }
Ejemplo n.º 4
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));
        }
Ejemplo n.º 5
0
        public override void getName()
        {
            int bitIndex = 2;
            int mask     = 1 << bitIndex;

            subGroup &= (byte)~mask;
            WP6_FunctionKey key = new WP6_FunctionKey(group, subGroup);

            if (WP6_FunctionNames.map.ContainsKey(key))
            {
                name = WP6_FunctionNames.map[key];
            }
            else
            {
                name = functionGroups.none;
            }
        }
Ejemplo n.º 6
0
        public override bool Equals(object obj)
        {
            if (obj.GetType() == this.GetType())
            {
                WP6_FunctionKey func = (WP6_FunctionKey)obj;

                if (func.group.Equals(this.group) && func.subgroup.Equals(this.subgroup))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 7
0
        public SingleByteFunction(byte[] data, int index)
        {
            _startIndex = index;
            if (data[index] < 180)
            {
                functionGroup = functionGroups.singleByte;
            }
            else
            {
                // assign EOL single byte functions to EOL group but not as a variable length function
                functionGroup  = functionGroups.EOL;
                hasTextContent = true;
            }
            WP6_FunctionKey key = new WP6_FunctionKey(data[index], 0);

            if (WP6_FunctionNames.map.ContainsKey(key))
            {
                name      = WP6_FunctionNames.map[key];
                codeValue = data[index] + PUA;
                if (functionGroup == functionGroups.singleByte)
                {
                    switch ((SingleByteGroup)name)
                    {
                    case SingleByteGroup.soft_space:
                    case SingleByteGroup.hard_space:
                    case SingleByteGroup.hard_hyphen_in_line:
                    case SingleByteGroup.dormant_hard_return:
                    {
                        hasTextContent = true;
                        break;
                    }
                    }
                }
            }
            else
            {
                name = functionGroups.none;
            }
        }
Ejemplo n.º 8
0
        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));

                case PageGroup.delayed_codes:
                    return(new DelayedCodes(doc, index));

                case PageGroup.page_number_position:
                    return(new PageNumberPosition(doc, index));

                case PageGroup.page_number_format:
                    return(new PageNumberFormat(doc, index));

                case PageGroup.start_of_delayed_codes:
                    return(new StartOfDelayedCodes(doc, index));

                case PageGroup.end_of_delayed_codes:
                    return(new EndOfDelayedCodes(doc, index));

                case PageGroup.suppress_page_characteristics:
                    return(new SuppressPageCharacteristics(doc, index));

                default:
                    return(new PageGroupFunction(doc, index));
                }
            }
            return(new PageGroupFunction(doc, index));   // return empty page group function if not in name list
        }
        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);
        }
Ejemplo n.º 10
0
        public static ColumnGroupFunction getFunction(WP6Document doc, int index)
        {
            WP6_FunctionKey key = new WP6_FunctionKey(doc.data[index], doc.data[index + 1]);

            if (WP6_FunctionNames.map.ContainsKey(key))
            {
                ColumnGroup name = (ColumnGroup)WP6_FunctionNames.map[key];
                switch (name)
                {
                case ColumnGroup.left_margin_set:
                    return(new LeftMarginSet(doc, index));

                case ColumnGroup.right_margin_set:
                    return(new RightMarginSet(doc, index));

                case ColumnGroup.define_text_colums:
                    return(new DefineTextColumns(doc, index));

                default:
                    return(new ColumnGroupFunction(doc, index));
                }
            }
            return(new ColumnGroupFunction(doc, index));
        }
Ejemplo n.º 11
0
        public static CharacterGroupFunction getFunction(WP6Document doc, int index)
        {
            WP6_FunctionKey key = new WP6_FunctionKey(doc.data[index], doc.data[index + 1]);

            if (WP6_FunctionNames.map.ContainsKey(key))
            {
                CharacterGroup name = (CharacterGroup)WP6_FunctionNames.map[key];
                switch (name)
                {
                case CharacterGroup.set_alignment_character:                         // 0x D4 00  (212 00)
                    return(new SetAlignmentCharacter(doc, index));

                case CharacterGroup.set_thousands_separator_character:                  // 0x D4 01 (212 01)
                    return(new SetThousandsSeparatorCharacter(doc, index));

                case CharacterGroup.set_underline_spaces_mode:                           // 0x D4 02  (212 02)
                    return(new SetUnderlineSpacesMode(doc, index));

                case CharacterGroup.set_underline_tabs_mode:                            // 0x D4 03 (212 03)
                    return(new SetUnderlineTabsMode(doc, index));

                case CharacterGroup.horizontal_advance_to_page_position:                // 0x D4 04 (212 04)
                    return(new HorizontalAdvanceToPagePosition(doc, index));

                case CharacterGroup.vertical_advance_to_page_position:                  // 0x D4 05 (212 05)
                    return(new VerticalAdvanceTo_PagePosition(doc, index));

                case CharacterGroup.index_entry:
                    return(new IndexEntry(doc, index));

                case CharacterGroup.table_of_authority_entry:
                    return(new TableOfAuthorityEntry(doc, index));

                case CharacterGroup.cross_reference_tag:
                    return(new CrossReferenceTag(doc, index));

                case CharacterGroup.begin_marked_text_for_table_of_contents:
                    return(new BeginMarkedTextForTableOfContents(doc, index));

                case CharacterGroup.end_marked_text_for_table_of_contents:
                    return(new EndMarkedTextForTableOfContents(doc, index));

                case CharacterGroup.begin_marked_text_for_list:
                    return(new BeginMarkedTextForList(doc, index));

                case CharacterGroup.end_marked_text_for_list:
                    return(new EndMarkedTextForList(doc, index));

                case CharacterGroup.begin_hidden_text:
                    return(new BeginHiddenText(doc, index));

                case CharacterGroup.end_hidden_text:
                    return(new EndHiddenText(doc, index));

                case CharacterGroup.kerning_on_off:
                    return(new Kerning_On_Off(doc, index));

                case CharacterGroup.block_on_off:
                    return(new Block_On_Off(doc, index));

                case CharacterGroup.color:
                    return(new Color(doc, index));

                case CharacterGroup.character_shading_change:
                    return(new CharacterShadingChange(doc, index));

                case CharacterGroup.bookmark:
                    return(new Bookmark(doc, index));                                   // 0x D4 25 (212 37)

                case CharacterGroup.font_face_change:
                    return(new FontFaceChange(doc, index));

                case CharacterGroup.font_size_change:
                    return(new FontSizeChange(doc, index));

                case CharacterGroup.set_language:
                    return(new SetLanguage(doc, index));

                case CharacterGroup.comment:
                    return(new Comment(doc, index));

                case CharacterGroup.set_dot_leader_characters:
                    return(new SetDotLeaderCharacters(doc, index));

                case CharacterGroup.conditional_end_of_page:
                    return(new ConditionalEndOfPage(doc, index));

                case CharacterGroup.date:
                    return(new Date(doc, index));

                case CharacterGroup.end_of_date:
                    return(new EndOfDate(doc, index));

                case CharacterGroup.hypertext_begin_on:
                    return(new HypertextBeginOn(doc, index));                           // 0x D4 34 (212 52)

                case CharacterGroup.hypertext_begin_off:
                    return(new HypertextBeginOff(doc, index));                          // 0x D4 35 (212 53)

                case CharacterGroup.hypertext_end_on:
                    return(new HypertextEndOn(doc, index));                             // 0x D4 36 (212 54)

                case CharacterGroup.hypertext_end_off:
                    return(new HypertextEndOff(doc, index));                            // 0x D4 37 (212 55)


                default:
                    return(new CharacterGroupFunction(doc, index));
                }
            }

            return(new CharacterGroupFunction(doc, index));;
        }