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 = default(RPLTextBoxPropsDef); bool isSimple = default(bool); string textBoxValue = default(string); bool notCanGrow = default(bool); bool needsTable = default(bool); RPLElementStyle style = default(RPLElementStyle); int oldCellIndex = default(int); RPLTextBoxProps textBoxProperties = base.GetTextBoxProperties(textBox, out textBoxPropsDef, out isSimple, out textBoxValue, inTablix, out notCanGrow, hasBorder, cellIndex, out needsTable, out style, out oldCellIndex); base.RenderTextBoxProperties(inTablix, cellIndex, needsTable, style); base.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))); }
protected internal override void RenderToggleImage(RPLTextBoxProps textBoxProps) { bool toggleState = textBoxProps.ToggleState; RPLTextBoxPropsDef rPLTextBoxPropsDef = (RPLTextBoxPropsDef)textBoxProps.Definition; if (!textBoxProps.IsToggleParent) { return; } WriteStream(HTMLElements.m_openA); WriteStream(HTMLElements.m_tabIndex); WriteStream(++m_tabIndexNum); WriteStream(HTMLElements.m_quote); if (m_deviceInfo.HasActionScript) { WriteStream(HTMLElements.m_openStyle); WriteStream(HTMLElements.m_cursorHand); WriteStream(HTMLElements.m_semiColon); WriteStream(HTMLElements.m_quote); RenderOnClickActionScript("Toggle", textBoxProps.UniqueName); WriteStream(HTMLElements.m_closeBracket); } else { string reportUrl = m_report.GetReportUrl(addParams: false); CatalogItemUrlBuilder catalogItemUrlBuilder = new CatalogItemUrlBuilder(reportUrl); catalogItemUrlBuilder.AppendRenderingParameters(m_rawDeviceInfo); if (m_allPages) { catalogItemUrlBuilder.AppendRenderingParameter("Section", "0"); } else { catalogItemUrlBuilder.AppendRenderingParameter("Section", m_pageNum.ToString(CultureInfo.InvariantCulture)); } if (m_deviceInfo.HtmlPrefixId != null && m_deviceInfo.HtmlPrefixId.Length > 0) { catalogItemUrlBuilder.AppendRenderingParameter("PrefixId", m_deviceInfo.HtmlPrefixId); } m_serverParams["ShowHideToggle"] = textBoxProps.UniqueName; catalogItemUrlBuilder.AppendCatalogParameters(m_serverParams); WriteStream(HTMLElements.m_hrefString + HttpUtility.HtmlAttributeEncode(ReplaceRoot(new Uri(catalogItemUrlBuilder.ToString()).AbsoluteUri)) + HTMLElements.m_closeQuoteString); } WriteStream(HTMLElements.m_img); if (m_browserIE) { WriteStream(HTMLElements.m_imgOnError); } WriteStream(HTMLElements.m_zeroBorder); WriteStream(HTMLElements.m_src); RenderInternalImageSrc(); if (toggleState) { WriteStream(m_report.GetImageName("ToggleMinus.gif")); } else { WriteStream(m_report.GetImageName("TogglePlus.gif")); } WriteStream(HTMLElements.m_quote); WriteStream(HTMLElements.m_alt); if (toggleState) { WriteStream(RenderRes.ToggleStateCollapse); } else { WriteStream(RenderRes.ToggleStateExpand); } WriteStream(HTMLElements.m_closeTag); WriteStream(HTMLElements.m_closeA); if (!string.IsNullOrEmpty(textBoxProps.Value) || (rPLTextBoxPropsDef != null && !string.IsNullOrEmpty(rPLTextBoxPropsDef.Value))) { WriteStream(HTMLElements.m_nbsp); } }
internal override void DrawContent(GdiContext context) { RPLTextBoxPropsDef rPLTextBoxPropsDef = DefinitionProperties as RPLTextBoxPropsDef; RPLTextBoxProps rPLTextBoxProps = InstanceProperties as RPLTextBoxProps; if (rPLTextBoxProps.IsToggleParent) { GetToggleImage(context.GdiWriter, out Bitmap image); if (m_toggleRectangleMM.Width > 0f) { DrawResourceImage(imageRectanglePX: new RectangleF(0f, 0f, image.Width, image.Height), context: context, image: image, itemRectangleMM: m_toggleRectangleMM); } } if (rPLTextBoxPropsDef.CanSort) { GetSortImage(context.GdiWriter, out Bitmap image2, out SortOrder _); if (m_sortRectangleMM.Width > 0f) { DrawResourceImage(imageRectanglePX: new RectangleF(0f, 0f, image2.Width, image2.Height), context: context, image: image2, itemRectangleMM: m_sortRectangleMM); } } if (TextPosition.Width <= 0f || TextPosition.Height <= 0f) { return; } RPLFormat.WritingModes writingMode = WritingMode; float contentHeight = 0f; float contentHeight2 = 0f; if (writingMode == RPLFormat.WritingModes.Horizontal) { contentHeight = rPLTextBoxProps.ContentHeight; } else { contentHeight2 = rPLTextBoxProps.ContentHeight; } List <Paragraph> list = null; List <RTSelectionHighlight> list2 = null; FlowContext flowContext = new FlowContext(TextPosition.Width, TextPosition.Height); bool flag = !rPLTextBoxPropsDef.CanGrow && !rPLTextBoxPropsDef.CanShrink; if (flag) { m_richTextBox.Paragraphs = new List <Paragraph>(m_paragraphs.Count); for (int i = 0; i < m_paragraphs.Count; i++) { RTSelectionHighlight searchHit = m_paragraphs[i].GetSearchHit(context); if (searchHit != null) { context.TextRunIndexHitStart = searchHit.SelectionStart.TextRunIndex; context.TextRunIndexHitEnd = searchHit.SelectionEnd.TextRunIndex; } m_paragraphs[i].DrawContent(context); m_richTextBox.Paragraphs.Add(m_paragraphs[i].RichParagraph); context.TextRunIndexHitStart = -1; context.TextRunIndexHitEnd = -1; } m_richTextBox.ScriptItemize(); if (writingMode == RPLFormat.WritingModes.Horizontal) { TextBox.MeasureFullHeight(m_richTextBox, context.Graphics, context.FontCache, flowContext, out contentHeight); } else { TextBox.MeasureFullHeight(m_richTextBox, context.Graphics, context.FontCache, flowContext, out contentHeight2); } list = m_richTextBox.Paragraphs; m_richTextBox.Paragraphs = null; } if (writingMode == RPLFormat.WritingModes.Horizontal) { if (contentHeight + 0.001f > TextPosition.Height) { flowContext.LineLimit = false; } } else if (contentHeight2 + 0.001f > TextPosition.Width) { flowContext.LineLimit = false; } m_richTextBox.Paragraphs = new List <Paragraph>(1); bool flag2 = true; float num = 0f; float num2 = 0f; for (int j = 0; j < m_paragraphs.Count; j++) { if (writingMode == RPLFormat.WritingModes.Horizontal) { if (num > 0f) { if (num >= TextPosition.Height) { break; } flowContext.Height = TextPosition.Height - num; } } else if (num2 > 0f) { if (num2 >= TextPosition.Width) { break; } flowContext.Width = TextPosition.Width - num2; } RTSelectionHighlight searchHit2 = m_paragraphs[j].GetSearchHit(context); if (!flag) { if (searchHit2 != null) { context.TextRunIndexHitStart = searchHit2.SelectionStart.TextRunIndex; context.TextRunIndexHitEnd = searchHit2.SelectionEnd.TextRunIndex; } m_paragraphs[j].DrawContent(context); m_richTextBox.Paragraphs.Add(m_paragraphs[j].RichParagraph); context.TextRunIndexHitStart = -1; context.TextRunIndexHitEnd = -1; m_richTextBox.ScriptItemize(); } else { m_richTextBox.Paragraphs.Add(list[0]); } if (searchHit2 != null) { searchHit2.SelectionStart.ParagraphIndex = 0; searchHit2.SelectionEnd.ParagraphIndex = 0; list2 = new List <RTSelectionHighlight>(0); list2.Add(searchHit2); } float height = 0f; List <Paragraph> rTParagraphs = LineBreaker.Flow(m_richTextBox, context.Graphics, context.FontCache, flowContext, keepLines: true, out height); RectangleF layoutParagraph = RectangleF.Empty; PointF offset = PointF.Empty; float delta = 0f; if (writingMode == RPLFormat.WritingModes.Horizontal) { AdjustParagraphLayout(contentHeight, height, num, flag2, writingMode, ref delta, ref layoutParagraph, ref offset); } else { AdjustParagraphLayout(contentHeight2, height, num2, flag2, writingMode, ref delta, ref layoutParagraph, ref offset); } m_context = context; m_paragraphs[j].TextPosition = layoutParagraph; RichTextRenderer richTextRenderer = new RichTextRenderer(); try { richTextRenderer.SetTextbox(m_richTextBox); richTextRenderer.RTParagraphs = rTParagraphs; richTextRenderer.FontCache = context.FontCache; if (writingMode == RPLFormat.WritingModes.Horizontal) { RenderRichText(richTextRenderer, context.Graphics, TextPosition, offset, list2); } else { RenderRichText(richTextRenderer, context.Graphics, layoutParagraph, offset, list2); } richTextRenderer.FontCache = null; } finally { if (richTextRenderer != null) { richTextRenderer.Dispose(); richTextRenderer = null; } } m_context = null; flowContext.Reset(); if (writingMode == RPLFormat.WritingModes.Horizontal) { if (flag2) { num += delta; flag2 = false; } num += height; } else { if (flag2) { num2 += delta; flag2 = false; } num2 += height; } if (searchHit2 != null) { searchHit2.SelectionStart.ParagraphIndex = j; searchHit2.SelectionEnd.ParagraphIndex = j; } m_richTextBox.Paragraphs.RemoveAt(0); if (!flag) { m_paragraphs[j].RichParagraph = null; } else { list.RemoveAt(0); } } if (list != null && list.Count > 0) { list.Clear(); } list = null; }
protected override bool CanSort(RPLTextBoxPropsDef textBoxDef) { return(false); }
protected internal override void RenderToggleImage(RPLTextBoxProps textBoxProps) { RPLTextBoxPropsDef rpltextBoxPropsDef = (RPLTextBoxPropsDef)textBoxProps.Definition; bool isSimple = rpltextBoxPropsDef.IsSimple; bool toggleState = textBoxProps.ToggleState; if (!textBoxProps.IsToggleParent) { return; } this.WriteStream(HTMLElements.m_openA); this.WriteStream(HTMLElements.m_ariaLabeledBy); base.WriteReportItemId(textBoxProps.UniqueName + HTMLElements.m_ariaSuffix); this.WriteStream(HTMLElements.m_quote); this.WriteStream(HTMLElements.m_ariaExpanded); this.WriteStream(toggleState ? "true" : "false"); this.WriteStream(HTMLElements.m_quote); this.WriteStream(HTMLElements.m_id); base.WriteReportItemId(textBoxProps.UniqueName + "_na"); this.WriteStream(HTMLElements.m_quote); this.WriteStream(HTMLElements.m_tabIndex); base.WriteStream(++this.m_tabIndexNum); this.WriteStream(HTMLElements.m_quote); this.WriteStream(HTMLElements.m_openStyle); this.WriteStream(HTMLElements.m_paddingLeft); this.WriteStream("2px;"); this.WriteStream(HTMLElements.m_paddingRight); this.WriteStream("2px;"); this.WriteStream(HTMLElements.m_cursorHand); this.WriteStream(HTMLElements.m_semiColon); this.WriteStream(HTMLElements.m_quote); base.RenderOnClickActionScript("Toggle", textBoxProps.UniqueName, null); this.WriteStream(HTMLElements.m_closeBracket); this.WriteStream(HTMLElements.m_img); if (this.m_browserIE) { this.WriteStream(HTMLElements.m_imgOnError); } this.WriteStream(HTMLElements.m_zeroBorder); this.WriteStream(HTMLElements.m_src); this.WriteToggleImage(toggleState); this.WriteStream(HTMLElements.m_quote); string value = textBoxProps.Value; if (string.IsNullOrEmpty(value)) { value = rpltextBoxPropsDef.Value; } this.WriteStream(HTMLElements.m_alt); if (isSimple) { if (toggleState) { base.WriteStreamEncoded(string.Format("Collapse {0}", value)); } else { base.WriteStreamEncoded(string.Format("Expand {0}", value)); } } else if (toggleState) { base.WriteStreamEncoded(RenderRes.ToggleStateCollapse); } else { base.WriteStreamEncoded(RenderRes.ToggleStateExpand); } this.WriteStream(HTMLElements.m_closeTag); this.WriteStream(HTMLElements.m_closeA); }
private static void ReadTablixCellProperties(RPLTablixCell cell, ALayout layout, int[] rowTops, int[] columnLefts, int generationIndex, bool isRTL, BlockOutlines blockOutlines, Dictionary <string, ToggleParent> toggleParents, bool suppressOutlines, string subreportLanguage) { int num = columnLefts[cell.ColIndex]; int num2 = rowTops[cell.RowIndex]; int num3 = columnLefts[cell.ColIndex + cell.ColSpan] - num; int num4 = rowTops[cell.RowIndex + cell.RowSpan] - num2; bool flag = false; if (num3 == 0 && cell.ColSpan != 0) { return; } if (num4 == 0 && cell.RowSpan != 0) { return; } if (!suppressOutlines && cell is RPLTablixMemberCell && blockOutlines != (BlockOutlines)3) { RPLTablixMemberCell rPLTablixMemberCell = (RPLTablixMemberCell)cell; TogglePosition togglePosition = TogglePosition.None; flag = rPLTablixMemberCell.HasToggle; if (rPLTablixMemberCell.TablixMemberDef.IsColumn) { if ((blockOutlines & BlockOutlines.Columns) != 0) { flag = false; } togglePosition = TogglePosition.Above; } else { if ((blockOutlines & BlockOutlines.Rows) != 0) { flag = false; } togglePosition = (TogglePosition)((!isRTL) ? 1 : 2); } int left = num; if (isRTL && num3 == 0 && cell.ColIndex > 0) { left = columnLefts[cell.ColIndex - 1]; } layout.AddStructuralItem(num2, left, num3, num4, flag, generationIndex, rPLTablixMemberCell, togglePosition); } RPLItem element = cell.Element; if (element != null) { byte b = default(byte); RPLItemProps itemProps = layout.RPLReport.GetItemProps(element.RPLSource, out b); if (b == 7) { RPLTextBoxPropsDef rPLTextBoxPropsDef = (RPLTextBoxPropsDef)itemProps.Definition; if (rPLTextBoxPropsDef.IsSimple) { layout.AddReportItem(element.RPLSource, num2, num, num3, num4, generationIndex, cell.ElementState, subreportLanguage, toggleParents); } else { layout.AddReportItem(element, num2, num, num3, num4, generationIndex, cell.ElementState, subreportLanguage, toggleParents); } if (!suppressOutlines && rPLTextBoxPropsDef.IsToggleParent && !toggleParents.ContainsKey(rPLTextBoxPropsDef.Name)) { toggleParents.Add(rPLTextBoxPropsDef.Name, new ToggleParent(num2, num, num3, num4)); } } else { layout.AddReportItem(element.RPLSource, num2, num, num3, num4, generationIndex, cell.ElementState, subreportLanguage, toggleParents); } if (!suppressOutlines) { if (rowTops.Length > 2) { blockOutlines |= BlockOutlines.Columns; } if (columnLefts.Length > 2) { blockOutlines |= BlockOutlines.Rows; } } Reader.ReadMeasurement(element, layout, num2, num, generationIndex + 1, blockOutlines, toggleParents, suppressOutlines, num3, subreportLanguage); } }
private static void ReadMeasurement(RPLElement element, ALayout layout, int top, int left, int generationIndex, BlockOutlines blockOutlines, Dictionary <string, ToggleParent> toggleParents, bool suppressOutlines, int elementWidth, string subreportLanguage) { RPLContainer rPLContainer = element as RPLContainer; if (rPLContainer != null) { if (rPLContainer.Children != null) { bool flag = false; int num = 0; RPLSubReport rPLSubReport = element as RPLSubReport; if (rPLSubReport != null) { flag = true; if (!suppressOutlines) { toggleParents = new Dictionary <string, ToggleParent>(); } string language = ((RPLSubReportProps)rPLSubReport.ElementProps).Language; if (!string.IsNullOrEmpty(language)) { subreportLanguage = language; } } int[] array = new int[rPLContainer.Children.Length]; int[] array2 = new int[rPLContainer.Children.Length]; int[] array3 = new int[rPLContainer.Children.Length]; RPLItem[] array4 = new RPLItem[rPLContainer.Children.Length]; for (int i = 0; i < rPLContainer.Children.Length; i++) { RPLItemMeasurement rPLItemMeasurement = rPLContainer.Children[i]; if (0.0 == rPLItemMeasurement.Width && 0.0 == rPLItemMeasurement.Height) { rPLContainer.Children[i] = null; } else { if ((0.0 == rPLItemMeasurement.Width || 0.0 == rPLItemMeasurement.Height) && !(rPLItemMeasurement.Element is RPLLine)) { rPLContainer.Children[i] = null; continue; } int num2 = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Height); int num3 = 0; if (flag) { num3 = elementWidth; array2[i] = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Top) + top + num; num += num2; } else { num3 = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Width); array2[i] = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Top) + top; } array[i] = num3; array3[i] = LayoutConvert.ConvertMMTo20thPoints((double)rPLItemMeasurement.Left) + left; RPLItem rPLItem = array4[i] = rPLItemMeasurement.Element; byte b = default(byte); RPLItemProps itemProps = layout.RPLReport.GetItemProps(rPLItem.RPLSource, out b); if (b == 7) { RPLTextBoxPropsDef rPLTextBoxPropsDef = (RPLTextBoxPropsDef)itemProps.Definition; if (rPLTextBoxPropsDef.IsSimple) { layout.AddReportItem(rPLItem.RPLSource, array2[i], array3[i], num3, num2, generationIndex, rPLItemMeasurement.State, subreportLanguage, toggleParents); } else { layout.AddReportItem(rPLItem, array2[i], array3[i], num3, num2, generationIndex, rPLItemMeasurement.State, subreportLanguage, toggleParents); } if (!suppressOutlines && rPLTextBoxPropsDef.IsToggleParent && !toggleParents.ContainsKey(rPLTextBoxPropsDef.Name)) { toggleParents.Add(rPLTextBoxPropsDef.Name, new ToggleParent(array2[i], array3[i], num3, num2)); } } else { layout.AddReportItem(rPLItem.RPLSource, array2[i], array3[i], num3, num2, generationIndex, rPLItemMeasurement.State, subreportLanguage, toggleParents); } } } for (int j = 0; j < rPLContainer.Children.Length; j++) { if (rPLContainer.Children[j] != null) { Reader.ReadMeasurement(array4[j], layout, array2[j], array3[j], generationIndex + 1, blockOutlines, toggleParents, suppressOutlines, array[j], subreportLanguage); rPLContainer.Children[j] = null; array4[j] = null; } } rPLContainer.Children = null; } } else { Reader.ReadTablixStructure(element as RPLTablix, layout, top, left, generationIndex, blockOutlines, toggleParents, suppressOutlines, subreportLanguage); } }