Ejemplo n.º 1
0
 public void CopyCSS_styles(CSS_styles dest)
 {
     dest.name.Clear();
     for (int i = 0; i < 20; i++)
     {
         dest.ablaze.Add(this.ablaze.b[i]);
     }
     dest.css_tag_type     = CSS_tag_type.UNKNOWN_CSS;
     dest.font_family      = this.font_family;
     dest.color            = this.color;
     dest.font_weight      = this.font_weight;
     dest.font_size        = this.font_size;
     dest.text_align       = this.text_align;
     dest.font_style       = this.font_style;
     dest.margin_top       = this.margin_top;
     dest.background_color = this.background_color;
     dest.font             = this.font;
     dest.top               = this.top;
     dest.left              = this.left;
     dest.width             = this.width;
     dest.text_decoration   = this.text_decoration;
     dest.vertical_align    = this.vertical_align;
     dest.page_break_before = this.page_break_before;
     dest.page_break_after  = this.page_break_after;
     dest.list_style_type   = this.list_style_type;
     dest.margin_bottom     = this.margin_bottom;
     dest.width_in_percent  = this.width_in_percent;
 }
Ejemplo n.º 2
0
 public void CopyCSS_styles(CSS_styles dest)
 {
     dest.name.Clear();
     for (int i = 0; i < 20; i++)
     {
         dest.ablaze.Add(this.ablaze.b[i]);
     }
     dest.css_tag_type = CSS_tag_type.UNKNOWN_CSS;
     dest.font_family = this.font_family;
     dest.color = this.color;
     dest.font_weight = this.font_weight;
     dest.font_size = this.font_size;
     dest.text_align = this.text_align;
     dest.font_style = this.font_style;
     dest.margin_top = this.margin_top;
     dest.background_color = this.background_color;
     dest.font = this.font;
     dest.top = this.top;
     dest.left = this.left;
     dest.width = this.width;
     dest.text_decoration = this.text_decoration;
     dest.vertical_align = this.vertical_align;
     dest.page_break_before = this.page_break_before;
     dest.page_break_after = this.page_break_after;
     dest.list_style_type = this.list_style_type;
     dest.margin_bottom = this.margin_bottom;
     dest.width_in_percent = this.width_in_percent;
 }
Ejemplo n.º 3
0
 private void CSS_reset_style(CSS_styles CSS)
 {
     for (int i = 0; i < this.STYLES_KNOW; i++)
     {
         CSS.ablaze.b[i] = 0;
     }
     CSS.name.Clear();
     CSS.font_family = 0;
     CSS.color = 0;
     CSS.font_weight = 0;
     CSS.font_size = 0;
     CSS.text_align = 0;
     CSS.font_style = 0;
     CSS.margin_top = 0;
     CSS.background_color = 0;
     CSS.font = 0;
     CSS.top = 0;
     CSS.left = 0;
     CSS.width = 0;
     CSS.text_decoration = 0;
     CSS.vertical_align = 0;
     CSS.page_break_before = 0;
     CSS.page_break_after = 0;
     CSS.list_style_type = 0;
     CSS.margin_bottom = 0;
     CSS.width_in_percent = false;
     CSS.css_tag_type = CSS_tag_type.UNKNOWN_CSS;
 }
Ejemplo n.º 4
0
 private void CSSJoinStyles(CSS_styles dest, CSS_styles src)
 {
     if (src.ablaze.b[0] == 1)
     {
         dest.ablaze.b[0] = 1;
         dest.font_family = src.font_family;
     }
     if (src.ablaze.b[1] == 1)
     {
         dest.ablaze.b[1] = 1;
         dest.color = src.color;
     }
     if (src.ablaze.b[2] == 1)
     {
         dest.ablaze.b[2] = 1;
         dest.font_weight = src.font_weight;
     }
     if (src.ablaze.b[3] == 1)
     {
         dest.ablaze.b[3] = 1;
         dest.font_size = src.font_size;
     }
     if (src.ablaze.b[4] == 1)
     {
         dest.ablaze.b[4] = 1;
         dest.text_align = src.text_align;
     }
     if (src.ablaze.b[5] == 1)
     {
         dest.ablaze.b[5] = 1;
         dest.font_style = src.font_style;
     }
     if (dest.ablaze.b[6] == 1)
     {
         dest.ablaze.b[6] = 1;
         dest.margin_top = src.margin_top;
     }
     if (dest.ablaze.b[7] == 1)
     {
         dest.ablaze.b[7] = 1;
         dest.background_color = src.background_color;
     }
     if (dest.ablaze.b[12] == 1)
     {
         dest.ablaze.b[12] = 1;
         dest.text_decoration = src.text_decoration;
     }
     if (dest.ablaze.b[0x11] == 1)
     {
         dest.ablaze.b[0x11] = 1;
         dest.margin_bottom = src.margin_bottom;
     }
 }
Ejemplo n.º 5
0
 private int CSS_parse_name(ByteClass name, CSS_styles style)
 {
     ByteClass newb = new ByteClass();
     bool flag = false;
     if (name.byteCmpi("DIV") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.DIV_CSS;
     }
     else if (name.byteCmpi("SPAN") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.SPAN_CSS;
     }
     else if (name.byteCmpi("P") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.P_CSS;
     }
     else if (name.byteCmpi("EM") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.EM_CSS;
     }
     else if (name.byteCmpi("FONT") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.FONT_CSS;
     }
     else if (name.byteCmpi("TD") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.TD_CSS;
     }
     else if (name.byteCmpi("TABLE") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.TABLE_CSS;
     }
     else if (name.byteCmpi("UL") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.UL_CSS;
     }
     else if (name.byteCmpi("OL") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.OL_CSS;
     }
     else if (name.byteCmpi("H1") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.H1_CSS;
     }
     else if (name.byteCmpi("H2") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.H2_CSS;
     }
     else if (name.byteCmpi("H3") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.H3_CSS;
     }
     else if (name.byteCmpi("H4") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.H4_CSS;
     }
     else if (name.byteCmpi("H5") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.H5_CSS;
     }
     else if (name.byteCmpi("H6") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.H6_CSS;
     }
     else if (name.byteCmpi("HR") == 0)
     {
         name.Clear();
         style.css_tag_type = CSS_tag_type.HR_CSS;
     }
     int len = name.len;
     newb.Clear();
     for (int i = 0; i < len; i++)
     {
         if ((name.b[i] == 0x2e) || (name.b[i] == 0x23))
         {
             flag = false;
             if (newb.byteCmpi("DIV") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.DIV_CSS;
             }
             else if (newb.byteCmpi("SPAN") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.SPAN_CSS;
             }
             else if (newb.byteCmpi("P") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.P_CSS;
             }
             else if (newb.byteCmpi("EM") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.EM_CSS;
             }
             else if (newb.byteCmpi("FONT") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.FONT_CSS;
             }
             else if (newb.byteCmpi("TD") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.TD_CSS;
             }
             else if (newb.byteCmpi("TABLE") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.TABLE_CSS;
             }
             else if (newb.byteCmpi("UL") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.UL_CSS;
             }
             else if (newb.byteCmpi("OL") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.OL_CSS;
             }
             else if (newb.byteCmpi("H1") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.H1_CSS;
             }
             else if (newb.byteCmpi("H2") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.H2_CSS;
             }
             else if (newb.byteCmpi("H3") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.H3_CSS;
             }
             else if (newb.byteCmpi("H4") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.H4_CSS;
             }
             else if (newb.byteCmpi("H5") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.H5_CSS;
             }
             else if (newb.byteCmpi("H6") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.H6_CSS;
             }
             else if (newb.byteCmpi("HR") == 0)
             {
                 flag = true;
                 style.css_tag_type = CSS_tag_type.HR_CSS;
             }
             if (flag)
             {
                 newb.Clear();
                 newb.Add(name);
                 style.name.Clear();
                 style.name.Add(newb, i + 1);
             }
             break;
         }
         newb.Add(name.b[i]);
     }
     return 0;
 }
Ejemplo n.º 6
0
 private bool CSS_read_style_params(ByteClass buf, ref int ct, int max, CSS_styles CSS_style, CSS_params CSS_param, ArrayList font_list, ArrayList color_list)
 {
     int num2;
     ByteClass class2 = new ByteClass();
     int index = ct;
     bool quote = false;
     while (ct < max)
     {
         if (buf.b[ct] == 0x7d)
         {
             max = ct;
             break;
         }
         ct++;
     }
     while (buf.b[index] == 0x7b)
     {
         index++;
     }
 Label_0F0F:
     while ((index < max) && (buf.b[index] != 0x7d))
     {
         bool flag2;
         double num3;
         this.read_value_CSS(buf, ref index, max, class2, -1111, quote);
         if (index < (buf.len - 1))
         {
             while (((buf.b[index] == 0x3a) || (buf.b[index] == 0x3b)) || (((buf.b[index] >= 0) && (buf.b[index] <= 0x20)) && (index < (buf.len - 1))))
             {
                 index++;
             }
         }
         new ByteClass();
         if (class2.byteCmpi((string)CSS_param.names[0]) == 0)
         {
             this.read_value_CSS(buf, ref index, max, class2, -1111, true);
             num2 = 0;
             bool flag = false;
             while ((num2 < CSS_param.font_list_num) && (num2 < this.MAX_FONTS))
             {
                 if (class2.byteCmpi((string)font_list[num2]) == 0)
                 {
                     flag = true;
                     break;
                 }
                 num2++;
             }
             if (!flag)
             {
                 font_list.Add(class2.ByteToString());
                 CSS_style.ablaze.b[0] = 1;
                 CSS_style.font_family = (byte)CSS_param.font_list_num;
                 CSS_param.font_list_num++;
             }
             else
             {
                 CSS_style.ablaze.b[0] = 1;
                 CSS_style.font_family = (byte)num2;
             }
             continue;
         }
         if (class2.byteCmpi((string)CSS_param.names[1]) == 0)
         {
             this.read_color(buf, ref index, max, class2);
             index += class2.len;
             num2 = 0;
             flag2 = false;
             while ((num2 < CSS_param.color_list_num) && (num2 < this.MAX_COLORS))
             {
                 if (class2.byteCmpi(color_list[num2].ToString()) == 0)
                 {
                     flag2 = true;
                     break;
                 }
                 num2++;
             }
             if (!flag2)
             {
                 color_list.Add(class2.ByteToString());
                 class2.Clear();
                 CSS_style.ablaze.b[1] = 1;
                 CSS_style.color = (byte)CSS_param.color_list_num;
                 CSS_param.color_list_num++;
             }
             else
             {
                 CSS_style.ablaze.b[1] = 1;
                 CSS_style.color = (byte)num2;
             }
             continue;
         }
         if (class2.byteCmpi((string)CSS_param.names[2]) == 0)
         {
             this.read_value_CSS(buf, ref index, max, class2, -1111, quote);
             if (class2.byteCmpi("bold") == 0)
             {
                 CSS_style.ablaze.b[2] = 1;
                 CSS_style.font_weight = 1;
             }
             if (class2.byteCmpi("normal") == 0)
             {
                 CSS_style.ablaze.b[2] = 1;
                 CSS_style.font_weight = 0;
             }
             continue;
         }
         if (class2.byteCmpi((string)CSS_param.names[3]) == 0)
         {
             this.read_value_CSS_tolower(buf, ref index, max, class2, -1111);
             num3 = this.ToFloat(class2);
             if (class2.IndexOfBegin("px") != -1)
             {
                 num3 *= 0.75;
             }
             else if (class2.IndexOfBegin("em") != -1)
             {
                 num3 *= 12;
             }
             else if (class2.byteCmp("xx-small") == 0)
             {
                 num3 = 8;
             }
             else if (class2.byteCmp("x-small") == 0)
             {
                 num3 = 10;
             }
             else if (class2.byteCmp("small") == 0)
             {
                 num3 = 12;
             }
             else if (class2.byteCmp("medium") == 0)
             {
                 num3 = 14;
             }
             else if (class2.byteCmp("large") == 0)
             {
                 num3 = 18;
             }
             else if (class2.byteCmp("x-large") == 0)
             {
                 num3 = 24;
             }
             else if (class2.byteCmp("xx-large") == 0)
             {
                 num3 = 36;
             }
             else if (class2.IndexOfBegin("%") != -1)
             {
                 num3 = (num3 * 12) / 100;
             }
             if ((num3 > this.FONT_SIZE_MIN) && (num3 < this.FONT_SIZE_MAX))
             {
                 CSS_style.ablaze.b[3] = 1;
                 CSS_style.font_size = (byte)(num3 * 2);
             }
             continue;
         }
         if ((class2.byteCmpi((string)CSS_param.names[4]) == 0) || (class2.byteCmpi("align") == 0))
         {
             this.read_value_CSS_tolower(buf, ref index, max, class2, -1111);
             if (((class2.b[0] == 0x6c) || (class2.b[0] == 0x72)) || ((class2.b[0] == 0x63) || (class2.b[0] == 0x6a)))
             {
                 CSS_style.ablaze.b[4] = 1;
                 CSS_style.text_align = class2.b[0];
             }
             continue;
         }
         if (class2.byteCmpi((string)CSS_param.names[5]) == 0)
         {
             this.read_value_CSS(buf, ref index, max, class2, -1111, quote);
             if (class2.byteCmpi("italic") == 0)
             {
                 CSS_style.ablaze.b[5] = 1;
                 CSS_style.font_style = 0x69;
             }
             continue;
         }
         if (class2.byteCmpi((string)CSS_param.names[6]) == 0)
         {
             this.read_value_CSS_tolower(buf, ref index, max, class2, -1111);
             num3 = (int)(this.ToFloat(class2) * 20f);
             if (class2.IndexOfBegin("px") != 0)
             {
                 num3 = (int)(num3 / 1.333299994468689);
             }
             if ((num3 >= 0) && (num3 <= 250))
             {
                 CSS_style.ablaze.b[6] = 1;
                 CSS_style.margin_top = (byte)num3;
             }
             continue;
         }
         if ((class2.byteCmpi((string)CSS_param.names[7]) == 0) || (class2.byteCmpi("background") == 0))
         {
             if (!this.read_color(buf, ref index, max, class2))
             {
                 continue;
             }
             index += class2.len;
             num2 = 0;
             flag2 = false;
             while ((num2 < CSS_param.color_list_num) && (num2 < this.MAX_COLORS))
             {
                 if (class2.byteCmpi(color_list[num2].ToString()) == 0)
                 {
                     flag2 = true;
                     break;
                 }
                 num2++;
             }
             if (!flag2)
             {
                 color_list.Add(class2.ByteToString());
                 class2.Clear();
                 CSS_style.ablaze.b[7] = 1;
                 CSS_style.background_color = (byte)CSS_param.color_list_num;
                 CSS_param.color_list_num++;
             }
             else
             {
                 CSS_style.ablaze.b[7] = 1;
                 CSS_style.background_color = (byte)num2;
             }
             continue;
         }
         if (class2.byteCmpi((string)CSS_param.names[8]) == 0)
         {
             int num4 = 1;
             int num5 = 1;
             for (int i = 0; ((num4 != 0) || (num5 != 0)) && (i < 10); i++)
             {
                 this.read_value_CSS(buf, ref index, max, class2, -1111, quote);
                 num4 = num5;
                 num5 = class2.b[0];
                 if (class2.byteCmpi("italic") == 0)
                 {
                     CSS_style.ablaze.b[5] = 1;
                     CSS_style.font_style = 0x69;
                 }
                 if (class2.byteCmpi("bold") == 0)
                 {
                     CSS_style.ablaze.b[2] = 1;
                     CSS_style.font_weight = 1;
                 }
                 if (class2.IndexOfBegin("px") != 0)
                 {
                     num3 = this.ToFloat(class2);
                     num3 = (int)(num3 * 0.75);
                     if ((num3 > this.FONT_SIZE_MIN) && (num3 < this.FONT_SIZE_MAX))
                     {
                         CSS_style.ablaze.b[3] = 1;
                         CSS_style.font_size = (byte)(num3 * 2);
                     }
                 }
                 if (class2.IndexOfBegin("pt") != 0)
                 {
                     num3 = this.ToFloat(class2);
                     if ((num3 > this.FONT_SIZE_MIN) && (num3 < this.FONT_SIZE_MAX))
                     {
                         CSS_style.ablaze.b[3] = 1;
                         CSS_style.font_size = (byte)(num3 * 2);
                     }
                 }
                 if (class2.byteCmpi((string)CSS_param.names[1]) == 0)
                 {
                     while ((buf.b[index] == 0x3a) || (buf.b[index] == 0x20))
                     {
                         index++;
                     }
                     this.read_color(buf, ref index, max, class2);
                     index += class2.len;
                     num2 = 0;
                     flag2 = false;
                     while ((num2 < CSS_param.color_list_num) && (num2 < this.MAX_COLORS))
                     {
                         if (class2.byteCmpi(color_list[num2].ToString()) == 0)
                         {
                             flag2 = true;
                             break;
                         }
                         num2++;
                     }
                     if (!flag2)
                     {
                         color_list.Add(class2.ByteToString());
                         class2.Clear();
                         CSS_style.ablaze.b[1] = 1;
                         CSS_style.color = (byte)CSS_param.color_list_num;
                         CSS_param.color_list_num++;
                     }
                     else
                     {
                         CSS_style.ablaze.b[1] = 1;
                         CSS_style.color = (byte)num2;
                     }
                 }
             }
         }
         else if (class2.byteCmpi((string)CSS_param.names[9]) == 0)
         {
             this.read_value_CSS_tolower(buf, ref index, max, class2, -1111);
             num3 = (int)this.ToFloat(class2);
             if (num3 > 0)
             {
                 CSS_style.ablaze.b[9] = 1;
                 CSS_style.top = (byte)num3;
             }
         }
         else
         {
             if (class2.byteCmpi((string)CSS_param.names[10]) == 0)
             {
                 this.read_value_CSS_tolower(buf, ref index, max, class2, -1111);
                 num3 = (int)this.ToFloat(class2);
                 if (num3 > 0)
                 {
                     CSS_style.ablaze.b[10] = 1;
                     CSS_style.left = (byte)num3;
                 }
                 goto Label_0F0F;
             }
             if (class2.byteCmpi((string)CSS_param.names[11]) == 0)
             {
                 this.read_value_CSS_tolower(buf, ref index, max, class2, -1111);
                 num3 = (int)this.ToFloat(class2);
                 if (num3 > 0)
                 {
                     CSS_style.ablaze.b[11] = 1;
                     CSS_style.width = (byte)num3;
                     if (class2.IndexOf("%") != -1)
                     {
                         CSS_style.width_in_percent = true;
                     }
                     else
                     {
                         CSS_style.width_in_percent = false;
                     }
                 }
                 goto Label_0F0F;
             }
             if (class2.byteCmpi((string)CSS_param.names[12]) == 0)
             {
                 this.read_value_CSS(buf, ref index, max, class2, -1111, quote);
                 if (class2.byteCmpi("underline") == 0)
                 {
                     CSS_style.ablaze.b[12] = 1;
                     CSS_style.text_decoration = 0x75;
                 }
                 if (class2.byteCmpi("none") == 0)
                 {
                     CSS_style.ablaze.b[12] = 1;
                     CSS_style.text_decoration = 110;
                 }
                 if (class2.byteCmpi("line-through") == 0)
                 {
                     CSS_style.ablaze.b[12] = 1;
                     CSS_style.text_decoration = 0x73;
                 }
                 goto Label_0F0F;
             }
             if (class2.byteCmpi((string)CSS_param.names[13]) == 0)
             {
                 this.read_value_CSS(buf, ref index, max, class2, -1111, quote);
                 if (class2.byteCmpi("sub") == 0)
                 {
                     CSS_style.ablaze.b[13] = 1;
                     CSS_style.vertical_align = 0x62;
                 }
                 if (class2.byteCmpi("super") == 0)
                 {
                     CSS_style.ablaze.b[13] = 1;
                     CSS_style.vertical_align = 0x72;
                 }
                 goto Label_0F0F;
             }
             if (class2.byteCmpi((string)CSS_param.names[14]) == 0)
             {
                 this.read_value_CSS(buf, ref index, max, class2, -1111, quote);
                 if (class2.byteCmpi("avoid") == 0)
                 {
                     CSS_style.ablaze.b[14] = 1;
                     CSS_style.page_break_before = 0;
                 }
                 else if (class2.len > 0)
                 {
                     CSS_style.ablaze.b[14] = 1;
                     CSS_style.page_break_before = 1;
                 }
                 goto Label_0F0F;
             }
             if (class2.byteCmpi((string)CSS_param.names[15]) == 0)
             {
                 this.read_value_CSS(buf, ref index, max, class2, -1111, quote);
                 if (class2.byteCmpi("avoid") == 0)
                 {
                     CSS_style.ablaze.b[15] = 1;
                     CSS_style.page_break_after = 0;
                 }
                 else if (class2.len > 0)
                 {
                     CSS_style.ablaze.b[15] = 1;
                     CSS_style.page_break_after = 1;
                 }
                 goto Label_0F0F;
             }
             if (class2.byteCmpi((string)CSS_param.names[0x10]) == 0)
             {
                 this.read_value_CSS(buf, ref index, max, class2, -1111, quote);
                 if (class2.byteCmpi("none") == 0)
                 {
                     CSS_style.ablaze.b[0x10] = 1;
                     CSS_style.list_style_type = 1;
                 }
                 else if (class2.byteCmpi("disc") == 0)
                 {
                     CSS_style.ablaze.b[0x10] = 1;
                     CSS_style.list_style_type = 2;
                 }
                 else if (class2.byteCmpi("circle") == 0)
                 {
                     CSS_style.ablaze.b[0x10] = 1;
                     CSS_style.list_style_type = 3;
                 }
                 else if (class2.byteCmpi("square") == 0)
                 {
                     CSS_style.ablaze.b[0x10] = 1;
                     CSS_style.list_style_type = 4;
                 }
                 else if (class2.byteCmpi("lower-roman") == 0)
                 {
                     CSS_style.ablaze.b[0x10] = 1;
                     CSS_style.list_style_type = 5;
                 }
                 else if (class2.byteCmpi("upper-roman") == 0)
                 {
                     CSS_style.ablaze.b[0x10] = 1;
                     CSS_style.list_style_type = 6;
                 }
                 else if (class2.byteCmpi("lower-alpha") == 0)
                 {
                     CSS_style.ablaze.b[0x10] = 1;
                     CSS_style.list_style_type = 7;
                 }
                 else if (class2.byteCmpi("upper-alpha") == 0)
                 {
                     CSS_style.ablaze.b[0x10] = 1;
                     CSS_style.list_style_type = 8;
                 }
                 else if (class2.byteCmpi("arabic") == 0)
                 {
                     CSS_style.ablaze.b[0x10] = 1;
                     CSS_style.list_style_type = 9;
                 }
                 goto Label_0F0F;
             }
             if (class2.byteCmpi((string)CSS_param.names[0x11]) == 0)
             {
                 this.read_value_CSS_tolower(buf, ref index, max, class2, -1111);
                 num3 = (int)(this.ToFloat(class2) * 20f);
                 if (class2.IndexOfBegin("px") != 0)
                 {
                     num3 = (int)(num3 / 1.3333);
                 }
                 if ((num3 >= 0) && (num3 <= 250))
                 {
                     CSS_style.ablaze.b[0x11] = 1;
                     CSS_style.margin_bottom = (byte)num3;
                 }
                 goto Label_0F0F;
             }
             if (class2.byteCmpi("style") == 0)
             {
                 quote = true;
                 while ((((buf.b[index] == 0x3a) || (buf.b[index] == 0x20)) || (buf.b[index] == 0x3d)) && (index < max))
                 {
                     index++;
                 }
             }
         }
     }
 ct = index;
 for (num2 = 0; num2 < this.STYLES_KNOW; num2++)
 {
     if (CSS_style.ablaze.b[num2] == 1)
     {
         return true;
     }
 }
 return false;
 }
Ejemplo n.º 7
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;
 }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
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;
 }
Ejemplo n.º 10
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;
 }
Ejemplo n.º 11
0
 private void CSS_analyse(CSS_params CSS_param, ByteClass buf, ArrayList font_list, ArrayList color_list)
 {
     int num3;
     int num2 = 0;
     int num4 = 0;
     int num5 = 0;
     int ct = 0;
     ByteClass class2 = new ByteClass();
     buf.ByteToString();
     int index = 0;
     CSS_param.styles = 0;
     while (index < buf.len)
     {
         if ((buf.b[index] == 0x7b) && (num2 == 0))
         {
             num2++;
             num3 = index;
             num5 = this.CSS_read_style_name(buf, ref num3, class2);
         }
         if ((buf.b[index] == 0x7d) && (num2 == 1))
         {
             if (num5 > 1)
             {
                 CSS_param.styles += num5;
             }
             else
             {
                 CSS_param.styles++;
             }
             num2 = 0;
             num5 = 0;
         }
         index++;
     }
     for (index = 0; index < CSS_param.styles; index++)
     {
         CSS_styles cSS = new CSS_styles();
         this.CSS_reset_style(cSS);
         CSS_param.CSS_style.Add(cSS);
     }
     int num7 = 0;
     for (num3 = 0; num3 < (buf.len - 1); num3++)
     {
         if ((buf.b[num3] == 0x2f) && (buf.b[num3 + 1] == 0x2a))
         {
             num7 = 0;
             while (num3 < (buf.len - 1))
             {
                 if ((buf.b[num3] == 0x2f) && (buf.b[num3 + 1] == 0x2a))
                 {
                     num7++;
                 }
                 if ((buf.b[num3] == 0x2a) && (buf.b[num3 + 1] == 0x2f))
                 {
                     num7--;
                     buf.b[num3] = 0x20;
                     buf.b[num3 + 1] = 0x20;
                     if (num7 <= 0)
                     {
                         break;
                     }
                 }
                 buf.b[num3] = 0x20;
                 num3++;
             }
         }
     }
     bool flag = false;
     num3 = 0;
     num4 = 0;
     while ((num3 < buf.len) && (num4 < CSS_param.styles))
     {
         if (buf.b[num3] == 0x7b)
         {
             num5 = this.CSS_read_style_name(buf, ref num3, ((CSS_styles)CSS_param.CSS_style[num4]).name);
             if (num5 > 0)
             {
                 if (num5 > 1)
                 {
                     this.CSS_read_second_name(buf, ref num3, CSS_param.buf_size, ((CSS_styles)CSS_param.CSS_style[num4]).name);
                     this.CSS_parse_name(((CSS_styles)CSS_param.CSS_style[num4]).name, (CSS_styles)CSS_param.CSS_style[num4]);
                     num5--;
                     ct = num3;
                     while ((buf.b[num3] != 0x7b) && (num3 < CSS_param.buf_size))
                     {
                         num3++;
                     }
                 }
                 this.CSS_parse_name(((CSS_styles)CSS_param.CSS_style[num4]).name, (CSS_styles)CSS_param.CSS_style[num4]);
                 if (((((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 0x70) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 80)) && (((CSS_styles)CSS_param.CSS_style[num4]).name.b[1] == 0x2e))
                 {
                     CSS_param.p_tag = true;
                 }
                 if ((((((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 0x65) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 0x45)) && ((((CSS_styles)CSS_param.CSS_style[num4]).name.b[1] == 0x6d) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[1] == 0x4d))) && (((CSS_styles)CSS_param.CSS_style[num4]).name.b[2] == 0x2e))
                 {
                     CSS_param.em_tag = true;
                 }
                 if (((((((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 0x62) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 0x42)) && ((((CSS_styles)CSS_param.CSS_style[num4]).name.b[1] == 0x6f) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[1] == 0x4f))) && (((((CSS_styles)CSS_param.CSS_style[num4]).name.b[2] == 100) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[2] == 0x44)) && ((((CSS_styles)CSS_param.CSS_style[num4]).name.b[3] == 0x79) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[3] == 0x59)))) && (((CSS_styles)CSS_param.CSS_style[num4]).name.b[4] == 0))
                 {
                     if (CSS_param.body_tag)
                     {
                         flag = true;
                     }
                     else
                     {
                         CSS_param.body_tag = true;
                         CSS_param.body_tag_index = num4;
                     }
                 }
                 if (((((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 0x70) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 80)) && (((CSS_styles)CSS_param.CSS_style[num4]).name.b[1] == 0))
                 {
                     CSS_param.p_tag_only = true;
                     CSS_param.p_tag_only_index = num4;
                 }
                 this.CSS_read_style_params(buf, ref num3, CSS_param.buf_size, (CSS_styles)CSS_param.CSS_style[num4], CSS_param, font_list, color_list);
                 if (((flag && ((((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 0x62) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[0] == 0x42))) && ((((CSS_styles)CSS_param.CSS_style[num4]).name.b[1] == 0x6f) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[1] == 0x4f))) && ((((((CSS_styles)CSS_param.CSS_style[num4]).name.b[2] == 100) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[2] == 0x44)) && ((((CSS_styles)CSS_param.CSS_style[num4]).name.b[3] == 0x79) || (((CSS_styles)CSS_param.CSS_style[num4]).name.b[3] == 0x59))) && (((CSS_styles)CSS_param.CSS_style[num4]).name.b[4] == 0)))
                 {
                     this.CSSJoinStyles((CSS_styles)CSS_param.CSS_style[CSS_param.body_tag_index], (CSS_styles)CSS_param.CSS_style[num4]);
                 }
                 num4++;
             }
             if (num5 > 1)
             {
                 while (num5 != 0)
                 {
                     if (num4 < (CSS_param.styles - 1))
                     {
                         ((CSS_styles)CSS_param.CSS_style[num4 - 1]).CopyCSS_styles((CSS_styles)CSS_param.CSS_style[num4]);
                         this.CSS_read_second_name(buf, ref ct, CSS_param.buf_size, ((CSS_styles)CSS_param.CSS_style[num4]).name);
                         this.CSS_parse_name(((CSS_styles)CSS_param.CSS_style[num4]).name, (CSS_styles)CSS_param.CSS_style[num4]);
                         num4++;
                     }
                     num5--;
                 }
             }
         }
         num3++;
     }
 }