-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomDocumentLayoutVisitor.cs
More file actions
52 lines (44 loc) · 1.79 KB
/
CustomDocumentLayoutVisitor.cs
File metadata and controls
52 lines (44 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.XtraRichEdit.API.Layout;
namespace WindowsFormsApplication1.DocumentLayoutHelper {
public class CustomDocumentLayoutVisitor : DevExpress.XtraRichEdit.API.Layout.LayoutVisitor {
public int ParagraphsCount = 0;
public int TextLinesCount = 0;
public int WordsCount = 0;
public int TablesCount = 0;
public int TextBoxesCount = 0;
public int ImagesCount = 0;
protected override void VisitTable(LayoutTable table) {
TablesCount++;
base.VisitTable(table);
}
protected override void VisitTextBox(LayoutTextBox textBox) {
TextBoxesCount++;
base.VisitTextBox(textBox);
}
protected override void VisitFloatingObjectAnchorBox(FloatingObjectAnchorBox floatingObjectAnchorBox) {
LayoutType objectType = floatingObjectAnchorBox.FloatingObjectBox.Type;
if(objectType == LayoutType.FloatingPicture) ImagesCount++;
base.VisitFloatingObjectAnchorBox(floatingObjectAnchorBox);
}
protected override void VisitInlinePictureBox(InlinePictureBox inlinePictureBox) {
ImagesCount++;
base.VisitInlinePictureBox(inlinePictureBox);
}
protected override void VisitPlainTextBox(PlainTextBox plainTextBox) {
WordsCount++;
base.VisitPlainTextBox(plainTextBox);
}
protected override void VisitParagraphMarkBox(PlainTextBox paragraphMarkBox) {
ParagraphsCount++;
base.VisitParagraphMarkBox(paragraphMarkBox);
}
protected override void VisitRow(LayoutRow row) {
TextLinesCount++;
base.VisitRow(row);
}
}
}