示例#1
0
 private bool CSS_insert(ByteClass align_def, ByteClass align_j, ByteClass align_c, ByteClass align_l, ByteClass align_r, ByteClass align, ByteClass bufout, ref int p_ct, ByteClass buf, ref int p_count2, int max, CSS_params CSS_param, ref bool font_color_default, ByteClass font_color_temp, ByteClass color_stack, ref int color_stack_num, ref bool may_use_space, ref bool font_size_default, ByteClass font_size_temp, ArrayList font_list, ArrayList color_list, CSS_tag_type css_tag_type)
 {
     new ByteClass();
     int index = p_ct;
     int num2 = p_count2;
     int num3 = 0;
     int num4 = 0;
     ByteClass class2 = new ByteClass(20);
     int num5 = 0;
     int num6 = 0;
     bool flag = false;
     ByteClass valueStr = new ByteClass(0x40);
     int ct = 0;
     if (bufout.b[index] == 60)
     {
         index++;
     }
     num3 = index;
     num5 = 1;
     num6 = 0;
     while ((index < bufout.len) && (num5 != num6))
     {
         if (bufout.b[index] == 0x3e)
         {
             num6++;
         }
         if (num5 == num6)
         {
             break;
         }
         if (((((bufout.b[index] == 0x73) || (bufout.b[index] == 0x53)) && ((bufout.b[index + 1] == 0x74) || (bufout.b[index + 1] == 0x54))) && (((bufout.b[index + 2] == 0x79) || (bufout.b[index + 2] == 0x59)) && ((bufout.b[index + 3] == 0x6c) || (bufout.b[index + 3] == 0x4c)))) && (((bufout.b[index + 4] == 0x65) || (bufout.b[index + 4] == 0x45)) && (this.IS_DELIMITER(bufout.b[index + 5]) || (bufout.b[index + 5] == 0x3d))))
         {
             index += 6;
             this.ReadValue(bufout, ref index, valueStr);
             break;
         }
         index++;
     }
     int len = valueStr.len;
     index = num3;
     num3 = 0;
     ct = 0;
     CSS_param.found = false;
     num5 = 1;
     num6 = 0;
     while ((index < max) && (num5 != num6))
     {
         if (bufout.b[index] == 0x3e)
         {
             num6++;
         }
         if (num5 == num6)
         {
             break;
         }
         if (((((bufout.b[index] == 0x63) || (bufout.b[index] == 0x43)) && ((bufout.b[index + 1] == 0x6c) || (bufout.b[index + 1] == 0x4c))) && (((bufout.b[index + 2] == 0x61) || (bufout.b[index + 2] == 0x41)) && ((bufout.b[index + 3] == 0x73) || (bufout.b[index + 3] == 0x53)))) && (((bufout.b[index + 4] == 0x73) || (bufout.b[index + 4] == 0x53)) && ((bufout.b[index + 5] == 0x3d) || (bufout.b[index + 5] == 0x20))))
         {
             if (bufout.b[index + 5] == 0x20)
             {
                 index += 6;
             }
             else
             {
                 index += 5;
             }
             this.read_value_exact(bufout, ref index, max, CSS_param.style_name);
             if (CSS_param.style_name.len > 0)
             {
                 CSS_param.found = true;
             }
         }
         if ((((bufout.b[index] == 0x69) || (bufout.b[index] == 0x49)) && ((bufout.b[index + 1] == 100) || (bufout.b[index + 1] == 0x44))) && (bufout.b[index + 2] == 0x3d))
         {
             index += 2;
             this.read_value_exact(bufout, ref index, max, CSS_param.style_name);
             if (CSS_param.style_name.len > 0)
             {
                 CSS_param.found = true;
             }
         }
         if ((((((this._preserveAlignment == 1) && (bufout.b[index] == 0x20)) && ((bufout.b[index + 1] == 0x61) || (bufout.b[index + 1] == 0x41))) && ((bufout.b[index + 2] == 0x6c) || (bufout.b[index + 2] == 0x4c))) && (((bufout.b[index + 3] == 0x69) || (bufout.b[index + 3] == 0x49)) && ((bufout.b[index + 4] == 0x67) || (bufout.b[index + 4] == 0x47)))) && ((bufout.b[index + 5] == 110) || (bufout.b[index + 5] == 0x4e)))
         {
             index += 6;
             this.read_value(bufout, ref index, class2);
             flag = true;
             align.Clear();
             if (class2.byteCmpi("center") == 0)
             {
                 align.Add(@"\qc ");
             }
             else if (class2.byteCmpi("middle") == 0)
             {
                 align.Add(@"\qc ");
             }
             else if (class2.byteCmpi("left") == 0)
             {
                 align.Add(@"\ql ");
             }
             else if (class2.byteCmpi("right") == 0)
             {
                 align.Add(@"\qr ");
             }
             else if (class2.byteCmpi("justify") == 0)
             {
                 align.Add(@"\qj ");
             }
         }
         index++;
     }
     if ((this._preserveAlignment == 1) && flag)
     {
         buf.Add(align);
         num2 += align.len;
     }
     for (num3 = 0; num3 < CSS_param.styles; num3++)
     {
         if (((((CSS_styles)CSS_param.CSS_style[num3]).name.len == 0) && (((CSS_styles)CSS_param.CSS_style[num3]).css_tag_type != CSS_tag_type.UNKNOWN_CSS)) && (((CSS_styles)CSS_param.CSS_style[num3]).css_tag_type == css_tag_type))
         {
             CSS_stack_element _element = new CSS_stack_element();
             CSS_param.stack_tag.Add(_element);
             ((CSS_stack_element)CSS_param.stack_tag[CSS_param.stack_tag_num]).style_index = num3;
             ((CSS_stack_element)CSS_param.stack_tag[CSS_param.stack_tag_num]).css_tag_type = css_tag_type;
             if (CSS_param.stack_tag_num < (this.STK_MAX - 1))
             {
                 CSS_param.stack_tag_num++;
             }
             this.CSS_insert_styles(((CSS_styles)CSS_param.CSS_style[num3]).ablaze, (CSS_styles)CSS_param.CSS_style[num3], CSS_param, align_def, align_j, align_c, align_l, align_r, align, bufout, ref index, buf, ref num2, max, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, css_tag_type);
             break;
         }
     }
     if (css_tag_type != CSS_tag_type.FONT_CSS)
     {
         CSS_styles _styles = new CSS_styles();
         CSS_param.CSS_style_str_stack.Add(_styles);
         this.CSS_reset_style((CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num]);
         if (this.CSS_read_style_params(valueStr, ref ct, len, (CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num], CSS_param, font_list, color_list))
         {
             if (CSS_param.style_str_stack_num > (this.STK_MAX - 1))
             {
                 CSS_param.style_str_stack_num = this.STK_MAX - 1;
             }
             this.CSS_insert_styles(((CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num]).ablaze, (CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num], CSS_param, align_def, align_j, align_c, align_l, align_r, align, bufout, ref index, buf, ref num2, max, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, css_tag_type);
             ((CSS_styles)CSS_param.CSS_style_str_stack[CSS_param.style_str_stack_num]).css_tag_type = css_tag_type;
             if (CSS_param.style_str_stack_num < (this.STK_MAX - 1))
             {
                 CSS_param.style_str_stack_num++;
             }
         }
         else
         {
             CSS_param.CSS_style_str_stack.RemoveAt(CSS_param.style_str_stack_num);
         }
     }
     if (CSS_param.found)
     {
         CSS_param.found = false;
         num3 = 0;
         while (num3 < CSS_param.styles)
         {
             if ((((CSS_styles)CSS_param.CSS_style[num3]).name.byteCmp(CSS_param.style_name) == 0) && ((((CSS_styles)CSS_param.CSS_style[num3]).css_tag_type == css_tag_type) || (((CSS_styles)CSS_param.CSS_style[num3]).css_tag_type == CSS_tag_type.UNKNOWN_CSS)))
             {
                 CSS_param.found = true;
                 break;
             }
             num3++;
         }
         if (CSS_param.found)
         {
             CSS_stack_element _element2 = new CSS_stack_element();
             CSS_param.stack.Add(_element2);
             ((CSS_stack_element)CSS_param.stack[CSS_param.stack_num]).style_index = num3;
             ((CSS_stack_element)CSS_param.stack[CSS_param.stack_num]).css_tag_type = css_tag_type;
             if (CSS_param.stack_num < (this.STK_MAX - 1))
             {
                 CSS_param.stack_num++;
             }
             for (num4 = 0; num4 < this.STYLES_KNOW; num4++)
             {
                 CSS_param.ablaze.b[num4] = ((CSS_styles)CSS_param.CSS_style[num3]).ablaze.b[num4];
             }
             this.CSS_insert_styles(CSS_param.ablaze, (CSS_styles)CSS_param.CSS_style[num3], CSS_param, align_def, align_j, align_c, align_l, align_r, align, bufout, ref index, buf, ref num2, max, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, css_tag_type);
             if (css_tag_type == CSS_tag_type.SPAN_CSS)
             {
                 CSS_param.span++;
             }
             else if (css_tag_type == CSS_tag_type.DIV_CSS)
             {
                 CSS_param.div++;
             }
             else if (css_tag_type == CSS_tag_type.P_CSS)
             {
                 CSS_param.p_tag_open++;
             }
             else if (css_tag_type == CSS_tag_type.EM_CSS)
             {
                 CSS_param.em_tag_open++;
             }
             else if (css_tag_type == CSS_tag_type.FONT_CSS)
             {
                 CSS_param.font_tag_open++;
             }
         }
     }
     p_ct = index;
     p_count2 = num2;
     return CSS_param.found;
 }
示例#2
0
 private bool CSS_insert_styles(ByteClass ablaze, CSS_styles style, CSS_params CSS_param, ByteClass align_def, ByteClass align_j, ByteClass align_c, ByteClass align_l, ByteClass align_r, ByteClass align, ByteClass bufout, ref int p_ct, ByteClass buf, ref int p_count2, int max, ref bool font_color_default, ByteClass font_color_temp, ByteClass color_stack, ref int color_stack_num, ref bool may_use_space, ref bool font_size_default, ByteClass font_size_temp, CSS_tag_type css_tag_type)
 {
     int ct = p_ct;
     int num2 = p_count2;
     ByteClass newb = new ByteClass(0x20);
     int num3 = 0;
     if ((!CSS_param.pos.open && (ablaze.b[9] == 1)) && ((ablaze.b[10] == 1) && (ablaze.b[11] == 1)))
     {
         CSS_param.pos.x = style.left * this.PX_TO_TWIPS;
         CSS_param.pos.y = style.top * this.PX_TO_TWIPS;
         if (this._pageOrientation == ePageOrientation.Portrait)
         {
             CSS_param.pos.w = this.page_width;
         }
         else
         {
             CSS_param.pos.w = this.page_height;
         }
         CSS_param.pos.w -= CSS_param.pos.x;
         CSS_param.pos.h = 10 * this.PX_TO_TWIPS;
         CSS_param.pos.pos_open_str = string.Concat(new object[] { @"{\pard\plain\posx", CSS_param.pos.x, @"\posy%d\absw", CSS_param.pos.w, @"\absh", CSS_param.pos.h, " " });
         CSS_param.pos.pos_close_str = @"\par}";
         CSS_param.pos.open = this.check_position_object(bufout, ct, max, style.css_tag_type);
         if (CSS_param.pos.open)
         {
             buf.Add(CSS_param.pos.pos_open_str);
             num2 += CSS_param.pos.pos_open_str.Length;
         }
     }
     if (((ablaze.b[14] == 1) && (this._preservePageBreaks == 1)) && (style.page_break_before == 1))
     {
         buf.Add("\n\\pard\\page\\par\n");
         num2 += 0x10;
     }
     else if (((ablaze.b[15] == 1) && (this._preservePageBreaks == 1)) && ((style.page_break_after == 1) && (css_tag_type == CSS_tag_type.HR_CSS)))
     {
         buf.Add("\n\\pard\\page\\par\n");
         num2 += 0x10;
     }
     if ((ablaze.b[0] == 1) && (this._preserveFontFace == 1))
     {
         num3 = style.font_family;
         if ((num3 >= 0) && (num3 < this.MAX_FONTS))
         {
             newb.Clear();
             newb.Add(@"\f" + ((num3 + 2)).ToString() + " ");
             may_use_space = true;
             buf.Add(newb);
             num2 += newb.len;
         }
     }
     if ((ablaze.b[1] == 1) && (this._preserveFontColor == 1))
     {
         if (!font_color_default && (color_stack_num < color_stack.len))
         {
             color_stack.b[color_stack_num++] = (byte)this.ToInt(font_color_temp.ToByteCStartPos(3));
         }
         font_color_default = false;
         font_color_temp.Clear();
         font_color_temp.Add(@"\cf" + ((style.color + 3)).ToString() + " ");
         may_use_space = true;
         if (!font_color_default)
         {
             buf.Add(font_color_temp);
             num2 += font_color_temp.len;
         }
     }
     if (ablaze.b[2] == 1)
     {
         if (style.font_weight == 1)
         {
             buf.Add(@"{\b ");
             num2 += 4;
             may_use_space = true;
         }
         if (style.font_weight == 0)
         {
             buf.Add(@"\b0 ");
             num2 += 4;
         }
         if (style.font_weight == 1)
         {
             CSS_param.bold++;
             if (CSS_param.bold <= 0)
             {
                 CSS_param.bold = 1;
             }
         }
     }
     if ((ablaze.b[3] == 1) && (this._preserveFontSize == 1))
     {
         font_size_default = false;
         font_size_temp.Clear();
         font_size_temp.Add(@"\fs" + style.font_size + " ");
         may_use_space = true;
         buf.Add(font_size_temp);
         num2 += font_size_temp.len;
     }
     if ((ablaze.b[4] == 1) && (this._preserveAlignment == 1))
     {
         if (style.text_align == 0x6c)
         {
             align = align_l;
         }
         else if (style.text_align == 0x72)
         {
             align = align_r;
         }
         else if (style.text_align == 0x63)
         {
             align = align_c;
         }
         else if (style.text_align == 0x6a)
         {
             align = align_j;
         }
         buf.Add(align);
         num2 += align.len;
     }
     if ((ablaze.b[5] == 1) && (style.font_style == 0x69))
     {
         buf.Add(@"{\i ");
         num2 += 4;
         CSS_param.italic++;
         if (CSS_param.italic <= 0)
         {
             CSS_param.italic = 1;
         }
         may_use_space = true;
     }
     if (ablaze.b[6] == 1)
     {
         newb.Clear();
         newb.Add(@"\sb" + style.margin_top + " ");
         buf.Add(newb);
         num2 += newb.len;
     }
     if ((ablaze.b[7] == 1) && (this._preserveBackgroundColor == 1))
     {
         font_color_temp.Clear();
         font_color_temp.Add(@"\chcbpat" + ((style.background_color + 3)).ToString() + " ");
         may_use_space = true;
         buf.Add(font_color_temp);
         num2 += font_color_temp.len;
     }
     if (ablaze.b[12] == 1)
     {
         if (style.text_decoration == 0x75)
         {
             buf.Add(@"{\ul ");
             num2 += 5;
         }
         if (style.text_decoration == 110)
         {
             buf.Add(@"{\ul0 ");
             num2 += 6;
         }
         if (style.text_decoration == 0x73)
         {
             buf.Add(@"{\strike ");
             num2 += 9;
         }
         CSS_param.underline++;
         if (CSS_param.underline <= 0)
         {
             CSS_param.underline = 1;
         }
     }
     if (ablaze.b[13] == 1)
     {
         if (style.vertical_align == 0x62)
         {
             buf.Add(@"{\sub ");
             num2 += 6;
         }
         if (style.vertical_align == 0x72)
         {
             buf.Add(@"{\super ");
             num2 += 8;
         }
         CSS_param.vertical_align++;
         if (CSS_param.vertical_align <= 0)
         {
             CSS_param.vertical_align = 1;
         }
     }
     p_count2 = num2;
     return true;
 }
示例#3
0
 private bool CSS_del_from_style_str_stack(int style_num, CSS_params CSS_param, CSS_tag_type css_tag_type)
 {
     int num = 0;
     CSS_styles _styles = new CSS_styles();
     if ((style_num + 1) != CSS_param.style_str_stack_num)
     {
         for (num = style_num; (num < CSS_param.style_str_stack_num) && (num < (CSS_param.CSS_style_str_stack.Count - 1)); num++)
         {
             _styles = (CSS_styles)CSS_param.CSS_style_str_stack[num + 1];
             CSS_param.CSS_style_str_stack[num] = _styles;
         }
     }
     CSS_param.style_str_stack_num--;
     return true;
 }
示例#4
0
 private bool CSS_del_from_stack_tag(ref int style_num, CSS_params CSS_param, CSS_tag_type css_tag_type)
 {
     int num = 0;
     int num2 = 0;
     CSS_stack_element _element = new CSS_stack_element();
     if (CSS_param.stack_tag_num <= 0)
     {
         CSS_param.stack_tag_num = 0;
         return false;
     }
     num2 = CSS_param.stack_tag_num - 1;
     CSS_param.found = false;
     while (num2 >= 0)
     {
         if (((CSS_stack_element)CSS_param.stack_tag[num2]).css_tag_type == css_tag_type)
         {
             CSS_param.found = true;
             num = num2;
             break;
         }
         num2--;
     }
     if (!CSS_param.found)
     {
         return false;
     }
     if (num > 0)
     {
         CSS_param.CSS_style_default = (CSS_styles)CSS_param.CSS_style[num - 1];
         style_num = num;
     }
     if ((num + 1) != CSS_param.stack_tag_num)
     {
         for (num2 = num; (num2 < CSS_param.stack_tag_num) && (num2 < (CSS_param.stack_tag.Count - 1)); num2++)
         {
             _element = (CSS_stack_element)CSS_param.stack_tag[num2 + 1];
             CSS_param.stack_tag[num2] = _element;
         }
     }
     CSS_param.stack_tag_num--;
     return true;
 }
示例#5
0
 private bool CSS_close_styles(ByteClass ablaze, CSS_styles style, CSS_params CSS_param, ByteClass align_def, ByteClass align_j, ByteClass align, ByteClass buf, ref int p_count2, ref bool font_color_default, ByteClass font_color_temp, ByteClass color_stack, ref int color_stack_num, ref bool may_use_space, ref bool font_size_default, ByteClass font_size_temp, int fontsize, CSS_tag_type css_tag_type, ArrayList styleStack, int styleStackNum)
 {
     int num = p_count2;
     bool flag = false;
     ByteClass newb = new ByteClass(0x10);
     int num2 = 0;
     if ((CSS_param.pos.open && (ablaze.b[9] == 1)) && ((ablaze.b[10] == 1) && (ablaze.b[11] == 1)))
     {
         buf.Add(CSS_param.pos.pos_close_str);
         num += CSS_param.pos.pos_close_str.Length;
         CSS_param.pos.open = false;
     }
     if ((ablaze.b[2] == 1) || (css_tag_type == CSS_tag_type.TD_CSS))
     {
         if (CSS_param.bold > 0)
         {
             buf.Add("}");
             num++;
         }
         CSS_param.bold--;
     }
     if ((ablaze.b[0] == 1) && (this._preserveFontFace == 1))
     {
         newb.Clear();
         newb.Add(@"\f0 ");
         if ((styleStack != null) && (styleStackNum > 0))
         {
             flag = false;
             num2 = styleStackNum - 1;
             while (num2 >= 0)
             {
                 if (((CSS_styles)CSS_param.CSS_style[((CSS_stack_element)styleStack[num2]).style_index]).ablaze.b[0] == 1)
                 {
                     flag = true;
                     break;
                 }
                 num2--;
             }
             if (flag && (((CSS_styles)CSS_param.CSS_style[((CSS_stack_element)styleStack[num2]).style_index]).font_family >= 0))
             {
                 newb.Clear();
                 newb.Add(@"\f" + ((((CSS_styles)CSS_param.CSS_style[((CSS_stack_element)styleStack[num2]).style_index]).font_family + 2)).ToString() + " ");
             }
         }
         may_use_space = true;
         buf.Add(newb);
         num += newb.len;
     }
     if ((ablaze.b[3] == 1) && (this._preserveFontSize == 1))
     {
         if ((styleStack == null) || (styleStackNum <= 0))
         {
             if (style.font_size != fontsize)
             {
                 font_size_default = false;
                 font_size_temp.Clear();
                 font_size_temp.Add(@"\fs" + fontsize + " ");
                 may_use_space = true;
                 buf.Add(font_size_temp);
                 num += font_size_temp.len;
             }
         }
         else
         {
             flag = false;
             num2 = styleStackNum - 1;
             while (num2 >= 0)
             {
                 if (((CSS_styles)CSS_param.CSS_style[((CSS_stack_element)styleStack[num2]).style_index]).ablaze.b[3] == 1)
                 {
                     flag = true;
                     break;
                 }
                 num2--;
             }
             if (flag && (((CSS_styles)CSS_param.CSS_style[((CSS_stack_element)styleStack[num2]).style_index]).font_size > 0))
             {
                 font_size_default = false;
                 font_size_temp.Clear();
                 font_size_temp.Add(@"\fs" + ((CSS_styles)CSS_param.CSS_style[((CSS_stack_element)styleStack[num2]).style_index]).font_size + " ");
                 may_use_space = true;
                 buf.Add(font_size_temp);
                 num += font_size_temp.len;
             }
         }
     }
     if (((ablaze.b[4] == 1) && (this._preserveAlignment == 1)) && (css_tag_type != CSS_tag_type.TD_CSS))
     {
         align.Clear();
         align.Add(align_def);
         if (css_tag_type != CSS_tag_type.DIV_CSS)
         {
             buf.Add(align);
             num += align.len;
         }
     }
     if (((ablaze.b[5] == 1) || (css_tag_type == CSS_tag_type.TD_CSS)) && (CSS_param.italic > 0))
     {
         buf.Add("}");
         num++;
         CSS_param.italic--;
     }
     if ((ablaze.b[1] == 1) && (this._preserveFontColor == 1))
     {
         if (color_stack_num > 0)
         {
             font_color_temp.Clear();
             font_color_temp.Add(@"\cf" + color_stack.b[color_stack_num - 1] + " ");
             if ((ablaze.b[5] == 1) || (ablaze.b[2] == 1))
             {
                 may_use_space = true;
             }
             else
             {
                 may_use_space = false;
             }
             color_stack_num--;
         }
         else
         {
             if (CSS_param.body_tag && (ablaze.b[1] == 1))
             {
                 font_color_temp.Clear();
                 if (((CSS_styles)CSS_param.CSS_style[CSS_param.body_tag_index]).ablaze.b[1] == 1)
                 {
                     font_color_temp.Add(@"\cf" + (((CSS_styles)CSS_param.CSS_style[CSS_param.body_tag_index]).color + 3) + " ");
                 }
                 else
                 {
                     font_color_temp.Add(@"\cf1 ");
                 }
             }
             else
             {
                 font_color_temp.Clear();
                 font_color_temp.Add(@"\cf1 ");
             }
             if ((ablaze.b[5] == 1) || (ablaze.b[2] == 1))
             {
                 may_use_space = true;
             }
             else
             {
                 may_use_space = false;
             }
         }
         buf.Add(font_color_temp);
         num += font_color_temp.len;
     }
     if ((ablaze.b[7] == 1) && (this._preserveBackgroundColor == 1))
     {
         font_color_temp.Clear();
         font_color_temp.Add(@"\chcbpat0 ");
         may_use_space = true;
         buf.Add(font_color_temp);
         num += font_color_temp.len;
     }
     if ((ablaze.b[12] == 1) && (CSS_param.underline > 0))
     {
         buf.Add("}");
         num++;
         CSS_param.underline--;
     }
     if ((ablaze.b[13] == 1) && (CSS_param.vertical_align > 0))
     {
         buf.Add("}");
         num++;
         CSS_param.vertical_align--;
     }
     if (((ablaze.b[15] == 1) && (this._preservePageBreaks == 1)) && (style.page_break_after == 1))
     {
         buf.Add("\n\\pard\\page\\par\n");
         num += 0x10;
     }
     p_count2 = num;
     return true;
 }
示例#6
0
 private int CSS_close(ByteClass align_def, ByteClass align_j, ByteClass align, ByteClass buf, ref int p_count2, CSS_params CSS_param, ref bool font_color_default, ByteClass font_color_temp, ByteClass color_stack, ref int color_stack_num, ref bool may_use_space, ref bool font_size_default, ByteClass font_size_temp, int fontsize, CSS_tag_type css_tag_type)
 {
     int num = p_count2;
     int num2 = 0;
     int num3 = 0;
     bool flag = false;
     fontsize *= 2;
     if ((css_tag_type != CSS_tag_type.UNKNOWN_CSS) && this.CSS_del_from_stack_tag(ref num3, CSS_param, css_tag_type))
     {
         num2 = ((CSS_stack_element)CSS_param.stack_tag[num3]).style_index;
         if ((num2 >= 0) && (num2 < CSS_param.styles))
         {
             this.CSS_close_styles(((CSS_styles)CSS_param.CSS_style[num2]).ablaze, (CSS_styles)CSS_param.CSS_style[num2], CSS_param, align_def, align_j, align, buf, ref num, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, fontsize, css_tag_type, null, 0);
         }
         p_count2 = num;
     }
     if (CSS_param.style_str_stack_num > 0)
     {
         flag = false;
         num2 = CSS_param.style_str_stack_num - 1;
         while (num2 >= 0)
         {
             if (css_tag_type == ((CSS_styles)CSS_param.CSS_style_str_stack[num2]).css_tag_type)
             {
                 flag = true;
                 break;
             }
             num2--;
         }
     }
     if (flag)
     {
         for (int i = CSS_param.style_str_stack_num - 1; i > num2; i--)
         {
             this.CSS_close(align_def, align_j, align, buf, ref p_count2, CSS_param, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, fontsize, ((CSS_styles)CSS_param.CSS_style_str_stack[i]).css_tag_type);
         }
         this.CSS_close_styles(((CSS_styles)CSS_param.CSS_style_str_stack[num2]).ablaze, (CSS_styles)CSS_param.CSS_style_str_stack[num2], CSS_param, align_def, align_j, align, buf, ref num, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, fontsize, css_tag_type, null, 0);
         p_count2 = num;
         this.CSS_reset_style((CSS_styles)CSS_param.CSS_style_str_stack[num2]);
         this.CSS_del_from_style_str_stack(num2, CSS_param, css_tag_type);
     }
     if (css_tag_type == CSS_tag_type.SPAN_CSS)
     {
         if (CSS_param.span <= 0)
         {
             CSS_param.span = 0;
             return 0;
         }
         CSS_param.span--;
     }
     else if (css_tag_type == CSS_tag_type.DIV_CSS)
     {
         if (align != align_def)
         {
             align.Clear();
             align.Add(align_def);
             buf.Add(align);
             num += align.len;
             p_count2 = num;
         }
         if (CSS_param.div <= 0)
         {
             CSS_param.div = 0;
             return 0;
         }
         CSS_param.div--;
     }
     else if (css_tag_type == CSS_tag_type.P_CSS)
     {
         if (align != align_def)
         {
             align.Clear();
             align.Add(align_def);
             buf.Add(align);
             num += align.len;
             p_count2 = num;
         }
         if (CSS_param.p_tag_open <= 0)
         {
             CSS_param.p_tag_open = 0;
             return 0;
         }
         CSS_param.p_tag_open--;
     }
     else if (css_tag_type == CSS_tag_type.EM_CSS)
     {
         if (CSS_param.em_tag_open <= 0)
         {
             CSS_param.em_tag_open = 0;
             return 0;
         }
         CSS_param.em_tag_open--;
     }
     else if (css_tag_type == CSS_tag_type.FONT_CSS)
     {
         if (CSS_param.font_tag_open <= 0)
         {
             CSS_param.font_tag_open = 0;
             return 0;
         }
         CSS_param.font_tag_open--;
     }
     else if (css_tag_type != CSS_tag_type.TD_CSS)
     {
         return 0;
     }
     if (this.CSS_del_from_stack(ref num3, CSS_param, css_tag_type))
     {
         num2 = ((CSS_stack_element)CSS_param.stack[num3]).style_index;
         if ((num2 < 0) || (num2 > (CSS_param.styles - 1)))
         {
             return 0;
         }
         this.CSS_close_styles(((CSS_styles)CSS_param.CSS_style[num2]).ablaze, (CSS_styles)CSS_param.CSS_style[num2], CSS_param, align_def, align_j, align, buf, ref num, ref font_color_default, font_color_temp, color_stack, ref color_stack_num, ref may_use_space, ref font_size_default, font_size_temp, fontsize, css_tag_type, CSS_param.stack, CSS_param.stack_num);
         p_count2 = num;
     }
     return 0;
 }
示例#7
0
 private bool check_position_object(ByteClass buf, int ct, int max_pos, CSS_tag_type css_tag_type)
 {
     bool flag = false;
     while ((buf.b[ct - 1] != 0x3e) && (ct < max_pos))
     {
         ct++;
     }
     while (ct < max_pos)
     {
         if ((((((css_tag_type == CSS_tag_type.SPAN_CSS) && (buf.b[ct] == 60)) && (buf.b[ct + 1] == 0x2f)) && ((buf.b[ct + 2] == 0x73) || (buf.b[ct + 2] == 0x53))) && ((buf.b[ct + 3] == 0x70) || (buf.b[ct + 3] == 80))) && ((((buf.b[ct + 4] == 0x61) || (buf.b[ct + 4] == 0x41)) && ((buf.b[ct + 5] == 110) || (buf.b[ct + 5] == 0x4e))) && (buf.b[ct + 6] == 0x3e)))
         {
             return flag;
         }
         if ((((((css_tag_type == CSS_tag_type.DIV_CSS) && (buf.b[ct] == 60)) && (buf.b[ct + 1] == 0x2f)) && ((buf.b[ct + 2] == 100) || (buf.b[ct + 2] == 0x44))) && ((buf.b[ct + 3] == 0x69) || (buf.b[ct + 3] == 0x49))) && (((buf.b[ct + 4] == 0x76) || (buf.b[ct + 4] == 0x56)) && (buf.b[ct + 5] == 0x3e)))
         {
             return flag;
         }
         if ((((((css_tag_type == CSS_tag_type.SPAN_CSS) && (buf.b[ct] == 60)) && ((buf.b[ct + 1] == 0x73) || (buf.b[ct + 1] == 0x53))) && ((buf.b[ct + 2] == 0x70) || (buf.b[ct + 2] == 80))) && (((buf.b[ct + 3] == 0x61) || (buf.b[ct + 3] == 0x41)) && ((buf.b[ct + 4] == 110) || (buf.b[ct + 4] == 0x4e)))) && ((buf.b[ct + 5] == 0x3e) || (buf.b[ct + 5] == 0x20)))
         {
             while ((buf.b[ct] != 0x3e) && (ct < max_pos))
             {
                 ct++;
             }
         }
         else if ((((((css_tag_type == CSS_tag_type.DIV_CSS) && (buf.b[ct] == 60)) && ((buf.b[ct + 1] == 100) || (buf.b[ct + 1] == 0x44))) && ((buf.b[ct + 2] == 0x69) || (buf.b[ct + 2] == 0x49))) && ((buf.b[ct + 3] == 0x76) || (buf.b[ct + 3] == 0x56))) && ((buf.b[ct + 4] == 0x3e) || (buf.b[ct + 4] == 0x20)))
         {
             while ((buf.b[ct] != 0x3e) && (ct < max_pos))
             {
                 ct++;
             }
         }
         else if ((((((css_tag_type == CSS_tag_type.SPAN_CSS) && (buf.b[ct] == 60)) && ((buf.b[ct + 1] == 0x73) || (buf.b[ct + 1] == 0x53))) && ((buf.b[ct + 2] == 0x70) || (buf.b[ct + 2] == 80))) && (((buf.b[ct + 3] == 0x61) || (buf.b[ct + 3] == 0x41)) && ((buf.b[ct + 4] == 110) || (buf.b[ct + 4] == 0x4e)))) && ((buf.b[ct + 5] == 0x3e) || (buf.b[ct + 5] == 0x20)))
         {
             while ((buf.b[ct] != 0x3e) && (ct < max_pos))
             {
                 ct++;
             }
         }
         else
         {
             if ((((buf.b[ct] == 60) && ((buf.b[ct + 1] == 0x69) || (buf.b[ct + 1] == 0x49))) && ((buf.b[ct + 2] == 0x6d) || (buf.b[ct + 2] == 0x4d))) && (((buf.b[ct + 3] == 0x67) || (buf.b[ct + 3] == 0x47)) && ((buf.b[ct + 4] == 0x20) || (buf.b[ct + 4] == 10))))
             {
                 return true;
             }
             if (buf.b[ct] == 60)
             {
                 while ((buf.b[ct] != 0x3e) && (ct < max_pos))
                 {
                     ct++;
                 }
             }
             else if (buf.b[ct] > 0x20)
             {
                 return true;
             }
         }
         ct++;
     }
     return flag;
 }