internal override void ProcessRenderingElementContent(RPLElement rplElement, GdiContext context, RectangleF bounds) { if (m_textRuns == null) { m_textRuns = new List <RenderingTextRun>(); } if (m_isSimple) { RPLTextBox rplElement2 = rplElement as RPLTextBox; RenderingTextRun renderingTextRun = new RenderingTextRun(); renderingTextRun.Initialize(rplElement2, bounds, m_textRuns.Count); renderingTextRun.ProcessRenderingElementContent(rplElement2, context, bounds); m_textRuns.Add(renderingTextRun); return; } RPLParagraph rPLParagraph = rplElement as RPLParagraph; for (RPLTextRun nextTextRun = rPLParagraph.GetNextTextRun(); nextTextRun != null; nextTextRun = rPLParagraph.GetNextTextRun()) { RenderingTextRun renderingTextRun2 = new RenderingTextRun(); renderingTextRun2.Initialize(nextTextRun, bounds, m_textRuns.Count); renderingTextRun2.ProcessRenderingElementContent(nextTextRun, context, bounds); m_textRuns.Add(renderingTextRun2); } }
internal void Initialize(RPLTextBox rplTextBox, RectangleF bounds) { base.Initialize(rplTextBox); m_paragraphNumber = 1; m_isSimple = true; m_position = GdiContext.GetMeasurementRectangle(null, bounds); }
internal override void ProcessRenderingElementContent(RPLElement rplElement, GdiContext context, RectangleF bounds) { RPLTextBox rPLTextBox = rplElement as RPLTextBox; RPLTextBoxPropsDef rPLTextBoxPropsDef = DefinitionProperties as RPLTextBoxPropsDef; RPLTextBoxProps rPLTextBoxProps = InstanceProperties as RPLTextBoxProps; m_textPosition = new RectangleF(base.Position.X, base.Position.Y, base.Position.Width, base.Position.Height); GdiContext.CalculateUsableReportItemRectangle(InstanceProperties, ref m_textPosition); if (TextPosition.Width <= 0f || TextPosition.Height <= 0f) { return; } m_richTextBox = new TextBox(this); if (m_paragraphs == null) { m_paragraphs = new List <RenderingParagraph>(); } if (rPLTextBoxPropsDef.IsSimple) { RenderingParagraph renderingParagraph = new RenderingParagraph(); renderingParagraph.Initialize(rPLTextBox, TextPosition); renderingParagraph.ProcessRenderingElementContent(rPLTextBox, context, TextPosition); m_paragraphs.Add(renderingParagraph); } else { for (RPLParagraph nextParagraph = rPLTextBox.GetNextParagraph(); nextParagraph != null; nextParagraph = rPLTextBox.GetNextParagraph()) { RenderingParagraph renderingParagraph2 = new RenderingParagraph(); renderingParagraph2.Initialize(nextParagraph, TextPosition); renderingParagraph2.ProcessRenderingElementContent(nextParagraph, context, TextPosition); m_paragraphs.Add(renderingParagraph2); } } if (rPLTextBoxProps.IsToggleParent) { GetToggleImage(context.GdiWriter, out Bitmap _); m_textPosition.X += m_toggleRectangleMM.Width + 2.2f; m_textPosition.Width -= m_toggleRectangleMM.Width + 2.2f; Action action = new ToggleAction(InstanceProperties.UniqueName, rPLTextBoxProps.Label, m_toggleRectangleMM, rPLTextBoxProps.ToggleState); RegisterAction(context, action); } if (rPLTextBoxPropsDef.CanSort) { GetSortImage(context.GdiWriter, out Bitmap _, out SortOrder nextOrder); m_textPosition.Width -= m_sortRectangleMM.Width + 2.2f; if (m_sortRectangleMM.Width > 0f) { Action action2 = new SortAction(InstanceProperties.UniqueName, rPLTextBoxProps.Label, m_sortRectangleMM, nextOrder); RegisterAction(context, action2); } } ProcessActions(context, InstanceProperties.UniqueName, ((RPLTextBoxProps)InstanceProperties).ActionInfo, TextPosition); }
protected override void RenderTextBox(RPLTextBox textBox, RPLItemMeasurement measurement, int cellIndex, float left, BorderContext borderContext, bool inTablix, bool hasBorder) { RPLTextBoxPropsDef textBoxPropsDef; bool isSimple; string textBoxValue; bool notCanGrow; bool needsTable; RPLElementStyle style; int oldCellIndex; RPLTextBoxProps textBoxProperties = GetTextBoxProperties(textBox, out textBoxPropsDef, out isSimple, out textBoxValue, inTablix, out notCanGrow, hasBorder, cellIndex, out needsTable, out style, out oldCellIndex); RenderTextBoxProperties(inTablix, cellIndex, needsTable, style); RenderTextBox(textBox, inTablix, cellIndex, needsTable, style, measurement, notCanGrow, textBoxPropsDef, textBoxProperties, isSimple, textBoxValue, borderContext, oldCellIndex); }
private string RenderString(List <ReportItemInfo> list, IExcelGenerator excel) { StringBuilder stringBuilder = new StringBuilder(); HeaderFooterRichTextInfo headerFooterRichTextInfo = null; double num = 0.0; string text = string.Empty; bool flag = false; foreach (ReportItemInfo item in list) { if (stringBuilder.Length > 0 && !stringBuilder[stringBuilder.Length - 1].Equals("\n")) { stringBuilder.Append("\n"); } RPLTextBoxPropsDef rPLTextBoxPropsDef = item.Values.Definition as RPLTextBoxPropsDef; if (rPLTextBoxPropsDef.IsSimple) { if (flag) { headerFooterRichTextInfo.CompleteCurrentFormatting(); } excel.BuildHeaderFooterString(stringBuilder, item.Values, ref text, ref num); flag = false; } else { flag = true; RPLTextBox rPLTextBox = (RPLTextBox)item.RPLSource; if (headerFooterRichTextInfo == null) { headerFooterRichTextInfo = new HeaderFooterRichTextInfo(stringBuilder); } HorizontalAlignment horizontalAlignment = HorizontalAlignment.General; bool renderListPrefixes = true; object obj = rPLTextBox.ElementProps.Style[29]; if (obj != null) { renderListPrefixes = ((RPLFormat.Directions)obj == RPLFormat.Directions.LTR); } LayoutEngine.RenderRichText(null, rPLTextBox, headerFooterRichTextInfo, true, null, renderListPrefixes, ref horizontalAlignment); num = headerFooterRichTextInfo.LastFontSize; text = headerFooterRichTextInfo.LastFontName; headerFooterRichTextInfo.CompleteRun(); } } return(stringBuilder.ToString(0, Math.Min(stringBuilder.Length, 256))); }
internal void RenderStrings(RPLReport report, IExcelGenerator excel, out string left, out string center, out string right) { foreach (ReportItemInfo full in m_fullList) { RPLPageLayout rPLPageLayout = full.RPLSource as RPLPageLayout; if (rPLPageLayout != null) { continue; } RPLTextBox rPLTextBox = full.RPLSource as RPLTextBox; RPLItemProps rPLItemProps; byte elementType; if (rPLTextBox != null) { if (rPLTextBox.StartOffset > 0) { rPLItemProps = m_report.GetItemProps(rPLTextBox.StartOffset, out elementType); } else { rPLItemProps = (RPLItemProps)rPLTextBox.ElementProps; elementType = 7; } } else { rPLItemProps = m_report.GetItemProps(full.RPLSource, out elementType); } if (elementType == 7) { full.Values = (RPLTextBoxProps)rPLItemProps; RPLElementStyle style = rPLItemProps.Style; HorizontalAlignment horizontalAlignment = HorizontalAlignment.Left; object obj = style[25]; if (obj != null) { horizontalAlignment = LayoutConvert.ToHorizontalAlignEnum((RPLFormat.TextAlignments)obj); } int num = 0; int num2 = 0; string text = (string)rPLItemProps.Style[15]; string text2 = (string)rPLItemProps.Style[16]; if (text != null) { num = LayoutConvert.ConvertMMTo20thPoints(LayoutConvert.ToMillimeters(text)); } if (text2 != null) { num2 = LayoutConvert.ConvertMMTo20thPoints(LayoutConvert.ToMillimeters(text2)); } switch (horizontalAlignment) { case HorizontalAlignment.Left: full.AlignmentPoint = full.Left + num; break; case HorizontalAlignment.Right: full.AlignmentPoint = full.Right - num2; break; default: full.AlignmentPoint = full.Left + (full.Right - full.Left + num - num2) / 2; break; } if (full.AlignmentPoint < m_centerWidth) { m_leftList.Add(full); } else if (full.AlignmentPoint < m_rightWidth) { m_centerList.Add(full); } else { m_rightList.Add(full); } } } m_leftList.Sort(ReportItemInfo.CompareTopsThenLefts); m_centerList.Sort(ReportItemInfo.CompareTopsThenLefts); m_rightList.Sort(ReportItemInfo.CompareTopsThenLefts); left = RenderString(m_leftList, excel); center = RenderString(m_centerList, excel); right = RenderString(m_rightList, excel); }
internal HTML5ParagraphStyleWriter(IHtmlReportWriter renderer, RPLTextBox textBox) : base(renderer) { m_textBox = textBox; }
internal override void WriteStyles(StyleWriterMode mode, IRPLStyle style) { RPLParagraph paragraph = m_paragraph; RPLTextBox textBox = m_textBox; RPLTextBoxProps rPLTextBoxProps = textBox.ElementProps as RPLTextBoxProps; if (paragraph != null) { RPLParagraphProps rPLParagraphProps = paragraph.ElementProps as RPLParagraphProps; RPLParagraphPropsDef rPLParagraphPropsDef = rPLParagraphProps.Definition as RPLParagraphPropsDef; RPLReportSize rPLReportSize = null; RPLReportSize leftIndent = null; RPLReportSize rightIndent = null; RPLReportSize spaceBefore = null; RPLReportSize spaceAfter = null; IRPLStyle iRPLStyle = null; switch (mode) { case StyleWriterMode.All: rPLReportSize = rPLParagraphProps.HangingIndent; if (rPLReportSize == null) { rPLReportSize = rPLParagraphPropsDef.HangingIndent; } leftIndent = rPLParagraphProps.LeftIndent; if (leftIndent == null) { leftIndent = rPLParagraphPropsDef.LeftIndent; } rightIndent = rPLParagraphProps.RightIndent; if (rightIndent == null) { rightIndent = rPLParagraphPropsDef.RightIndent; } spaceBefore = rPLParagraphProps.SpaceBefore; if (spaceBefore == null) { spaceBefore = rPLParagraphPropsDef.SpaceBefore; } spaceAfter = rPLParagraphProps.SpaceAfter; if (spaceAfter == null) { spaceAfter = rPLParagraphPropsDef.SpaceAfter; } break; case StyleWriterMode.NonShared: { iRPLStyle = m_textBox.ElementProps.NonSharedStyle; rPLReportSize = rPLParagraphProps.HangingIndent; rightIndent = rPLParagraphProps.RightIndent; leftIndent = rPLParagraphProps.LeftIndent; spaceAfter = rPLParagraphProps.SpaceAfter; spaceBefore = rPLParagraphProps.SpaceBefore; if (m_outputSharedInNonShared) { if (rPLReportSize == null) { rPLReportSize = rPLParagraphPropsDef.HangingIndent; } if (rightIndent == null) { rightIndent = rPLParagraphPropsDef.RightIndent; } if (leftIndent == null) { leftIndent = rPLParagraphPropsDef.LeftIndent; } if (spaceAfter == null) { spaceAfter = rPLParagraphPropsDef.SpaceAfter; } if (spaceBefore == null) { spaceBefore = rPLParagraphPropsDef.SpaceBefore; } break; } bool flag = HTML5Renderer.IsDirectionRTL(m_textBox.ElementProps.Style); if (rPLReportSize == null) { if (flag) { if (rightIndent != null) { rPLReportSize = rPLParagraphPropsDef.HangingIndent; } } else if (leftIndent != null) { rPLReportSize = rPLParagraphPropsDef.HangingIndent; } } else if (flag) { if (rightIndent == null) { rightIndent = rPLParagraphPropsDef.RightIndent; } } else if (leftIndent == null) { leftIndent = rPLParagraphPropsDef.LeftIndent; } break; } case StyleWriterMode.Shared: iRPLStyle = m_textBox.ElementPropsDef.SharedStyle; rPLReportSize = rPLParagraphPropsDef.HangingIndent; leftIndent = rPLParagraphPropsDef.LeftIndent; rightIndent = rPLParagraphPropsDef.RightIndent; spaceBefore = rPLParagraphPropsDef.SpaceBefore; spaceAfter = rPLParagraphPropsDef.SpaceAfter; break; } if (m_currentListLevel > 0 && rPLReportSize != null && rPLReportSize.ToMillimeters() < 0.0) { rPLReportSize = null; } if (m_mode != Mode.ParagraphOnly) { FixIndents(ref leftIndent, ref rightIndent, ref spaceBefore, ref spaceAfter, rPLReportSize); bool flag2 = HTML5Renderer.IsWritingModeVertical(rPLTextBoxProps.Style); if (flag2) { WriteStyle(HTMLElements.m_paddingLeft, leftIndent); } else { WriteStyle(HTMLElements.m_marginLeft, leftIndent); } WriteStyle(HTMLElements.m_marginRight, rightIndent); WriteStyle(HTMLElements.m_marginTop, spaceBefore); if (flag2) { WriteStyle(HTMLElements.m_marginBottom, spaceAfter); } else { WriteStyle(HTMLElements.m_paddingBottom, spaceAfter); } } if (m_mode == Mode.ListOnly) { WriteStyle(HTMLElements.m_fontFamily, "Arial"); WriteStyle(HTMLElements.m_fontSize, "10pt"); } else if (rPLReportSize != null && rPLReportSize.ToMillimeters() < 0.0) { WriteStyle(HTMLElements.m_textIndent, rPLReportSize); } } if (style == null || (m_mode != Mode.All && m_mode != Mode.ParagraphOnly)) { return; } object obj = style[25]; if (obj != null || mode != 0) { RPLFormat.TextAlignments textAlignments = RPLFormat.TextAlignments.General; if (obj != null) { textAlignments = (RPLFormat.TextAlignments)obj; } if (textAlignments == RPLFormat.TextAlignments.General) { bool flag3 = HTML5Renderer.GetTextAlignForType(rPLTextBoxProps); if (HTML5Renderer.IsDirectionRTL(rPLTextBoxProps.Style)) { flag3 = ((!flag3) ? true : false); } WriteStream(HTMLElements.m_textAlign); if (flag3) { WriteStream(HTMLElements.m_rightValue); } else { WriteStream(HTMLElements.m_leftValue); } WriteStream(HTMLElements.m_semiColon); } else { WriteStyle(HTMLElements.m_textAlign, EnumStrings.GetValue(textAlignments), null); } } WriteStyle(HTMLElements.m_lineHeight, style[28]); }
public HTML5ParagraphStyleWriter(IHtmlReportWriter renderer, RPLTextBox textBox) : base(renderer) { this.m_textBox = textBox; }
public override void WriteStyles(StyleWriterMode mode, IRPLStyle style) { RPLParagraph paragraph = this.m_paragraph; RPLTextBox textBox = this.m_textBox; RPLTextBoxProps rPLTextBoxProps = textBox.ElementProps as RPLTextBoxProps; if (paragraph != null) { RPLParagraphProps rPLParagraphProps = paragraph.ElementProps as RPLParagraphProps; RPLParagraphPropsDef rPLParagraphPropsDef = rPLParagraphProps.Definition as RPLParagraphPropsDef; RPLReportSize rPLReportSize = null; RPLReportSize rPLReportSize2 = null; RPLReportSize rPLReportSize3 = null; RPLReportSize rPLReportSize4 = null; RPLReportSize rPLReportSize5 = null; switch (mode) { case StyleWriterMode.All: rPLReportSize = rPLParagraphProps.HangingIndent; if (rPLReportSize == null) { rPLReportSize = rPLParagraphPropsDef.HangingIndent; } rPLReportSize2 = rPLParagraphProps.LeftIndent; if (rPLReportSize2 == null) { rPLReportSize2 = rPLParagraphPropsDef.LeftIndent; } rPLReportSize3 = rPLParagraphProps.RightIndent; if (rPLReportSize3 == null) { rPLReportSize3 = rPLParagraphPropsDef.RightIndent; } rPLReportSize4 = rPLParagraphProps.SpaceBefore; if (rPLReportSize4 == null) { rPLReportSize4 = rPLParagraphPropsDef.SpaceBefore; } rPLReportSize5 = rPLParagraphProps.SpaceAfter; if (rPLReportSize5 == null) { rPLReportSize5 = rPLParagraphPropsDef.SpaceAfter; } break; case StyleWriterMode.NonShared: { RPLStyleProps nonSharedStyle = this.m_textBox.ElementProps.NonSharedStyle; rPLReportSize = rPLParagraphProps.HangingIndent; rPLReportSize3 = rPLParagraphProps.RightIndent; rPLReportSize2 = rPLParagraphProps.LeftIndent; rPLReportSize5 = rPLParagraphProps.SpaceAfter; rPLReportSize4 = rPLParagraphProps.SpaceBefore; if (this.m_outputSharedInNonShared) { if (rPLReportSize == null) { rPLReportSize = rPLParagraphPropsDef.HangingIndent; } if (rPLReportSize3 == null) { rPLReportSize3 = rPLParagraphPropsDef.RightIndent; } if (rPLReportSize2 == null) { rPLReportSize2 = rPLParagraphPropsDef.LeftIndent; } if (rPLReportSize5 == null) { rPLReportSize5 = rPLParagraphPropsDef.SpaceAfter; } if (rPLReportSize4 == null) { rPLReportSize4 = rPLParagraphPropsDef.SpaceBefore; } } else { bool flag = HTML5Renderer.IsDirectionRTL(this.m_textBox.ElementProps.Style); if (rPLReportSize == null) { if (flag) { if (rPLReportSize3 != null) { rPLReportSize = rPLParagraphPropsDef.HangingIndent; } } else if (rPLReportSize2 != null) { rPLReportSize = rPLParagraphPropsDef.HangingIndent; } } else if (flag) { if (rPLReportSize3 == null) { rPLReportSize3 = rPLParagraphPropsDef.RightIndent; } } else if (rPLReportSize2 == null) { rPLReportSize2 = rPLParagraphPropsDef.LeftIndent; } } break; } case StyleWriterMode.Shared: { RPLStyleProps sharedStyle = this.m_textBox.ElementPropsDef.SharedStyle; rPLReportSize = rPLParagraphPropsDef.HangingIndent; rPLReportSize2 = rPLParagraphPropsDef.LeftIndent; rPLReportSize3 = rPLParagraphPropsDef.RightIndent; rPLReportSize4 = rPLParagraphPropsDef.SpaceBefore; rPLReportSize5 = rPLParagraphPropsDef.SpaceAfter; break; } } if (this.m_currentListLevel > 0 && rPLReportSize != null && rPLReportSize.ToMillimeters() < 0.0) { rPLReportSize = null; } if (this.m_mode != Mode.ParagraphOnly) { this.FixIndents(ref rPLReportSize2, ref rPLReportSize3, ref rPLReportSize4, ref rPLReportSize5, rPLReportSize); bool flag2 = HTML5Renderer.IsWritingModeVertical(rPLTextBoxProps.Style); if (flag2) { base.WriteStyle(HTMLElements.m_paddingLeft, rPLReportSize2); } else { base.WriteStyle(HTMLElements.m_marginLeft, rPLReportSize2); } base.WriteStyle(HTMLElements.m_marginRight, rPLReportSize3); base.WriteStyle(HTMLElements.m_marginTop, rPLReportSize4); if (flag2) { base.WriteStyle(HTMLElements.m_marginBottom, rPLReportSize5); } else { base.WriteStyle(HTMLElements.m_paddingBottom, rPLReportSize5); } } if (this.m_mode == Mode.ListOnly) { base.WriteStyle(HTMLElements.m_fontFamily, "Arial"); base.WriteStyle(HTMLElements.m_fontSize, "10pt"); } else if (rPLReportSize != null && rPLReportSize.ToMillimeters() < 0.0) { base.WriteStyle(HTMLElements.m_textIndent, rPLReportSize); } } if (style != null) { if (this.m_mode != Mode.All && this.m_mode != Mode.ParagraphOnly) { return; } object obj = style[25]; if (obj != null || mode != 0) { RPLFormat.TextAlignments textAlignments = RPLFormat.TextAlignments.General; if (obj != null) { textAlignments = (RPLFormat.TextAlignments)obj; } if (textAlignments == RPLFormat.TextAlignments.General) { bool flag3 = HTML5Renderer.GetTextAlignForType(rPLTextBoxProps); if (HTML5Renderer.IsDirectionRTL(rPLTextBoxProps.Style)) { flag3 = ((byte)((!flag3) ? 1 : 0) != 0); } base.WriteStream(HTMLElements.m_textAlign); if (flag3) { base.WriteStream(HTMLElements.m_rightValue); } else { base.WriteStream(HTMLElements.m_leftValue); } base.WriteStream(HTMLElements.m_semiColon); } else { base.WriteStyle(HTMLElements.m_textAlign, EnumStrings.GetValue(textAlignments), null); } } base.WriteStyle(HTMLElements.m_lineHeight, style[28]); } }