void RenderDiagonalBorders(Borders mergedBorders, Rectangle innerRect)
 {
   BordersRenderer bordersRenderer = new BordersRenderer(mergedBorders, this.gfx);
   bordersRenderer.RenderDiagonally(BorderType.DiagonalDown, innerRect.X, innerRect.Y, innerRect.Width, innerRect.Height);
   bordersRenderer.RenderDiagonally(BorderType.DiagonalUp, innerRect.X, innerRect.Y, innerRect.Width, innerRect.Height);
 }
    void RenderContent(Cell cell, Rectangle innerRect)
    {
      FormattedCell formattedCell = (FormattedCell)this.formattedCells[cell];
      RenderInfo[] renderInfos = formattedCell.GetRenderInfos();

      if (renderInfos == null)
        return;

      VerticalAlignment verticalAlignment = cell.VerticalAlignment;
      XUnit contentHeight = formattedCell.ContentHeight;
      XUnit innerHeight = innerRect.Height;
      XUnit targetX = innerRect.X + cell.Column.LeftPadding;

      XUnit targetY;
      if (verticalAlignment == VerticalAlignment.Bottom)
      {
        targetY = innerRect.Y + innerRect.Height;
        targetY -= cell.Row.BottomPadding;
        targetY -= contentHeight;
      }
      else if (verticalAlignment == VerticalAlignment.Center)
      {
        targetY = innerRect.Y + cell.Row.TopPadding;
        targetY += innerRect.Y + innerRect.Height - cell.Row.BottomPadding;
        targetY -= contentHeight;
        targetY /= 2;
      }
      else
        targetY = innerRect.Y + cell.Row.TopPadding;

      RenderByInfos(targetX, targetY, renderInfos);
    }
 void RenderShading(Cell cell, Rectangle innerRect)
 {
   ShadingRenderer shadeRenderer = new ShadingRenderer(this.gfx, cell.Shading);
   shadeRenderer.Render(innerRect.X, innerRect.Y, innerRect.Width, innerRect.Height);
 }
    void RenderBorders(Cell cell, Rectangle innerRect)
    {
      XUnit leftPos = innerRect.X;
      XUnit rightPos = leftPos + innerRect.Width;
      XUnit topPos = innerRect.Y;
      XUnit bottomPos = innerRect.Y + innerRect.Height;
      Borders mergedBorders = this.mergedCells.GetEffectiveBorders(cell);

      BordersRenderer bordersRenderer = new BordersRenderer(mergedBorders, this.gfx);
      XUnit bottomWidth = bordersRenderer.GetWidth(BorderType.Bottom);
      XUnit leftWidth = bordersRenderer.GetWidth(BorderType.Left);
      XUnit topWidth = bordersRenderer.GetWidth(BorderType.Top);
      XUnit rightWidth = bordersRenderer.GetWidth(BorderType.Right);

      bordersRenderer.RenderVertically(BorderType.Right, rightPos, topPos, bottomPos + bottomWidth - topPos);
      bordersRenderer.RenderVertically(BorderType.Left, leftPos - leftWidth, topPos, bottomPos + bottomWidth - topPos);
      bordersRenderer.RenderHorizontally(BorderType.Bottom, leftPos - leftWidth, bottomPos, rightPos + rightWidth + leftWidth - leftPos);
      bordersRenderer.RenderHorizontally(BorderType.Top, leftPos - leftWidth, topPos - topWidth, rightPos + rightWidth + leftWidth - leftPos);

      RenderDiagonalBorders(mergedBorders, innerRect);
    }
Beispiel #5
0
        void RenderPlotArea(PlotArea area, Rectangle rect)
        {
            PdfSharp.Charting.ChartFrame chartFrame = ((ChartFormatInfo)_renderInfo.FormatInfo).ChartFrame;

            XUnit top = rect.Y;
            top += area.TopPadding;

            XUnit bottom = rect.Y + rect.Height;
            bottom -= area.BottomPadding;

            XUnit left = rect.X;
            left += area.LeftPadding;

            XUnit right = rect.X + rect.Width;
            right -= area.RightPadding;

            chartFrame.Location = new XPoint(left, top);
            chartFrame.Size = new XSize(right - left, bottom - top);
            chartFrame.DrawChart(_gfx);
        }
Beispiel #6
0
 /// <summary>
 /// Initializes a new Rectangle by copying its values.
 /// </summary>
 /// <param name="rect">The rectangle to copy.</param>
 internal Rectangle(Rectangle rect)
 {
     _x = rect._x;
     _y = rect._y;
     _width = rect._width;
     _height = rect._height;
 }
Beispiel #7
0
        void RenderArea(FormattedTextArea area, Rectangle rect)
        {
            if (area == null)
                return;

            TextArea textArea = area.TextArea;

            FillFormatRenderer fillFormatRenderer = new FillFormatRenderer((FillFormat)textArea.GetValue("FillFormat", GV.ReadOnly), _gfx);
            fillFormatRenderer.Render(rect.X, rect.Y, rect.Width, rect.Height);

            XUnit top = rect.Y;
            top += textArea.TopPadding;
            XUnit bottom = rect.Y + rect.Height;
            bottom -= textArea.BottomPadding;
            top = AlignVertically(textArea.VerticalAlignment, top, bottom, area.ContentHeight);

            XUnit left = rect.X;
            left += textArea.LeftPadding;

            RenderInfo[] renderInfos = area.GetRenderInfos();
            RenderByInfos(left, top, renderInfos);

            LineFormatRenderer lineFormatRenderer = new LineFormatRenderer((LineFormat)textArea.GetValue("LineFormat", GV.ReadOnly), _gfx);
            lineFormatRenderer.Render(rect.X, rect.Y, rect.Width, rect.Height);
        }
Beispiel #8
0
        private void RenderBorders(Cell cell, Rectangle innerRect)
        {
            XUnit leftPos = innerRect.X;
            XUnit rightPos = leftPos + innerRect.Width;
            XUnit topPos = innerRect.Y;
            XUnit bottomPos = innerRect.Y + innerRect.Height;
            Borders mergedBorders = _mergedCells.GetEffectiveBorders(cell);

            BordersRenderer bordersRenderer = new BordersRenderer(mergedBorders, _gfx);
            XUnit bottomWidth = bordersRenderer.GetWidth(BorderType.Bottom);
            XUnit leftWidth = bordersRenderer.GetWidth(BorderType.Left);
            XUnit topWidth = bordersRenderer.GetWidth(BorderType.Top);
            XUnit rightWidth = bordersRenderer.GetWidth(BorderType.Right);

            if (cell.RoundedCorner == RoundedCorner.TopLeft)
                bordersRenderer.RenderRounded(cell.RoundedCorner, innerRect.X, innerRect.Y, innerRect.Width + rightWidth, innerRect.Height + bottomWidth);
            else if (cell.RoundedCorner == RoundedCorner.TopRight)
                bordersRenderer.RenderRounded(cell.RoundedCorner, innerRect.X - leftWidth, innerRect.Y, innerRect.Width + leftWidth, innerRect.Height + bottomWidth);
            else if (cell.RoundedCorner == RoundedCorner.BottomLeft)
                bordersRenderer.RenderRounded(cell.RoundedCorner, innerRect.X, innerRect.Y - topWidth, innerRect.Width + rightWidth, innerRect.Height + topWidth);
            else if (cell.RoundedCorner == RoundedCorner.BottomRight)
                bordersRenderer.RenderRounded(cell.RoundedCorner, innerRect.X - leftWidth, innerRect.Y - topWidth, innerRect.Width + leftWidth, innerRect.Height + topWidth);

            // Render horizontal and vertical borders only if touching no rounded corner.
            if (cell.RoundedCorner != RoundedCorner.TopRight && cell.RoundedCorner != RoundedCorner.BottomRight)
                bordersRenderer.RenderVertically(BorderType.Right, rightPos, topPos, bottomPos + bottomWidth - topPos);
            
            if (cell.RoundedCorner != RoundedCorner.TopLeft && cell.RoundedCorner != RoundedCorner.BottomLeft)
                bordersRenderer.RenderVertically(BorderType.Left, leftPos - leftWidth, topPos, bottomPos + bottomWidth - topPos);

            if (cell.RoundedCorner != RoundedCorner.BottomLeft && cell.RoundedCorner != RoundedCorner.BottomRight)
                bordersRenderer.RenderHorizontally(BorderType.Bottom, leftPos - leftWidth, bottomPos, rightPos + rightWidth + leftWidth - leftPos);

            if (cell.RoundedCorner != RoundedCorner.TopLeft && cell.RoundedCorner != RoundedCorner.TopRight)
                bordersRenderer.RenderHorizontally(BorderType.Top, leftPos - leftWidth, topPos - topWidth, rightPos + rightWidth + leftWidth - leftPos);
            
            RenderDiagonalBorders(mergedBorders, innerRect);
        }
Beispiel #9
0
 private void RenderShading(Cell cell, Rectangle innerRect)
 {
     ShadingRenderer shadeRenderer = new ShadingRenderer(_gfx, cell.Shading);
     shadeRenderer.Render(innerRect.X, innerRect.Y, innerRect.Width, innerRect.Height, cell.RoundedCorner);
 }
Beispiel #10
0
        void FinishLayoutInfo(Area area)
        {
            LayoutInfo layoutInfo = this.renderInfo.LayoutInfo;
              Area contentArea = new Rectangle(area.X, area.Y, ShapeWidth, ShapeHeight);
              layoutInfo.ContentArea = contentArea;
              layoutInfo.MarginTop = this.shape.WrapFormat.DistanceTop.Point;
              layoutInfo.MarginLeft = this.shape.WrapFormat.DistanceLeft.Point;
              layoutInfo.MarginBottom = this.shape.WrapFormat.DistanceBottom.Point;
              layoutInfo.MarginRight = this.shape.WrapFormat.DistanceRight.Point;
              layoutInfo.KeepTogether = true;
              layoutInfo.KeepWithNext = false;
              layoutInfo.PageBreakBefore = false;
              layoutInfo.MinWidth = this.ShapeWidth;

              if (this.shape.Top.ShapePosition == ShapePosition.Undefined)
            layoutInfo.Top = this.shape.Top.Position.Point;

              layoutInfo.VerticalAlignment = GetVerticalAlignment();
              layoutInfo.HorizontalAlignment = GetHorizontalAlignment();

              if (this.shape.Left.ShapePosition == ShapePosition.Undefined)
            layoutInfo.Left = this.shape.Left.Position.Point;

              layoutInfo.HorizontalReference = GetHorizontalReference();
              layoutInfo.VerticalReference = GetVerticalReference();
              layoutInfo.Floating = GetFloating();
        }
Beispiel #11
0
 /// <summary>
 /// Initializes a new Rectangle by copying its values.
 /// </summary>
 /// <param name="rect">The rectangle to copy.</param>
 internal Rectangle(Rectangle rect)
 {
   this.x = rect.x;
   this.y = rect.y;
   this.width = rect.width;
   this.height = rect.height;
 }