public Printing(PlainTextBox activeTextBox) { this.activeTextBox = activeTextBox; dlgPrint.Document = printDocument; dlgPrint.AllowSelection = !string.IsNullOrEmpty(this.activeTextBox.SelectedText); printDocument.PrintPage += printDoc_PrintPage; printDocument.BeginPrint += _printDoc_BeginPrint; printDocument.EndPrint += delegate { lines = null; }; }
public override void DrawPlainTextBox(PlainTextBox plainTextBox) { if (Form1.customDrawText == true) { Canvas.DrawRectangle(new RichEditPen(Color.FromArgb(141, 179, 226)), plainTextBox.Bounds); } else { base.DrawPlainTextBox(plainTextBox); } }
public override void DrawPlainTextBox(PlainTextBox plainTextBox) { if (MainWindow.customDrawText == true) { Canvas.DrawRectangle(new RichEditPen(System.Windows.Media.Color.FromRgb(141, 179, 226)), plainTextBox.Bounds); } else { base.DrawPlainTextBox(plainTextBox); } }
// get information about a current text box layout public static string GetInformationAboutCurrentTextBox(SubDocument subDocument, DocumentLayout currentLayout, DocumentPosition docPosition) { string returnedInformation = "!A TEXTBOX CONTENT IS SELECTED!\r\n"; LayoutIterator layoutIterator = new LayoutIterator(currentLayout, subDocument.Range); LayoutPage currentTextBoxPage = null; LayoutTextBox currentTextBox = null; while (layoutIterator.MoveNext()) { LayoutElement element = layoutIterator.Current; if (element is LayoutTextBox) { currentTextBox = (element as LayoutTextBox); if (currentTextBox.Parent is LayoutPage) { currentTextBoxPage = currentTextBox.Parent as LayoutPage; } } if (element is PlainTextBox) { PlainTextBox currentPlaintTextBox = element as PlainTextBox; if (currentPlaintTextBox.Range.Contains(docPosition.ToInt())) { returnedInformation += String.Format("Selected content: {0}\r\n", currentPlaintTextBox.Text); LayoutRow currentRow = currentPlaintTextBox.Parent as LayoutRow; int currentLineIndex = currentTextBox.Rows.ToList().IndexOf(currentRow); returnedInformation += String.Format("Line index: {0}\r\n", currentLineIndex + 1); returnedInformation += String.Format("Selected block bounds: {0}\r\n", currentPlaintTextBox.Bounds); break; } } } returnedInformation += String.Format("TEXTBOX bounds: {0}\r\n", currentTextBox.Bounds); returnedInformation += String.Format("\r\n!!Content information:\r\n"); returnedInformation += GetInformationAboutCurrentTextBoxContent(currentTextBox, currentLayout); if (currentTextBoxPage != null) { returnedInformation += PageLayoutHelper.GetInformationAboutCurrentPage(currentLayout, currentTextBoxPage, docPosition); } return(returnedInformation); }
// get information about a current regular text block public static string GetInformationAboutRegularTextBlock(PlainTextBox currentTextBlock, Document currentDocument) { string returnedInformation = "!A REGULAR TEXT BLOCK IS SELECTED!\r\n"; returnedInformation += String.Format("Content: {0}\r\n", currentTextBlock.Text); LayoutRow currentRow = currentTextBlock.Parent as LayoutRow; LayoutColumn currentColumn = currentRow.Parent as LayoutColumn; int currentLineIndex = currentColumn.Rows.ToList().IndexOf(currentRow); returnedInformation += String.Format("Line index: {0}\r\n", currentLineIndex + 1); returnedInformation += String.Format("Start position: {0}\r\n", currentTextBlock.Range.Start); returnedInformation += String.Format("End position: {0}\r\n", currentTextBlock.Range.Start + currentTextBlock.Range.Length); int currentParagraphIndex = currentDocument.Paragraphs.ToList().IndexOf(currentDocument.Paragraphs.Get(currentDocument.CreatePosition(currentTextBlock.Range.Start))); returnedInformation += String.Format("Paragrpah index: {0}\r\n", currentParagraphIndex + 1); returnedInformation += String.Format("Text block bounds: {0}\r\n", currentTextBlock.Bounds); return(returnedInformation); }
public void ShowClipboardContent(ConceptUsecase useCase) { var vindow = new Vindow { Size = new Size(800, 600) }; var textbox = new PlainTextBox(); vindow.Content = textbox; var cbcontent = new StringBuilder(); var data = Clipboard.GetTransferData(Clipboard.GetTypesAvailable()); foreach (var f in data.DataTypes) { cbcontent.AppendLine(); cbcontent.AppendLine(f.Id); var ct = data.GetValue(f); var text = ct as string; if (text != null) { cbcontent.AppendLine(text); continue; } var bytes = ct as byte []; if (bytes != null) { for (var i = 0; i < bytes.Length; i++) { if (i % (4 * 8) == 0) { cbcontent.AppendLine(); } cbcontent.Append($"{bytes[i]:N0} "); } continue; } cbcontent.AppendLine($"{(ct!=null?ct.GetType():null)}"); } textbox.Text = cbcontent.ToString(); vindow.Show(); }
protected override void VisitSpecialTextBox(PlainTextBox specialTextBox) { TryAddElementToCollection(specialTextBox, ContentDisplayAction.Select, false); base.VisitSpecialTextBox(specialTextBox); }
protected override void VisitLineBreakBox(PlainTextBox lineBreakBox) { TryAddElementToCollection(lineBreakBox, ContentDisplayAction.Select, false); base.VisitLineBreakBox(lineBreakBox); }
public override void DrawTabSpaceBox(PlainTextBox tabSpaceBox) { base.DrawTabSpaceBox(tabSpaceBox); HighlightElement(tabSpaceBox); }
public override void DrawSectionBreakBox(PlainTextBox sectionBreakBox) { base.DrawSectionBreakBox(sectionBreakBox); HighlightElement(sectionBreakBox); }
public override void DrawPageNumberBox(PlainTextBox pageNumberBox) { base.DrawPageNumberBox(pageNumberBox); HighlightElement(pageNumberBox); }
public override void DrawHyphenBox(PlainTextBox hyphen) { base.DrawHyphenBox(hyphen); HighlightElement(hyphen); }
public override void InitializeBackend(IVidget frontend, VidgetApplicationContext context) { base.InitializeBackend(frontend, context); Frontend = (Vidgets.PlainTextBox)frontend; }
public override void DrawSpaceBox(PlainTextBox spaceBox) { HighlightProtectedRange(spaceBox.Range, spaceBox.Bounds); base.DrawSpaceBox(spaceBox); }
public override void DrawPlainTextBox(PlainTextBox plainTextBox) { HighlightProtectedRange(plainTextBox.Range, plainTextBox.Bounds); base.DrawPlainTextBox(plainTextBox); }
public override void DrawPlainTextBox(PlainTextBox plainTextBox) { base.DrawPlainTextBox(plainTextBox); HighlightElement(plainTextBox); }
public override void DrawColumnBreakBox(PlainTextBox columnBreakBox) { base.DrawColumnBreakBox(columnBreakBox); HighlightElement(columnBreakBox); }
protected override void VisitColumnBreakBox(PlainTextBox columnBreakBox) { AddTreeNode(columnBreakBox, ContentDisplayAction.Select); base.VisitColumnBreakBox(columnBreakBox); }
public override void DrawLineBreakBox(PlainTextBox lineBreakBox) { base.DrawLineBreakBox(lineBreakBox); HighlightElement(lineBreakBox); }
protected override void VisitHyphenBox(PlainTextBox hyphen) { AddTreeNode(hyphen, ContentDisplayAction.Select); base.VisitHyphenBox(hyphen); }
public override void DrawParagraphMarkBox(PlainTextBox paragraphMarkBox) { base.DrawParagraphMarkBox(paragraphMarkBox); HighlightElement(paragraphMarkBox); }
protected override void VisitLineBreakBox(PlainTextBox lineBreakBox) { AddTreeNode(lineBreakBox, ContentDisplayAction.Select); base.VisitLineBreakBox(lineBreakBox); }
public override void DrawSpecialTextBox(PlainTextBox specialTextBox) { base.DrawSpecialTextBox(specialTextBox); HighlightElement(specialTextBox); }
protected override void VisitPageNumberBox(PlainTextBox pageNumberBox) { AddTreeNode(pageNumberBox, ContentDisplayAction.Select); base.VisitPageNumberBox(pageNumberBox); }
protected override void VisitHyphenBox(PlainTextBox hyphen) { TryAddElementToCollection(hyphen, ContentDisplayAction.Select, false); base.VisitHyphenBox(hyphen); }
protected override void VisitParagraphMarkBox(PlainTextBox paragraphMarkBox) { AddTreeNode(paragraphMarkBox, ContentDisplayAction.Select); base.VisitParagraphMarkBox(paragraphMarkBox); }
protected override void VisitParagraphMarkBox(PlainTextBox paragraphMarkBox) { TryAddElementToCollection(paragraphMarkBox, ContentDisplayAction.Select, false); base.VisitParagraphMarkBox(paragraphMarkBox); }
protected override void VisitSpecialTextBox(PlainTextBox specialTextBox) { AddTreeNode(specialTextBox, ContentDisplayAction.Select); base.VisitSpecialTextBox(specialTextBox); }
protected override void VisitTabSpaceBox(PlainTextBox tabSpaceBox) { TryAddElementToCollection(tabSpaceBox, ContentDisplayAction.Select, false); base.VisitTabSpaceBox(tabSpaceBox); }
protected override void VisitTabSpaceBox(PlainTextBox tabSpaceBox) { AddTreeNode(tabSpaceBox, ContentDisplayAction.Select); base.VisitTabSpaceBox(tabSpaceBox); }