Ejemplo n.º 1
0
        internal static VerticalAlignment ToVerticalAlignEnum(RPLFormat.VerticalAlignments val)
        {
            switch (val)
            {
            case RPLFormat.VerticalAlignments.Top:
                return(VerticalAlignment.Top);

            case RPLFormat.VerticalAlignments.Bottom:
                return(VerticalAlignment.Bottom);

            default:
                return(VerticalAlignment.Center);
            }
        }
Ejemplo n.º 2
0
        public static string GetValue(RPLFormat.VerticalAlignments val)
        {
            switch (val)
            {
            case RPLFormat.VerticalAlignments.Top:
                return("top");

            case RPLFormat.VerticalAlignments.Middle:
                return("middle");

            case RPLFormat.VerticalAlignments.Bottom:
                return("bottom");

            default:
                return(null);
            }
        }
        private void SetVerticalAlign(RPLFormat.VerticalAlignments alignment)
        {
            switch (alignment)
            {
            case RPLFormat.VerticalAlignments.Bottom:
                this._document.TableContext.CurrentCell.CellProperties.VerticalAlignment = OpenXmlTableCellPropertiesModel.VerticalAlign.Bottom;
                break;

            case RPLFormat.VerticalAlignments.Middle:
                this._document.TableContext.CurrentCell.CellProperties.VerticalAlignment = OpenXmlTableCellPropertiesModel.VerticalAlign.Middle;
                break;

            case RPLFormat.VerticalAlignments.Top:
                this._document.TableContext.CurrentCell.CellProperties.VerticalAlignment = OpenXmlTableCellPropertiesModel.VerticalAlign.Top;
                break;
            }
        }
Ejemplo n.º 4
0
        private void RenderVerticalAlign(int cellIndex, RPLFormat.VerticalAlignments vertAlign)
        {
            int num = 0;

            switch (vertAlign)
            {
            case RPLFormat.VerticalAlignments.Bottom:
                num = 2;
                break;

            case RPLFormat.VerticalAlignments.Middle:
                num = 1;
                break;
            }
            int    tcLocation = this.GetTcLocation(this.m_numColumns, cellIndex);
            ushort uShort     = LittleEndian.getUShort(this.m_tapx.Buf, tcLocation);

            uShort = (ushort)(uShort | (ushort)(num << 7));
            LittleEndian.PutUShort(this.m_tapx.Buf, tcLocation, uShort);
        }
        private void AdjustParagraphLayout(float totalContent, float newContent, float usedContent, bool firstParagraph, RPLFormat.WritingModes writingMode, ref float delta, ref RectangleF layoutParagraph, ref PointF offset)
        {
            _ = DefinitionProperties;
            RPLFormat.VerticalAlignments verticalAlign = VerticalAlign;
            if (firstParagraph)
            {
                bool flag = false;
                if ((writingMode != 0) ? (totalContent < TextPosition.Width) : (totalContent < TextPosition.Height))
                {
                    switch (verticalAlign)
                    {
                    case RPLFormat.VerticalAlignments.Top:
                        delta = 0f;
                        break;

                    case RPLFormat.VerticalAlignments.Bottom:
                        delta = 0f;
                        if (writingMode == RPLFormat.WritingModes.Horizontal)
                        {
                            delta = TextPosition.Height - totalContent;
                        }
                        else
                        {
                            delta = TextPosition.Width - totalContent;
                        }
                        if (delta < 0f)
                        {
                            delta = 0f;
                        }
                        break;

                    default:
                        delta = 0f;
                        if (writingMode == RPLFormat.WritingModes.Horizontal)
                        {
                            delta = (TextPosition.Height - totalContent) / 2f;
                        }
                        else
                        {
                            delta = (TextPosition.Width - totalContent) / 2f;
                        }
                        if (delta < 0f)
                        {
                            delta = 0f;
                        }
                        break;
                    }
                }
            }
            if (writingMode == RPLFormat.WritingModes.Horizontal)
            {
                layoutParagraph = new RectangleF(TextPosition.X, TextPosition.Y + usedContent + delta, TextPosition.Width, newContent);
                offset          = new PointF(0f, usedContent + delta);
                return;
            }
            float num = newContent;
            float num2;

            if (writingMode == RPLFormat.WritingModes.Vertical)
            {
                num2 = TextPosition.Width - (usedContent + delta + newContent);
                if (num2 < 0f)
                {
                    num += num2;
                    num2 = 0f;
                }
            }
            else
            {
                num2 = usedContent + delta;
                if (num > TextPosition.Width)
                {
                    num = TextPosition.Width;
                }
            }
            layoutParagraph = new RectangleF(TextPosition.X + num2, TextPosition.Y, num, TextPosition.Height);
            offset          = new PointF(newContent, 0f);
        }
Ejemplo n.º 6
0
        public Rectangle GetTextBoundingBoxPx(Rectangle rect, RPLFormat.VerticalAlignments vAlign)
        {
            if (this.RTParagraphs == null)
            {
                return(new Rectangle(rect.Location, Size.Empty));
            }
            Rectangle rectangle = Rectangle.Empty;
            Size      size      = default(Size);
            int       num       = rect.Top;
            Size      size2     = rect.Size;

            if (this.RTTextbox.VerticalText)
            {
                size2 = new Size(size2.Height, size2.Width);
            }
            foreach (Paragraph rTParagraph in this.RTParagraphs)
            {
                int num2 = 0;
                if (rTParagraph.TextLines.Count == 1 && rTParagraph.ParagraphProps.HangingIndent > 0.0)
                {
                    num2 += TextBox.ConvertToPixels(rTParagraph.ParagraphProps.HangingIndent, this.Dpi);
                }
                foreach (TextLine textLine in rTParagraph.TextLines)
                {
                    size.Width   = Math.Max(Math.Max(size.Width, textLine.GetWidth(Win32DCSafeHandle.Zero, this.FontCache)), 10);
                    size.Height += textLine.GetHeight(Win32DCSafeHandle.Zero, this.FontCache);
                }
                switch (rTParagraph.ParagraphProps.Alignment)
                {
                case RPLFormat.TextAlignments.General:
                    if (this.RTTextbox.TextBoxProps.Direction != RPLFormat.Directions.RTL)
                    {
                        goto case RPLFormat.TextAlignments.Left;
                    }
                    goto case RPLFormat.TextAlignments.Right;

                case RPLFormat.TextAlignments.Left:
                    num2 += rect.Left;
                    break;

                case RPLFormat.TextAlignments.Center:
                    num2 += rect.Left + (size2.Width - size.Width) / 2;
                    break;

                case RPLFormat.TextAlignments.Right:
                    num2 += rect.Left + size2.Width - size.Width;
                    break;

                default:
                    throw new ArgumentException("Unknown TextAlignment: " + rTParagraph.ParagraphProps.Alignment.ToString());
                }
                num2 = ((this.RTTextbox.TextBoxProps.Direction != 0) ? (num2 - TextBox.ConvertToPixels((float)(rTParagraph.ParagraphProps.RightIndent + 10.583333015441895 * (float)rTParagraph.ParagraphProps.ListLevel), this.Dpi)) : (num2 + TextBox.ConvertToPixels((float)(rTParagraph.ParagraphProps.LeftIndent + 10.583333015441895 * (float)rTParagraph.ParagraphProps.ListLevel), this.Dpi)));
                Rectangle rectangle2 = new Rectangle(new Point(num2, num), size);
                num      += size.Height;
                rectangle = ((!rectangle.IsEmpty) ? Rectangle.Union(rectangle, rectangle2) : rectangle2);
            }
            if (rectangle.Height < size2.Height)
            {
                switch (vAlign)
                {
                case RPLFormat.VerticalAlignments.Middle:
                    rectangle.Y += (size2.Height - rectangle.Height) / 2;
                    break;

                case RPLFormat.VerticalAlignments.Bottom:
                    rectangle.Y = rect.Top + size2.Height - rectangle.Height;
                    break;
                }
            }
            if (this.RTTextbox.VerticalText)
            {
                Point location = new Point(rect.Right - (rectangle.Top - rect.Top) - rectangle.Height, rectangle.Left);
                Size  size3    = new Size(rectangle.Height, rectangle.Width);
                rectangle = new Rectangle(location, size3);
            }
            return(Rectangle.Intersect(rect, rectangle));
        }
 public static void GetFontFormatInformation(RPLElementProps elementProperties, out RPLFormat.WritingModes writingMode, out RPLFormat.Directions direction, out RPLFormat.VerticalAlignments verticalAlign, out RPLFormat.TextAlignments textAlign, ref bool stringFormatFromInstance)
 {
     writingMode   = (RPLFormat.WritingModes)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)30, ref stringFormatFromInstance);
     direction     = (RPLFormat.Directions)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)29, ref stringFormatFromInstance);
     verticalAlign = (RPLFormat.VerticalAlignments)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)26, ref stringFormatFromInstance);
     textAlign     = (RPLFormat.TextAlignments)SharedRenderer.GetStylePropertyValueObject(elementProperties, (byte)25, ref stringFormatFromInstance);
 }
Ejemplo n.º 8
0
 internal static void GetFontFormatInformation(RPLElementProps elementProperties, out RPLFormat.WritingModes writingMode, out RPLFormat.Directions direction, out RPLFormat.VerticalAlignments verticalAlign, out RPLFormat.TextAlignments textAlign, ref bool stringFormatFromInstance)
 {
     writingMode   = (RPLFormat.WritingModes)GetStylePropertyValueObject(elementProperties, 30, ref stringFormatFromInstance);
     direction     = (RPLFormat.Directions)GetStylePropertyValueObject(elementProperties, 29, ref stringFormatFromInstance);
     verticalAlign = (RPLFormat.VerticalAlignments)GetStylePropertyValueObject(elementProperties, 26, ref stringFormatFromInstance);
     textAlign     = (RPLFormat.TextAlignments)GetStylePropertyValueObject(elementProperties, 25, ref stringFormatFromInstance);
 }
Ejemplo n.º 9
0
 public virtual void DrawTextRun(Win32DCSafeHandle hdc, FontCache fontCache, ReportTextBox textBox, TextRun run, TypeCode typeCode, RPLFormat.TextAlignments textAlign, RPLFormat.VerticalAlignments verticalAlign, RPLFormat.WritingModes writingMode, RPLFormat.Directions direction, Point position, Rectangle layoutRectangle, int lineHeight, int baselineY)
 {
 }
Ejemplo n.º 10
0
        public override void DrawTextRun(Win32DCSafeHandle hdc, FontCache fontCache, ReportTextBox textBox, AspNetCore.ReportingServices.Rendering.RichText.TextRun run, TypeCode typeCode, RPLFormat.TextAlignments textAlign, RPLFormat.VerticalAlignments verticalAlign, RPLFormat.WritingModes writingMode, RPLFormat.Directions direction, Point pointPosition, System.Drawing.Rectangle layoutRectangle, int lineHeight, int baselineY)
        {
            if (!string.IsNullOrEmpty(run.Text))
            {
                int x;
                int baselineY2;
                switch (writingMode)
                {
                case RPLFormat.WritingModes.Horizontal:
                    x          = layoutRectangle.X + pointPosition.X;
                    baselineY2 = layoutRectangle.Y + baselineY;
                    break;

                case RPLFormat.WritingModes.Vertical:
                    x          = layoutRectangle.X + (layoutRectangle.Width - baselineY);
                    baselineY2 = layoutRectangle.Y + pointPosition.X;
                    break;

                case RPLFormat.WritingModes.Rotate270:
                    x          = layoutRectangle.X + baselineY;
                    baselineY2 = layoutRectangle.Y + layoutRectangle.Height - pointPosition.X;
                    break;

                default:
                    throw new NotSupportedException();
                }
                Underline underline = null;
                if (run.UnderlineHeight > 0)
                {
                    underline = new Underline(run, hdc, fontCache, layoutRectangle, pointPosition.X, baselineY, writingMode);
                }
                if (!this.IsEmf)
                {
                    AspNetCore.ReportingServices.Rendering.RichText.TextBox.DrawTextRun(run, hdc, fontCache, x, baselineY2, underline);
                }
                else
                {
                    AspNetCore.ReportingServices.Rendering.RichText.TextBox.ExtDrawTextRun(run, hdc, fontCache, x, baselineY2, underline);
                }
            }
        }