void UpdateParagraphAlignmentState(DocumentSpan documentSpan) { ParagraphSettings paragraphSettings = RichTextEditor.Document.GetCommonParagraphSettings(documentSpan); if (paragraphSettings.ParagraphAlignment.HasValue) { var value = paragraphSettings.ParagraphAlignment.Value; switch (value) { case ParagraphAlignment.Start: { UpdateToggleButtonCheckedState(_alignLeftTool, true); break; } case ParagraphAlignment.Center: { UpdateToggleButtonCheckedState(_alignCenterTool, true); break; } case ParagraphAlignment.End: { UpdateToggleButtonCheckedState(_alignRightTool, true); break; } case ParagraphAlignment.Justify: { UpdateToggleButtonCheckedState(_alignJustifyTool, true); break; } } } }
private void UpdateAlignment(DocumentSpan docSpan) { ParagraphSettings pSettings = RichTextEditor.Document.GetCommonParagraphSettings(docSpan); if (pSettings.ParagraphAlignment.HasValue) { var alignment = pSettings.ParagraphAlignment.Value; switch (alignment) { case ParagraphAlignment.Start: { UpdateToggleButton(_alignLeft, true); break; } case ParagraphAlignment.Center: { UpdateToggleButton(_alignCenter, true); break; } case ParagraphAlignment.End: { UpdateToggleButton(_alignRight, true); break; } case ParagraphAlignment.Justify: { UpdateToggleButton(_alignJustify, true); break; } } } }
/// <summary> /// Updates the state of the paragraph alignment buttons /// </summary> void UpdateParagraphAlignmentState(DocumentSpan documentSpan) { ParagraphSettings paragraphSettings = Target.Document.GetCommonParagraphSettings(documentSpan); if (paragraphSettings.ParagraphAlignment.HasValue) { var value = paragraphSettings.ParagraphAlignment.Value; switch (value) { case ParagraphAlignment.Start: { UpdateToggleButtonCheckedState(_btnAlignLeft, true); break; } case ParagraphAlignment.Center: { UpdateToggleButtonCheckedState(_btnAlignCenter, true); break; } case ParagraphAlignment.End: { UpdateToggleButtonCheckedState(_btnAlignRight, true); break; } } } }
public BoundedTextVObject(string text, RectangleF rectangle, string postScriptFontName = "ArialMT", float fontSize = 10) : base(text, rectangle, postScriptFontName, fontSize) { TextMode = TextMode.Bounded; WrappingRectangles = new List <RotatedRectangleF>(); WrappingMargin = 7; ParagraphSettings = new ParagraphSettings(); VerticalAlignment = TextVerticalAlignment.Top; }
private void ReadInputParagraphSettings(ParagraphSettings paragraphSettings) { if (paragraphSettings != null) { PropertyChanged -= ParagraphSettingsPreviewAdapter_PropertyChanged; previewParagraphSettings = paragraphSettings; // Editor.Document.ApplyParagraphSettings(DocumentSpan.All, previewParagraphSettings, out error); this.Alignment = previewParagraphSettings.ParagraphAlignment; if (previewParagraphSettings.Indentation != null) { if (previewParagraphSettings.Indentation.Start != null) { this.IndentationBeforeText = previewParagraphSettings.Indentation.Start.Value.Extent.Value.Centimeters; } if (previewParagraphSettings.Indentation.End != null) { this.IndentationAfterText = previewParagraphSettings.Indentation.End.Value.Extent.Value.Centimeters; } if (previewParagraphSettings.Indentation.FirstLine.HasValue) { if (previewParagraphSettings.Indentation.FirstLine.Value.IsHanging) { FirstLineType = Infrastructure.FirstLineType.Hanging; } else { FirstLineType = Infrastructure.FirstLineType.FirstLine; } FirstLineIndent = previewParagraphSettings.Indentation.FirstLine.Value.Indentation.Extent.Value.Centimeters; } else { FirstLineType = Infrastructure.FirstLineType.None; } } if (previewParagraphSettings.Spacing != null) { if (previewParagraphSettings.Spacing.BeforeParagraph != null) { this.SpacingBefore = previewParagraphSettings.Spacing.BeforeParagraph.Value.Extent.Value.Points; } if (previewParagraphSettings.Spacing.AfterParagraph != null) { this.SpacingAfter = previewParagraphSettings.Spacing.AfterParagraph.Value.Extent.Value.Points; } if (previewParagraphSettings.Spacing.LineSpacing != null) { var lineSpacingValue = previewParagraphSettings.Spacing.LineSpacing.Value; if (lineSpacingValue.LineFactor.HasValue) { if (lineSpacingValue.LineFactor == 1) { LineSpacingType = Infrastructure.LineSpacingTypes.Single; } else if (lineSpacingValue.LineFactor == 1.5) { LineSpacingType = Infrastructure.LineSpacingTypes.OnePointFiveLines; } else if (lineSpacingValue.LineFactor == 2) { LineSpacingType = Infrastructure.LineSpacingTypes.Double; } else { LineSpacingType = Infrastructure.LineSpacingTypes.Multiple; } LineSpacing = lineSpacingValue.LineFactor.Value; LineSpacingMask = "nn.nn"; } else if (lineSpacingValue.Extent.HasValue) { if (lineSpacingValue.Rule == ExtentRule.AtLeast) { LineSpacingType = Infrastructure.LineSpacingTypes.AtLeast; } else if (lineSpacingValue.Rule == ExtentRule.Exact) { LineSpacingType = Infrastructure.LineSpacingTypes.Exactly; } LineSpacing = (float)lineSpacingValue.Extent.Value.Points; LineSpacingMask = "nn.nn pt"; } } } PropertyChanged += ParagraphSettingsPreviewAdapter_PropertyChanged; } }
private void OnParagraphSettingsUpdatedEvent(ParagraphSettings settings) { string error; this.Selection.Document.ApplyParagraphSettings(this.Selection.DocumentSpan, settings, out error); }
/// <summary> /// Applies the passed paragraph settings to this object. /// </summary> public void ApplyParagraphSettingsFrom(ParagraphSettings settings) { paragSettings = new ParagraphSettings(settings); }
/// <summary> /// Applies the paragraph settings of the passed Text object to this object. /// </summary> public void ApplyParagraphSettingsFrom(Text text) { paragSettings = new ParagraphSettings(text); }
public TextSettings(TextSettings toCopy) { charSettings = new CharacterSettings(toCopy.charSettings); paragSettings = new ParagraphSettings(toCopy.paragSettings); }
public TextSettings() { charSettings = new CharacterSettings(); paragSettings = new ParagraphSettings(); }