internal void copyFrom(RtfCharFormat src)
 {
     if (src == null)
     {
         return;
     }
     _begin = src._begin;
     _end   = src._end;
     if (_font == null && src._font != null)
     {
         _font = new FontDescriptor(src._font.Value);
     }
     if (_ansiFont == null && src._ansiFont != null)
     {
         _ansiFont = new FontDescriptor(src._ansiFont.Value);
     }
     if (_fontSize < 0 && src._fontSize >= 0)
     {
         _fontSize = src._fontSize;
     }
     if (_fontStyle.IsEmpty && !src._fontStyle.IsEmpty)
     {
         _fontStyle = new FontStyle(src._fontStyle);
     }
     if (_bgColor == null && src._bgColor != null)
     {
         _bgColor = new ColorDescriptor(src._bgColor.Value);
     }
     if (_fgColor == null && src._fgColor != null)
     {
         _fgColor = new ColorDescriptor(src._fgColor.Value);
     }
 }
		internal void copyFrom(RtfCharFormat src)
		{
			if (src == null) {
				return;
			}
			_begin = src._begin;
			_end = src._end;
			if (_font == null && src._font != null) {
				_font = new FontDescriptor(src._font.Value);
			}
			if (_ansiFont == null && src._ansiFont != null) {
				_ansiFont = new FontDescriptor(src._ansiFont.Value);
			}
			if (_fontSize < 0 && src._fontSize >= 0) {
				_fontSize = src._fontSize;
			}
			if (_fontStyle.IsEmpty && !src._fontStyle.IsEmpty) {
				_fontStyle = new FontStyle(src._fontStyle);
			}
			if (_bgColor == null && src._bgColor != null) {
				_bgColor = new ColorDescriptor(src._bgColor.Value);
			}
			if (_fgColor == null && src._fgColor != null) {
				_fgColor = new ColorDescriptor(src._fgColor.Value);
			}
		}
Example #3
0
        private ColorDescriptor ColorFor(L4j level)
        {
            switch (level)
            {
                case L4j.Fatal: return _fatal ?? (_fatal
                    = _doc.createColor(Color.Red));

                case L4j.Error: return _error ?? (_error
                    = _doc.createColor(Color.Red));

                case L4j.Warn: return _warn ?? (_warn
                    = _doc.createColor(Color.Yellow));

                case L4j.Info: return _info ?? (_info
                    = _doc.createColor(Color.White));

                case L4j.Debug: return _debug ?? (_debug
                    = _doc.createColor(Color.DarkGray));

                case L4j.Trace: return _trace ?? (_trace
                    = _doc.createColor(Color.SlateGray));

                case L4j.Off: return _off ?? (_off 
                    = _doc.createColor(Color.Transparent));

                default:
                    throw Error.Unsupported(level);
            }
        }
Example #4
0
 public void setInnerBorder(BorderStyle style, float width, ColorDescriptor color)
 {
     for (int i = 0; i < _rowCount; i++)
     {
         for (int j = 0; j < _colCount; j++)
         {
             if (i == 0)
             {
                 // The first row
                 _cells[i][j].Borders[Direction.Bottom].Style = style;
                 _cells[i][j].Borders[Direction.Bottom].Width = width;
                 _cells[i][j].Borders[Direction.Bottom].Color = color;
             }
             else if (i == _rowCount - 1)
             {
                 // The last row
                 _cells[i][j].Borders[Direction.Top].Style = style;
                 _cells[i][j].Borders[Direction.Top].Width = width;
                 _cells[i][j].Borders[Direction.Top].Color = color;
             }
             else
             {
                 _cells[i][j].Borders[Direction.Top].Style    = style;
                 _cells[i][j].Borders[Direction.Top].Width    = width;
                 _cells[i][j].Borders[Direction.Top].Color    = color;
                 _cells[i][j].Borders[Direction.Bottom].Style = style;
                 _cells[i][j].Borders[Direction.Bottom].Color = color;
                 _cells[i][j].Borders[Direction.Bottom].Width = width;
             }
             if (j == 0)
             {
                 // The first column
                 _cells[i][j].Borders[Direction.Right].Style = style;
                 _cells[i][j].Borders[Direction.Right].Width = width;
                 _cells[i][j].Borders[Direction.Right].Color = color;
             }
             else if (j == _colCount - 1)
             {
                 // The last row
                 _cells[i][j].Borders[Direction.Left].Style = style;
                 _cells[i][j].Borders[Direction.Left].Width = width;
                 _cells[i][j].Borders[Direction.Left].Color = color;
             }
             else
             {
                 _cells[i][j].Borders[Direction.Right].Style = style;
                 _cells[i][j].Borders[Direction.Right].Width = width;
                 _cells[i][j].Borders[Direction.Right].Color = color;
                 _cells[i][j].Borders[Direction.Left].Style  = style;
                 _cells[i][j].Borders[Direction.Left].Width  = width;
                 _cells[i][j].Borders[Direction.Left].Color  = color;
             }
         }
     }
 }
		internal RtfCharFormat(int begin, int end, int textLength)
		{
			// Note: 
			// In the condition that ``_begin == _end == -1'',
			// the character formatting is applied to the whole paragraph.
			_begin = -1;
			_end = -1;
			_font = null;	// do not specify font (use default one)
			_ansiFont = null;	// do not specify font (use default one)
			_fontSize = -1;			// do not specify font size (use default one)
			_fontStyle = new FontStyle();
			_bgColor = null;
			_fgColor = null;
			_twoInOneStyle = TwoInOneStyle.NotEnabled;
			setRange(begin, end, textLength);
		}
 internal RtfCharFormat(int begin, int end, int textLength)
 {
     // Note:
     // In the condition that ``_begin == _end == -1'',
     // the character formatting is applied to the whole paragraph.
     _begin         = -1;
     _end           = -1;
     _font          = null;      // do not specify font (use default one)
     _ansiFont      = null;      // do not specify font (use default one)
     _fontSize      = -1;        // do not specify font size (use default one)
     _fontStyle     = new FontStyle();
     _bgColor       = null;
     _fgColor       = null;
     _twoInOneStyle = TwoInOneStyle.NotEnabled;
     setRange(begin, end, textLength);
 }
Example #7
0
 public void setOuterBorder(BorderStyle style, float width, ColorDescriptor color)
 {
     for (int i = 0; i < _colCount; i++)
     {
         _cells[0][i].Borders[Direction.Top].Style = style;
         _cells[0][i].Borders[Direction.Top].Width = width;
         _cells[0][i].Borders[Direction.Top].Color = color;
         _cells[_rowCount - 1][i].Borders[Direction.Bottom].Style = style;
         _cells[_rowCount - 1][i].Borders[Direction.Bottom].Width = width;
         _cells[_rowCount - 1][i].Borders[Direction.Bottom].Color = color;
     }
     for (int i = 0; i < _rowCount; i++)
     {
         _cells[i][0].Borders[Direction.Left].Style = style;
         _cells[i][0].Borders[Direction.Left].Width = width;
         _cells[i][0].Borders[Direction.Left].Color = color;
         _cells[i][_colCount - 1].Borders[Direction.Right].Style = style;
         _cells[i][_colCount - 1].Borders[Direction.Right].Width = width;
         _cells[i][_colCount - 1].Borders[Direction.Right].Color = color;
     }
 }
Example #8
0
		/// <summary>
		/// Internal use only.
		/// Default constructor that sets border style to None.
		/// </summary>
		internal Border()
		{
			_style = BorderStyle.None;
			_width = 0.5F;
			_colorDesc = new ColorDescriptor(0);
		}
Example #9
0
 /// <summary>
 /// Internal use only.
 /// Default constructor that sets border style to None.
 /// </summary>
 internal Border()
 {
     _style     = BorderStyle.None;
     _width     = 0.5F;
     _colorDesc = new ColorDescriptor(0);
 }
Example #10
0
		public void setOuterBorder(BorderStyle style, float width, ColorDescriptor color)
		{
			for (int i = 0; i < _colCount; i++) {
				_cells[0][i].Borders[Direction.Top].Style = style;
				_cells[0][i].Borders[Direction.Top].Width = width;
				_cells[0][i].Borders[Direction.Top].Color = color;
				_cells[_rowCount - 1][i].Borders[Direction.Bottom].Style = style;
				_cells[_rowCount - 1][i].Borders[Direction.Bottom].Width = width;
				_cells[_rowCount - 1][i].Borders[Direction.Bottom].Color = color;
			}
			for (int i = 0; i < _rowCount; i++) {
				_cells[i][0].Borders[Direction.Left].Style = style;
				_cells[i][0].Borders[Direction.Left].Width = width;
				_cells[i][0].Borders[Direction.Left].Color = color;
				_cells[i][_colCount - 1].Borders[Direction.Right].Style = style;
				_cells[i][_colCount - 1].Borders[Direction.Right].Width = width;
				_cells[i][_colCount - 1].Borders[Direction.Right].Color = color;
			}
		}
Example #11
0
		public void setInnerBorder(BorderStyle style, float width, ColorDescriptor color)
		{
			for (int i = 0; i < _rowCount; i++) {
				for (int j = 0; j < _colCount; j++) {
					if (i == 0) {
						// The first row
						_cells[i][j].Borders[Direction.Bottom].Style = style;
						_cells[i][j].Borders[Direction.Bottom].Width = width;
						_cells[i][j].Borders[Direction.Bottom].Color = color;
					} else if (i == _rowCount - 1) {
						// The last row
						_cells[i][j].Borders[Direction.Top].Style = style;
						_cells[i][j].Borders[Direction.Top].Width = width;
						_cells[i][j].Borders[Direction.Top].Color = color;
					} else {
						_cells[i][j].Borders[Direction.Top].Style = style;
						_cells[i][j].Borders[Direction.Top].Width = width;
						_cells[i][j].Borders[Direction.Top].Color = color;
						_cells[i][j].Borders[Direction.Bottom].Style = style;
						_cells[i][j].Borders[Direction.Bottom].Color = color;
						_cells[i][j].Borders[Direction.Bottom].Width = width;
					}
					if (j == 0) {
						// The first column
						_cells[i][j].Borders[Direction.Right].Style = style;
						_cells[i][j].Borders[Direction.Right].Width = width;
						_cells[i][j].Borders[Direction.Right].Color = color;
					} else if (j == _colCount - 1) {
						// The last row
						_cells[i][j].Borders[Direction.Left].Style = style;
						_cells[i][j].Borders[Direction.Left].Width = width;
						_cells[i][j].Borders[Direction.Left].Color = color;
					} else {
						_cells[i][j].Borders[Direction.Right].Style = style;
						_cells[i][j].Borders[Direction.Right].Width = width;
						_cells[i][j].Borders[Direction.Right].Color = color;
						_cells[i][j].Borders[Direction.Left].Style = style;
						_cells[i][j].Borders[Direction.Left].Width = width;
						_cells[i][j].Borders[Direction.Left].Color = color;
					}
				}
			}
		}