private static string GetAlignString(AlignOption align)
        {
            switch (align)
            {
            case AlignOption.Left:
                return("left");

            case AlignOption.Right:
                return("right");

            case AlignOption.Middle:
                return("middle");

            case AlignOption.Top:
                return("top");

            case AlignOption.Bottom:
                return("bottom");

            case AlignOption.None:
                return("none");

            default:
                throw new InvalidOperationException("Not supported align enum value.");
            }
        }
Ejemplo n.º 2
0
 private static string GetAlignString(AlignOption align)
 {
     switch (align)
     {
         case AlignOption.Left:
             return "left";
         case AlignOption.Right:
             return "right";
         case AlignOption.Middle:
             return "middle";
         case AlignOption.Top:
             return "top";
         case AlignOption.Bottom:
             return "bottom";
         case AlignOption.None:
             return "none";
         default:
             throw new InvalidOperationException("Not supported align enum value.");
     }
 }
Ejemplo n.º 3
0
		abstract public void WriteTableCell(string s,  bool isHighlighted, AlignOption alignment, int colSpan, int RowSpan, bool hasBorder, bool allowBreaks, int Width, string bgcolor);
Ejemplo n.º 4
0
		abstract public void WriteOpenTable(AlignOption alignment, bool hasBorder, int Width);
Ejemplo n.º 5
0
 public ImageOptions(ImageOptions other)
 {
     Width = other.Width;
     Height = other.Height;
     Align = other.Align;
 }
Ejemplo n.º 6
0
 public ImageOptions(string width, string height, string align)
 {
     Width = string.IsNullOrWhiteSpace(width) ? -1 : int.Parse(width);
     Height = string.IsNullOrWhiteSpace(height) ? -1 : int.Parse(height);
     Align = string.IsNullOrWhiteSpace(align) ? AlignOption.None : GetAlignOption(align);
 }
 public ImageOptions(string width, string height, string align)
 {
     Width  = string.IsNullOrWhiteSpace(width) ? -1 : int.Parse(width);
     Height = string.IsNullOrWhiteSpace(height) ? -1 : int.Parse(height);
     Align  = string.IsNullOrWhiteSpace(align) ? AlignOption.None : GetAlignOption(align);
 }
 public ImageOptions(ImageOptions other)
 {
     Width  = other.Width;
     Height = other.Height;
     Align  = other.Align;
 }
Ejemplo n.º 9
0
		override public void WriteTableCell(string s,  bool isHighlighted, AlignOption alignment, int colSpan, int rowSpan, bool hasBorder, bool allowBreaks, int width, string bgColor)
		{
			Write("<td  ");
			if (isHighlighted)
			{
				if (hasBorder)
					Write("class=\"TableCellHighlighted\"");
				else
					Write("class=\"TableCellHighlightedNoBorder\"");
			}			
			else
			{
				if (hasBorder)
					Write("class=\"TableCell\"");
				else
					Write("class=\"TableCellNoBorder\"");
			}

			if (bgColor != null)
				Write(" style=\" background: " + Formatter.EscapeHTML(bgColor) + "\" ");

      if (!allowBreaks)
      {
        Write(" nowrap ");
      }
      if (width > 0)
      {
        Write(" width=\"" + width + "%\" ");
      }

			switch (alignment)
			{
				case AlignOption.None:
					break;

				case AlignOption.Left:
					Write(" align=\"left\" ");
					break;

				case AlignOption.Right:
					Write(" align=\"right\" ");
					break;

				case AlignOption.Center:
					Write(" align=\"center\" ");
					break;
			}

      if (colSpan != 1)
      {
        Write(" colspan=\"" + colSpan + "\" ");
      }
      if (rowSpan != 1)
      {
        Write(" rowspan=\"" + rowSpan + "\" ");
      }
				
			WriteLine(css() + ">" + s + "</td>");
		}
Ejemplo n.º 10
0
		override public void WriteOpenTable(AlignOption alignment, bool hasBorder, int width)
		{
			string styles = "";
			Write("<table ");
			switch (alignment)
			{
				case AlignOption.None:
					break;

				case AlignOption.Left:
					styles += ";margin-left: 0; float: left ";
					Write(" align=\"left\" ");
					break;

				case AlignOption.Right:
					styles += ";margin-left: 0; float: right";
					break;

				case AlignOption.Center:
					Write(" align=\"center\" ");
					break;
			}
      if (width > 0)
      {
        Write(" width=\"" + width + "%\" ");
      }
			string cls = "TableClass";
      if (!hasBorder)
      {
        cls = "TableWithoutBorderClass";
      }
			WriteLine("cellpadding=\"2\" cellspacing=\"1\" class=\"" + cls + "\"" + css(styles) + ">");
		}
Ejemplo n.º 11
0
 public override void WriteTableCell(string s, bool isHighlighted, 
     AlignOption alignment, int colSpan, int RowSpan, bool hasBorder,
     bool allowBreaks, int Width, string bgcolor)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 12
0
 public override void WriteOpenTable(AlignOption alignment, bool hasBorder, int Width)
 {
     throw new Exception("The method or operation is not implemented.");
 }
Ejemplo n.º 13
0
		/// <summary>
		/// Parse the given options and change the options of this object as a side-effect.  Answer null if the parse goes OK or an error message if not.
		/// </summary>
		/// <param name="format"></param>
		/// <returns></returns>
		public string Parse(string format)
		{
			for (int p = 0; p < format.Length; p++)
			{
				char ch = format[p];
				string num;

				switch (ch)
				{
					case '!':
						IsHighlighted = true;
						continue;

					case '+':
						AllowBreaks = false;
						continue;
				
					case ']':
						CellAlignment = AlignOption.Right;
						continue;

					case '[':
						CellAlignment = AlignOption.Left;
						continue;

					case '^':
						CellAlignment = AlignOption.Center;
						continue;

					case 'T':
						if (p + 1 >= format.Length)
							return "Missing option for 'T' in table format";
						p++;
						char ch2 = format[p];
						switch (ch2)
						{
							case '-':
								HasBorder = false;
								continue;

							case ']':
								TableAlignment = AlignOption.Right;
								continue;

							case '[':
								TableAlignment = AlignOption.Left;
								continue;

							case '^':
								TableAlignment = AlignOption.Center;
								continue;

							case 'W':
								num = "";
								if (p + 1 >= format.Length  || !Char.IsDigit(format[p + 1]))
									return "Missing number for table width percentage option 'TW' in table format";
								p++;
								while (p < format.Length && Char.IsDigit(format[p]))
									num += format[p++];
								TableWidth = Int32.Parse(num);
								p--;
								continue;

							default:
								return "Unknown table formatting option: T" + ch2;
						}

					case 'W':
						num = "";
						if (p + 1 >= format.Length  || !Char.IsDigit(format[p + 1]))
							return "Missing number for cell width percentage option 'W' in table format";
						p++;
						while (p < format.Length && Char.IsDigit(format[p]))
							num += format[p++];
						CellWidth = Int32.Parse(num);
						p--;
						continue;
  
					case 'R':
						num = "";
						if (p + 1 >= format.Length || !Char.IsDigit(format[p + 1]))
							return "Missing number for row span option 'R' in table format";
						p++;
						while (p < format.Length && Char.IsDigit(format[p]))
							num += format[p++];
						RowSpan = Int32.Parse(num);
						p--;
						continue;

					case 'C':
						num = "";
						if (p + 1 >= format.Length || !Char.IsDigit(format[p + 1]))
							return "Missing number for column span option 'C' in table format";
						p++;
						while (p < format.Length && Char.IsDigit(format[p]))
							num += format[p++];
						ColSpan = Int32.Parse(num);
						p--;
						continue;

					case '*':
						if (p + 1 >= format.Length)
							return "Missing color for background color option '<>' in table format";
						p++;
						BackgroundColor = "";
						while (p < format.Length && format[p] != '*')
							BackgroundColor += format[p++];
						if (BackgroundColor == "")
							return "Missing color for background color option '**' in table format";
						continue;


					default:
						return "Unknown table formatting option: " + ch;
				}
			}
			return null;
		}