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(RPLParagraph rplParagraph, RectangleF bounds) { base.Initialize(rplParagraph); m_paragraphNumber = (InstanceProperties as RPLParagraphProps).ParagraphNumber; m_isSimple = false; 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); }
public void WriteItemToStream(RPLWriter rplWriter, PageContext pageContext) { List <long> list = null; BinaryWriter binaryWriter = rplWriter.BinaryWriter; if (binaryWriter != null) { if (this.m_textRuns != null) { list = new List <long>(); foreach (TextRun textRun in this.m_textRuns) { textRun.WriteItemToStream(rplWriter, pageContext); list.Add(textRun.Offset); } } Stream baseStream = binaryWriter.BaseStream; this.m_offset = baseStream.Position; binaryWriter.Write((byte)19); this.WriteElementProps(binaryWriter, rplWriter, pageContext, this.m_offset + 1); if (list != null) { binaryWriter.Write(list.Count); for (int i = 0; i < list.Count; i++) { binaryWriter.Write(list[i]); } } else { binaryWriter.Write(0); } binaryWriter.Write((byte)255); } else { this.m_rplElement = new RPLParagraph(); if (this.m_textRuns != null) { foreach (TextRun textRun2 in this.m_textRuns) { textRun2.WriteItemToStream(rplWriter, pageContext); this.m_rplElement.AddTextRun(textRun2.RPLElement); } } this.WriteElementProps(this.m_rplElement.ElementProps, rplWriter, pageContext); } }
public override bool NeedsToWriteNullStyle(StyleWriterMode mode) { RPLParagraph paragraph = this.m_paragraph; switch (mode) { case StyleWriterMode.NonShared: { RPLParagraphProps rPLParagraphProps = paragraph.ElementProps as RPLParagraphProps; if (rPLParagraphProps.LeftIndent == null && rPLParagraphProps.RightIndent == null && rPLParagraphProps.SpaceBefore == null && rPLParagraphProps.SpaceAfter == null && rPLParagraphProps.HangingIndent == null) { RPLStyleProps nonSharedStyle = this.m_textBox.ElementProps.NonSharedStyle; if (!this.m_outputSharedInNonShared) { break; } return(true); } return(true); } case StyleWriterMode.Shared: { if (this.m_outputSharedInNonShared) { return(false); } RPLParagraphPropsDef rPLParagraphPropsDef = paragraph.ElementProps.Definition as RPLParagraphPropsDef; if (rPLParagraphPropsDef.LeftIndent == null && rPLParagraphPropsDef.RightIndent == null && rPLParagraphPropsDef.SpaceBefore == null && rPLParagraphPropsDef.SpaceAfter == null && rPLParagraphPropsDef.HangingIndent == null) { IRPLStyle sharedStyle = this.m_textBox.ElementPropsDef.SharedStyle; if (sharedStyle == null) { break; } if (!HTML5Renderer.IsDirectionRTL(sharedStyle)) { break; } return(true); } return(true); } } return(false); }
internal override bool NeedsToWriteNullStyle(StyleWriterMode mode) { RPLParagraph paragraph = m_paragraph; switch (mode) { case StyleWriterMode.NonShared: { RPLParagraphProps rPLParagraphProps = paragraph.ElementProps as RPLParagraphProps; if (rPLParagraphProps.LeftIndent != null || rPLParagraphProps.RightIndent != null || rPLParagraphProps.SpaceBefore != null || rPLParagraphProps.SpaceAfter != null || rPLParagraphProps.HangingIndent != null) { return(true); } IRPLStyle nonSharedStyle = m_textBox.ElementProps.NonSharedStyle; if (m_outputSharedInNonShared) { return(true); } break; } case StyleWriterMode.Shared: { if (m_outputSharedInNonShared) { return(false); } RPLParagraphPropsDef rPLParagraphPropsDef = paragraph.ElementProps.Definition as RPLParagraphPropsDef; if (rPLParagraphPropsDef.LeftIndent != null || rPLParagraphPropsDef.RightIndent != null || rPLParagraphPropsDef.SpaceBefore != null || rPLParagraphPropsDef.SpaceAfter != null || rPLParagraphPropsDef.HangingIndent != null) { return(true); } IRPLStyle sharedStyle = m_textBox.ElementPropsDef.SharedStyle; if (sharedStyle != null && HTML4Renderer.IsDirectionRTL(sharedStyle)) { return(true); } break; } } return(false); }
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 RPLParagraph GetRPLParagraph(PageContext pageContext, bool hideDuplicates, TextBox.TextBoxOffset startPosition, TextBox.TextBoxOffset endPosition, List <AspNetCore.ReportingServices.Rendering.RichText.TextRun> richTextParaRuns) { RPLParagraph rPLParagraph = new RPLParagraph(); this.WriteElementProps(rPLParagraph.ElementProps as RPLParagraphProps, pageContext); int num = 0; int num2 = 0; if (endPosition == null && startPosition == null) { { foreach (TextRun textRun2 in this.m_textRuns) { num = num2; num2 += textRun2.SplitIndices.Count + 1; RPLTextRun rPLTextRun = textRun2.GetRPLTextRun(pageContext, hideDuplicates, null, null, num, richTextParaRuns); rPLParagraph.AddTextRun(rPLTextRun); } return(rPLParagraph); } } int count = this.m_textRuns.Count; int num3 = -1; if (startPosition != null) { num3 = startPosition.TextRunIndex; } int num4 = -1; if (endPosition != null) { num4 = endPosition.TextRunIndex; } for (int i = 0; i < count; i++) { TextRun textRun = this.m_textRuns[i]; num = num2; num2 += textRun.SplitIndices.Count + 1; if (num3 < num2) { if (endPosition != null) { if (num2 < num4) { rPLParagraph.AddTextRun(textRun.GetRPLTextRun(pageContext, hideDuplicates, startPosition, null, num, richTextParaRuns)); continue; } if (num2 == num4) { rPLParagraph.AddTextRun(textRun.GetRPLTextRun(pageContext, hideDuplicates, startPosition, null, num, richTextParaRuns)); if (endPosition.CharacterIndex <= 0) { break; } continue; } rPLParagraph.AddTextRun(textRun.GetRPLTextRun(pageContext, hideDuplicates, startPosition, endPosition, num, richTextParaRuns)); break; } rPLParagraph.AddTextRun(textRun.GetRPLTextRun(pageContext, hideDuplicates, startPosition, null, num, richTextParaRuns)); } } return(rPLParagraph); }
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]); } }