File: constants.ts

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (170 lines) | stat: -rw-r--r-- 3,698 bytes parent folder | download | duplicates (5)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// <if expr="enable_pdf_ink2 or enable_ink">
export enum AnnotationMode {
  OFF = 'off',
  DRAW = 'draw',
  // <if expr="enable_pdf_ink2">
  TEXT = 'text',
  // </if>
}
// </if>

// <if expr="enable_pdf_ink2">
// The different types of annotation brushes.
export enum AnnotationBrushType {
  ERASER = 'eraser',
  HIGHLIGHTER = 'highlighter',
  PEN = 'pen',
}

export interface Color {
  r: number;
  g: number;
  b: number;
}

// The brush with parameters. Color and size are optional, since some brushes do
// not need them.
export interface AnnotationBrush {
  type: AnnotationBrushType;
  color?: Color;
  size?: number;
}

export interface TextAnnotation {
  id: number;
  pageNumber: number;
  text: string;
  textAttributes: TextAttributes;
  // Location of the text box relative to the top left corner of the page
  // specified by pageNumber. This rect is in screen coordinates in the UI,
  // and is in page coordinates when this annotation is sent or received in
  // a message to/from the plugin.
  textBoxRect: TextBoxRect;
  // Orientation of the text in the box relative to the PDF page, in number of
  // clockwise rotations from 0 to 3.
  textOrientation: number;
}

export enum TextAlignment {
  LEFT = 'left',
  CENTER = 'center',
  RIGHT = 'right',
}

export enum TextStyle {
  BOLD = 'bold',
  ITALIC = 'italic',
}

export enum TextTypeface {
  SANS_SERIF = 'sans-serif',
  SERIF = 'serif',
  MONOSPACE = 'monospace',
}

export type TextStyles = {
  [key in TextStyle]: boolean
};

export interface TextAttributes {
  typeface: TextTypeface;
  size: number;
  color: Color;
  alignment: TextAlignment;
  styles: TextStyles;
}

export interface TextBoxRect {
  height: number;
  locationX: number;
  locationY: number;
  width: number;
}
// </if>

export interface Attachment {
  name: string;
  size: number;
  readable: boolean;
}

export enum DisplayAnnotationsAction {
  DISPLAY_ANNOTATIONS = 'display-annotations',
  HIDE_ANNOTATIONS = 'hide-annotations',
}

export interface DocumentMetadata {
  author: string;
  canSerializeDocument: boolean;
  creationDate: string;
  creator: string;
  fileSize: string;
  keywords: string;
  linearized: boolean;
  modDate: string;
  pageSize: string;
  producer: string;
  subject: string;
  title: string;
  version: string;
}

/** Enumeration of page fitting types and bounding box fitting types. */
export enum FittingType {
  NONE = 'none',
  FIT_TO_PAGE = 'fit-to-page',
  FIT_TO_WIDTH = 'fit-to-width',
  FIT_TO_HEIGHT = 'fit-to-height',
  FIT_TO_BOUNDING_BOX = 'fit-to-bounding-box',
  FIT_TO_BOUNDING_BOX_WIDTH = 'fit-to-bounding-box-width',
  FIT_TO_BOUNDING_BOX_HEIGHT = 'fit-to-bounding-box-height',
}

/**
 * The different types of form fields that can be focused.
 */
export enum FormFieldFocusType {
  // LINT.IfChange(FocusFieldTypes)
  NONE = 'none',
  NON_TEXT = 'non-text',
  TEXT = 'text',
  // LINT.ThenChange(//pdf/pdf_view_web_plugin.cc:FocusFieldTypes)
}

export interface NamedDestinationMessageData {
  messageId: string;
  pageNumber: number;
  namedDestinationView?: string;
}

/**
 * Enumeration of save message request types. Must match `SaveRequestType` in
 * pdf/pdf_view_web_plugin.h.
 */
export enum SaveRequestType {
  ANNOTATION,
  ORIGINAL,
  EDITED,
  SEARCHIFIED,  // Saves the PDF with extracted text.
}

export interface Point {
  x: number;
  y: number;
}

export interface Rect {
  x: number;
  y: number;
  width: number;
  height: number;
}

export type ExtendedKeyEvent = KeyboardEvent&{
  fromScriptingAPI?: boolean,
  fromPlugin?: boolean,
};