origami-docspring 2.2.0 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/examples/attachments/attachment.rb +7 -8
- data/examples/attachments/nested_document.rb +6 -5
- data/examples/encryption/encryption.rb +5 -4
- data/examples/events/events.rb +7 -6
- data/examples/flash/flash.rb +10 -9
- data/examples/forms/javascript.rb +14 -13
- data/examples/forms/xfa.rb +67 -66
- data/examples/javascript/hello_world.rb +6 -5
- data/examples/javascript/js_emulation.rb +26 -26
- data/examples/loop/goto.rb +12 -11
- data/examples/loop/named.rb +17 -16
- data/examples/signature/signature.rb +11 -11
- data/examples/uri/javascript.rb +25 -24
- data/examples/uri/open-uri.rb +5 -4
- data/examples/uri/submitform.rb +11 -10
- data/lib/origami/3d.rb +330 -334
- data/lib/origami/acroform.rb +267 -268
- data/lib/origami/actions.rb +266 -278
- data/lib/origami/annotations.rb +659 -670
- data/lib/origami/array.rb +192 -196
- data/lib/origami/boolean.rb +66 -70
- data/lib/origami/catalog.rb +360 -363
- data/lib/origami/collections.rb +132 -133
- data/lib/origami/compound.rb +125 -129
- data/lib/origami/destinations.rb +226 -237
- data/lib/origami/dictionary.rb +155 -154
- data/lib/origami/encryption.rb +967 -923
- data/lib/origami/extensions/fdf.rb +270 -275
- data/lib/origami/extensions/ppklite.rb +323 -328
- data/lib/origami/filespec.rb +170 -173
- data/lib/origami/filters/ascii.rb +162 -167
- data/lib/origami/filters/ccitt/tables.rb +248 -252
- data/lib/origami/filters/ccitt.rb +309 -312
- data/lib/origami/filters/crypt.rb +31 -34
- data/lib/origami/filters/dct.rb +47 -50
- data/lib/origami/filters/flate.rb +57 -60
- data/lib/origami/filters/jbig2.rb +50 -53
- data/lib/origami/filters/jpx.rb +40 -43
- data/lib/origami/filters/lzw.rb +151 -155
- data/lib/origami/filters/predictors.rb +250 -255
- data/lib/origami/filters/runlength.rb +111 -115
- data/lib/origami/filters.rb +319 -325
- data/lib/origami/font.rb +173 -177
- data/lib/origami/functions.rb +62 -66
- data/lib/origami/graphics/colors.rb +203 -208
- data/lib/origami/graphics/instruction.rb +79 -81
- data/lib/origami/graphics/path.rb +141 -144
- data/lib/origami/graphics/patterns.rb +156 -160
- data/lib/origami/graphics/render.rb +51 -47
- data/lib/origami/graphics/state.rb +144 -142
- data/lib/origami/graphics/text.rb +185 -188
- data/lib/origami/graphics/xobject.rb +818 -804
- data/lib/origami/graphics.rb +25 -26
- data/lib/origami/header.rb +63 -65
- data/lib/origami/javascript.rb +718 -651
- data/lib/origami/linearization.rb +284 -285
- data/lib/origami/metadata.rb +156 -135
- data/lib/origami/name.rb +98 -100
- data/lib/origami/null.rb +49 -51
- data/lib/origami/numeric.rb +133 -135
- data/lib/origami/obfuscation.rb +180 -182
- data/lib/origami/object.rb +634 -631
- data/lib/origami/optionalcontent.rb +147 -149
- data/lib/origami/outline.rb +46 -48
- data/lib/origami/outputintents.rb +76 -77
- data/lib/origami/page.rb +637 -596
- data/lib/origami/parser.rb +214 -221
- data/lib/origami/parsers/fdf.rb +44 -45
- data/lib/origami/parsers/pdf/lazy.rb +147 -154
- data/lib/origami/parsers/pdf/linear.rb +104 -109
- data/lib/origami/parsers/pdf.rb +109 -107
- data/lib/origami/parsers/ppklite.rb +44 -46
- data/lib/origami/pdf.rb +886 -896
- data/lib/origami/reference.rb +116 -120
- data/lib/origami/signature.rb +617 -625
- data/lib/origami/stream.rb +560 -558
- data/lib/origami/string.rb +366 -368
- data/lib/origami/template/patterns.rb +50 -52
- data/lib/origami/template/widgets.rb +111 -114
- data/lib/origami/trailer.rb +153 -157
- data/lib/origami/tree.rb +55 -57
- data/lib/origami/version.rb +19 -19
- data/lib/origami/webcapture.rb +87 -90
- data/lib/origami/xfa/config.rb +409 -414
- data/lib/origami/xfa/connectionset.rb +113 -117
- data/lib/origami/xfa/datasets.rb +38 -42
- data/lib/origami/xfa/localeset.rb +33 -37
- data/lib/origami/xfa/package.rb +49 -52
- data/lib/origami/xfa/pdf.rb +54 -59
- data/lib/origami/xfa/signature.rb +33 -37
- data/lib/origami/xfa/sourceset.rb +34 -38
- data/lib/origami/xfa/stylesheet.rb +35 -39
- data/lib/origami/xfa/template.rb +1630 -1634
- data/lib/origami/xfa/xdc.rb +33 -37
- data/lib/origami/xfa/xfa.rb +132 -123
- data/lib/origami/xfa/xfdf.rb +34 -38
- data/lib/origami/xfa/xmpmeta.rb +34 -38
- data/lib/origami/xfa.rb +50 -53
- data/lib/origami/xreftable.rb +462 -462
- data/lib/origami.rb +37 -38
- data/test/test_actions.rb +22 -20
- data/test/test_annotations.rb +54 -52
- data/test/test_forms.rb +23 -21
- data/test/test_native_types.rb +82 -78
- data/test/test_object_tree.rb +25 -24
- data/test/test_pages.rb +43 -41
- data/test/test_pdf.rb +2 -0
- data/test/test_pdf_attachment.rb +23 -21
- data/test/test_pdf_create.rb +16 -15
- data/test/test_pdf_encrypt.rb +69 -66
- data/test/test_pdf_parse.rb +131 -129
- data/test/test_pdf_parse_lazy.rb +53 -53
- data/test/test_pdf_sign.rb +67 -67
- data/test/test_streams.rb +145 -143
- data/test/test_xrefs.rb +46 -45
- metadata +64 -8
data/lib/origami/annotations.rb
CHANGED
@@ -1,711 +1,700 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
#
|
4
|
+
# This file is part of Origami, PDF manipulation framework for Ruby
|
5
|
+
# Copyright (C) 2016 Guillaume Delugré.
|
6
|
+
#
|
7
|
+
# Origami is free software: you can redistribute it and/or modify
|
8
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
9
|
+
# the Free Software Foundation, either version 3 of the License, or
|
10
|
+
# (at your option) any later version.
|
11
|
+
#
|
12
|
+
# Origami is distributed in the hope that it will be useful,
|
13
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
15
|
+
# GNU Lesser General Public License for more details.
|
16
|
+
#
|
17
|
+
# You should have received a copy of the GNU Lesser General Public License
|
18
|
+
# along with Origami. If not, see <http://www.gnu.org/licenses/>.
|
19
|
+
#
|
2
20
|
|
3
|
-
|
4
|
-
|
21
|
+
module Origami
|
22
|
+
# Forward declaration.
|
23
|
+
class Action < Dictionary; end
|
5
24
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
25
|
+
#
|
26
|
+
# Class representing an annotation.
|
27
|
+
# Annotations are objects which user can interact with.
|
28
|
+
#
|
29
|
+
class Annotation < Dictionary
|
30
|
+
include StandardObject
|
10
31
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
32
|
+
#
|
33
|
+
# An AppearanceStream is a FormXObject.
|
34
|
+
#
|
35
|
+
class AppearanceStream < Graphics::FormXObject; end
|
15
36
|
|
16
|
-
|
17
|
-
|
37
|
+
#
|
38
|
+
# Appearance Dictionary of an Annotation.
|
39
|
+
#
|
40
|
+
class AppearanceDictionary < Dictionary
|
41
|
+
include StandardObject
|
18
42
|
|
19
|
-
|
43
|
+
field :N, Type: [AppearanceStream, Dictionary], Required: true
|
44
|
+
field :R, Type: [AppearanceStream, Dictionary]
|
45
|
+
field :D, Type: [AppearanceStream, Dictionary]
|
46
|
+
end
|
20
47
|
|
21
|
-
|
48
|
+
#
|
49
|
+
# Class representing additional actions which can be associated with an annotation having an AA field.
|
50
|
+
#
|
51
|
+
class AdditionalActions < Dictionary
|
52
|
+
include StandardObject
|
53
|
+
|
54
|
+
field :E, Type: Action, Version: "1.2" # Mouse Enter
|
55
|
+
field :X, Type: Action, Version: "1.2" # Mouse Exit
|
56
|
+
field :D, Type: Action, Version: "1.2" # Mouse Down
|
57
|
+
field :U, Type: Action, Version: "1.2" # Mouse Up
|
58
|
+
field :Fo, Type: Action, Version: "1.2" # Focus
|
59
|
+
field :Bl, Type: Action, Version: "1.2" # Blur
|
60
|
+
field :PO, Type: Action, Version: "1.2" # Page Open
|
61
|
+
field :PC, Type: Action, Version: "1.2" # Page Close
|
62
|
+
field :PV, Type: Action, Version: "1.2" # Page Visible
|
63
|
+
field :PI, Type: Action, Version: "1.2" # Page Invisible
|
64
|
+
end
|
65
|
+
|
66
|
+
#
|
67
|
+
# Annotation fields.
|
68
|
+
#
|
69
|
+
field :Type, Type: Name, Default: :Annot
|
70
|
+
field :Subtype, Type: Name, Required: true
|
71
|
+
field :Rect, Type: Rectangle, Default: [0, 0, 0, 0], Required: true
|
72
|
+
field :Contents, Type: String
|
73
|
+
field :P, Type: Page, Version: "1.3"
|
74
|
+
field :NM, Type: String, Version: "1.4"
|
75
|
+
field :M, Type: String, Version: "1.1"
|
76
|
+
field :F, Type: Integer, Default: 0, Version: "1.1"
|
77
|
+
field :AP, Type: AppearanceDictionary, Version: "1.2"
|
78
|
+
field :AS, Type: Name, Version: "1.2"
|
79
|
+
field :Border, Type: Array, Default: [0, 0, 1]
|
80
|
+
field :C, Type: Array.of(Number), Version: "1.1"
|
81
|
+
field :StructParent, Type: Integer, Version: "1.3"
|
82
|
+
field :OC, Type: Dictionary, Version: "1.5"
|
83
|
+
|
84
|
+
def set_normal_appearance(apstm)
|
85
|
+
self.AP ||= AppearanceDictionary.new
|
86
|
+
self.AP[:N] = apstm
|
87
|
+
|
88
|
+
self
|
89
|
+
end
|
90
|
+
|
91
|
+
def set_rollover_appearance(apstm)
|
92
|
+
self.AP ||= AppearanceDictionary.new
|
93
|
+
self.AP[:R] = apstm
|
94
|
+
|
95
|
+
self
|
96
|
+
end
|
97
|
+
|
98
|
+
def set_down_appearance(apstm)
|
99
|
+
self.AP ||= AppearanceStream.new
|
100
|
+
self.AP[:D] = apstm
|
22
101
|
|
23
|
-
|
24
|
-
|
102
|
+
self
|
103
|
+
end
|
104
|
+
|
105
|
+
module Triggerable
|
106
|
+
def onMouseOver(action)
|
107
|
+
self.AA ||= AdditionalActions.new
|
108
|
+
self.AA.E = action
|
109
|
+
end
|
110
|
+
|
111
|
+
def onMouseOut(action)
|
112
|
+
self.AA ||= AdditionalActions.new
|
113
|
+
self.AA.X = action
|
114
|
+
end
|
115
|
+
|
116
|
+
def onMouseDown(action)
|
117
|
+
self.AA ||= AdditionalActions.new
|
118
|
+
self.AA.D = action
|
119
|
+
end
|
120
|
+
|
121
|
+
def onMouseUp(action)
|
122
|
+
self.AA ||= AdditionalActions.new
|
123
|
+
self.AA.U = action
|
124
|
+
end
|
125
|
+
|
126
|
+
def onFocus(action)
|
127
|
+
self.AA ||= AdditionalActions.new
|
128
|
+
self.AA.Fo = action
|
129
|
+
end
|
130
|
+
|
131
|
+
def onBlur(action)
|
132
|
+
self.AA ||= AdditionalActions.new
|
133
|
+
self.AA.Bl = action
|
134
|
+
end
|
135
|
+
|
136
|
+
def onPageOpen(action)
|
137
|
+
self.AA ||= AdditionalActions.new
|
138
|
+
self.AA.PO = action
|
139
|
+
end
|
140
|
+
|
141
|
+
def onPageClose(action)
|
142
|
+
self.AA ||= AdditionalActions.new
|
143
|
+
self.AA.PC = action
|
144
|
+
end
|
145
|
+
|
146
|
+
def onPageVisible(action)
|
147
|
+
self.AA ||= AdditionalActions.new
|
148
|
+
self.AA.PV = action
|
149
|
+
end
|
150
|
+
|
151
|
+
def onPageInvisible(action)
|
152
|
+
self.AA ||= AdditionalActions.new
|
153
|
+
self.AA.PI = action
|
154
|
+
end
|
155
|
+
end
|
25
156
|
|
26
157
|
#
|
27
|
-
#
|
28
|
-
# Annotations are objects which user can interact with.
|
158
|
+
# Annotation flags
|
29
159
|
#
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
include StandardObject
|
43
|
-
|
44
|
-
field :N, :Type => [ AppearanceStream, Dictionary ], :Required => true
|
45
|
-
field :R, :Type => [ AppearanceStream, Dictionary ]
|
46
|
-
field :D, :Type => [ AppearanceStream, Dictionary ]
|
47
|
-
end
|
160
|
+
module Flags
|
161
|
+
INVISIBLE = 1 << 0
|
162
|
+
HIDDEN = 1 << 1
|
163
|
+
PRINT = 1 << 2
|
164
|
+
NOZOOM = 1 << 3
|
165
|
+
NOROTATE = 1 << 4
|
166
|
+
NOVIEW = 1 << 5
|
167
|
+
READONLY = 1 << 6
|
168
|
+
LOCKED = 1 << 7
|
169
|
+
TOGGLENOVIEW = 1 << 8
|
170
|
+
LOCKEDCONTENTS = 1 << 9
|
171
|
+
end
|
48
172
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
field :PV, :Type => Action, :Version => "1.2" # Page Visible
|
64
|
-
field :PI, :Type => Action, :Version => "1.2" # Page Invisible
|
65
|
-
end
|
173
|
+
module Markup
|
174
|
+
def self.included(receiver)
|
175
|
+
receiver.field :T, Type: String, Version: "1.1"
|
176
|
+
receiver.field :Popup, Type: Dictionary, Version: "1.3"
|
177
|
+
receiver.field :CA, Type: Number, Default: 1.0, Version: "1.4"
|
178
|
+
receiver.field :RC, Type: [String, Stream], Version: "1.5"
|
179
|
+
receiver.field :CreationDate, Type: String, Version: "1.5"
|
180
|
+
receiver.field :IRT, Type: Dictionary, Version: "1.5"
|
181
|
+
receiver.field :Subj, Type: String, Version: "1.5"
|
182
|
+
receiver.field :RT, Type: Name, Default: :R, Version: "1.6"
|
183
|
+
receiver.field :IT, Type: Name, Version: "1.6"
|
184
|
+
receiver.field :ExData, Type: Dictionary, Version: "1.7"
|
185
|
+
end
|
186
|
+
end
|
66
187
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
188
|
+
class BorderStyle < Dictionary
|
189
|
+
include StandardObject
|
190
|
+
|
191
|
+
SOLID = :S
|
192
|
+
DASHED = :D
|
193
|
+
BEVELED = :B
|
194
|
+
INSET = :I
|
195
|
+
UNDERLINE = :U
|
196
|
+
|
197
|
+
field :Type, Type: Name, Default: :Border
|
198
|
+
field :W, Type: Number, Default: 1
|
199
|
+
field :S, Type: Name, Default: SOLID
|
200
|
+
field :D, Type: Array, Default: [3]
|
201
|
+
end
|
202
|
+
|
203
|
+
class BorderEffect < Dictionary
|
204
|
+
include StandardObject
|
205
|
+
|
206
|
+
NONE = :S
|
207
|
+
CLOUDY = :C
|
208
|
+
|
209
|
+
field :S, Type: Name, Default: NONE
|
210
|
+
field :I, Type: Integer, Default: 0
|
211
|
+
end
|
212
|
+
|
213
|
+
class AppearanceCharacteristics < Dictionary
|
214
|
+
include StandardObject
|
215
|
+
|
216
|
+
module CaptionStyle
|
217
|
+
CAPTION_ONLY = 0
|
218
|
+
ICON_ONLY = 1
|
219
|
+
CAPTION_BELOW = 2
|
220
|
+
CAPTION_ABOVE = 3
|
221
|
+
CAPTION_RIGHT = 4
|
222
|
+
CAPTION_LEFT = 5
|
223
|
+
CAPTION_OVERLAID = 6
|
224
|
+
end
|
225
|
+
|
226
|
+
field :R, Type: Integer, Default: 0
|
227
|
+
field :BC, Type: Array.of(Number)
|
228
|
+
field :BG, Type: Array.of(Number)
|
229
|
+
field :CA, Type: String
|
230
|
+
field :RC, Type: String
|
231
|
+
field :AC, Type: String
|
232
|
+
field :I, Type: Stream
|
233
|
+
field :RI, Type: Stream
|
234
|
+
field :IX, Type: Stream
|
235
|
+
field :IF, Type: Dictionary
|
236
|
+
field :TP, Type: Integer, Default: CaptionStyle::CAPTION_ONLY
|
237
|
+
end
|
91
238
|
|
92
|
-
|
93
|
-
|
94
|
-
self.AP[:R] = apstm
|
239
|
+
class Shape < Annotation
|
240
|
+
include Markup
|
95
241
|
|
96
|
-
|
242
|
+
field :Subtype, Type: Name, Required: true
|
243
|
+
field :BS, Type: BorderStyle
|
244
|
+
field :IC, Type: Array.of(Number)
|
245
|
+
field :BE, Type: BorderEffect, Version: "1.5"
|
246
|
+
field :RD, Type: Rectangle, Version: "1.5"
|
247
|
+
end
|
248
|
+
|
249
|
+
class Square < Shape
|
250
|
+
field :Subtype, Type: Name, Default: :Square, Required: true
|
251
|
+
end
|
252
|
+
|
253
|
+
class Circle < Shape
|
254
|
+
field :Subtype, Type: Name, Default: :Circle, Required: true
|
255
|
+
end
|
256
|
+
|
257
|
+
#
|
258
|
+
# Text annotation
|
259
|
+
#
|
260
|
+
class Text < Annotation
|
261
|
+
include Markup
|
262
|
+
|
263
|
+
module TextName
|
264
|
+
COMMENT = :C
|
265
|
+
KEY = :K
|
266
|
+
NOTE = :N
|
267
|
+
HELP = :H
|
268
|
+
NEWPARAGRAPH = :NP
|
269
|
+
PARAGRAPH = :P
|
270
|
+
INSERT = :I
|
271
|
+
end
|
272
|
+
|
273
|
+
field :Subtype, Type: Name, Default: :Text, Required: true
|
274
|
+
field :Open, Type: Boolean, Default: false
|
275
|
+
field :Name, Type: Name, Default: TextName::NOTE
|
276
|
+
field :State, Type: String, Version: "1.5"
|
277
|
+
field :StateModel, Type: String, Version: "1.5"
|
278
|
+
|
279
|
+
def pre_build
|
280
|
+
model = self.StateModel
|
281
|
+
state = self.State
|
282
|
+
|
283
|
+
case model
|
284
|
+
when "Marked"
|
285
|
+
self.State = "Unmarked" if state.nil?
|
286
|
+
when "Review"
|
287
|
+
self.State = "None" if state.nil?
|
97
288
|
end
|
98
289
|
|
99
|
-
|
100
|
-
|
101
|
-
|
290
|
+
super
|
291
|
+
end
|
292
|
+
end
|
293
|
+
|
294
|
+
#
|
295
|
+
# FreeText Annotation
|
296
|
+
#
|
297
|
+
class FreeText < Annotation
|
298
|
+
include Markup
|
299
|
+
|
300
|
+
module Intent
|
301
|
+
FREETEXT = :FreeText
|
302
|
+
FREETEXTCALLOUT = :FreeTextCallout
|
303
|
+
FREETEXTTYPEWRITER = :FreeTextTypeWriter
|
304
|
+
end
|
305
|
+
|
306
|
+
field :Subtype, Type: Name, Default: :FreeText, Required: true
|
307
|
+
field :DA, Type: String, Default: "/F1 10 Tf 0 g", Required: true
|
308
|
+
field :Q, Type: Integer, Default: Field::TextAlign::LEFT, Version: "1.4"
|
309
|
+
field :RC, Type: [String, Stream], Version: "1.5"
|
310
|
+
field :DS, Type: String, Version: "1.5"
|
311
|
+
field :CL, Type: Array.of(Number), Version: "1.6"
|
312
|
+
field :IT, Type: Name, Default: Intent::FREETEXT, Version: "1.6"
|
313
|
+
field :BE, Type: BorderEffect, Version: "1.6"
|
314
|
+
field :RD, Type: Rectangle, Version: "1.6"
|
315
|
+
field :BS, Type: BorderStyle, Version: "1.6"
|
316
|
+
field :LE, Type: Name, Default: :None, Version: "1.6"
|
317
|
+
end
|
318
|
+
|
319
|
+
#
|
320
|
+
# Class representing an link annotation.
|
321
|
+
#
|
322
|
+
class Link < Annotation
|
323
|
+
#
|
324
|
+
# The annotations highlighting mode.
|
325
|
+
# The visual effect to be used when the mouse button is pressed or held down inside its active area.
|
326
|
+
#
|
327
|
+
module Highlight
|
328
|
+
# No highlighting
|
329
|
+
NONE = :N
|
330
|
+
|
331
|
+
# Invert the contents of the annotation rectangle.
|
332
|
+
INVERT = :I
|
333
|
+
|
334
|
+
# Invert the annotations border.
|
335
|
+
OUTLINE = :O
|
336
|
+
|
337
|
+
# Display the annotation as if it were being pushed below the surface of the page
|
338
|
+
PUSH = :P
|
339
|
+
end
|
340
|
+
|
341
|
+
field :Subtype, Type: Name, Default: :Link, Required: true
|
342
|
+
field :A, Type: Action, Version: "1.1"
|
343
|
+
field :Dest, Type: [Destination, Name, String]
|
344
|
+
field :H, Type: Name, Default: Highlight::INVERT, Version: "1.2"
|
345
|
+
field :PA, Type: Dictionary, Version: "1.3"
|
346
|
+
field :QuadPoints, Type: Array.of(Number), Version: "1.6"
|
347
|
+
field :BS, Type: BorderStyle, Version: "1.6"
|
348
|
+
end
|
349
|
+
|
350
|
+
#
|
351
|
+
# Class representing a file attachment annotation.
|
352
|
+
#
|
353
|
+
class FileAttachment < Annotation
|
354
|
+
include Markup
|
355
|
+
|
356
|
+
# Icons to be displayed for file attachment.
|
357
|
+
module Icons
|
358
|
+
GRAPH = :Graph
|
359
|
+
PAPERCLIP = :Paperclip
|
360
|
+
PUSHPIN = :PushPin
|
361
|
+
TAG = :Tag
|
362
|
+
end
|
363
|
+
|
364
|
+
field :Subtype, Type: Name, Default: :FileAttachment, Required: true
|
365
|
+
field :FS, Type: FileSpec, Required: true
|
366
|
+
field :Name, Type: Name, Default: Icons::PUSHPIN
|
367
|
+
end
|
368
|
+
|
369
|
+
#
|
370
|
+
# Class representing a screen Annotation.
|
371
|
+
# A screen annotation specifies a region of a page upon which media clips may be played. It also serves as an object from which actions can be triggered.
|
372
|
+
#
|
373
|
+
class Screen < Annotation
|
374
|
+
include Triggerable
|
375
|
+
|
376
|
+
field :Subtype, Type: Name, Default: :Screen, Required: true
|
377
|
+
field :T, Type: String
|
378
|
+
field :MK, Type: AppearanceCharacteristics
|
379
|
+
field :A, Type: Action, Version: "1.1"
|
380
|
+
field :AA, Type: AdditionalActions, Version: "1.2"
|
381
|
+
end
|
382
|
+
|
383
|
+
class Sound < Annotation
|
384
|
+
include Markup
|
385
|
+
|
386
|
+
module Icons
|
387
|
+
SPEAKER = :Speaker
|
388
|
+
MIC = :Mic
|
389
|
+
end
|
390
|
+
|
391
|
+
field :Subtype, Type: Name, Default: :Sound, Required: true
|
392
|
+
field :Sound, Type: Stream, Required: true
|
393
|
+
field :Name, Type: Name, Default: Icons::SPEAKER
|
394
|
+
end
|
395
|
+
|
396
|
+
class RichMedia < Annotation
|
397
|
+
class Position < Dictionary
|
398
|
+
include StandardObject
|
399
|
+
|
400
|
+
NEAR = :Near
|
401
|
+
CENTER = :Center
|
402
|
+
FAR = :Far
|
403
|
+
|
404
|
+
field :Type, Type: Name, Default: :RichMediaPosition, Version: "1.7", ExtensionLevel: 3
|
405
|
+
field :HAlign, Type: Name, Default: FAR, Version: "1.7", ExtensionLevel: 3
|
406
|
+
field :VAlign, Type: Name, Default: NEAR, Version: "1.7", ExtensionLevel: 3
|
407
|
+
field :HOffset, Type: Number, Default: 18, Version: "1.7", ExtensionLevel: 3
|
408
|
+
field :VOffset, Type: Number, Default: 18, Version: "1.7", ExtensionLevel: 3
|
409
|
+
end
|
410
|
+
|
411
|
+
class Window < Dictionary
|
412
|
+
include StandardObject
|
102
413
|
|
103
|
-
|
414
|
+
field :Type, Type: Name, Default: :RichMediaWindow, Version: "1.7", ExtensionLevel: 3
|
415
|
+
field :Width, Type: Dictionary, Default: {Default: 288, Max: 576, Min: 72}, Version: "1.7", ExtensionLevel: 3
|
416
|
+
field :Height, Type: Dictionary, Default: {Default: 216, Max: 432, Min: 72}, Version: "1.7", ExtensionLevel: 3
|
417
|
+
field :Position, Type: Position, Version: "1.7", ExtensionLevel: 3
|
418
|
+
end
|
419
|
+
|
420
|
+
class Presentation < Dictionary
|
421
|
+
include StandardObject
|
422
|
+
|
423
|
+
WINDOWED = :Windowed
|
424
|
+
EMBEDDED = :Embedded
|
425
|
+
|
426
|
+
field :Type, Type: Name, Default: :RichMediaPresentation, Version: "1.7", ExtensionLevel: 3
|
427
|
+
field :Style, Type: Name, Default: EMBEDDED, Version: "1.7", ExtensionLevel: 3
|
428
|
+
field :Window, Type: Window, Version: "1.7", ExtensionLevel: 3
|
429
|
+
field :Transparent, Type: Boolean, Default: false, Version: "1.7", ExtensionLevel: 3
|
430
|
+
field :NavigationPane, Type: Boolean, Default: false, Version: "1.7", ExtensionLevel: 3
|
431
|
+
field :Toolbar, Type: Boolean, Version: "1.7", ExtensionLevel: 3
|
432
|
+
field :PassContextClick, Type: Boolean, Default: false, Version: "1.7", ExtensionLevel: 3
|
433
|
+
end
|
434
|
+
|
435
|
+
class Animation < Dictionary
|
436
|
+
include StandardObject
|
437
|
+
|
438
|
+
NONE = :None
|
439
|
+
LINEAR = :Linear
|
440
|
+
OSCILLATING = :Oscillating
|
441
|
+
|
442
|
+
field :Type, Type: Name, Default: :RichMediaAnimation, Version: "1.7", ExtensionLevel: 3
|
443
|
+
field :Subtype, Type: Name, Default: NONE, Version: "1.7", ExtensionLevel: 3
|
444
|
+
field :PlayCount, Type: Integer, Default: -1, Version: "1.7", ExtensionLevel: 3
|
445
|
+
field :Speed, Type: Number, Default: 1, Version: "1.7", ExtensionLevel: 3
|
446
|
+
end
|
447
|
+
|
448
|
+
class Activation < Dictionary
|
449
|
+
include StandardObject
|
450
|
+
|
451
|
+
USER_ACTION = :XA
|
452
|
+
PAGE_OPEN = :PO
|
453
|
+
PAGE_VISIBLE = :PV
|
454
|
+
|
455
|
+
field :Type, Type: Name, Default: :RichMediaActivation, Version: "1.7", ExtensionLevel: 3
|
456
|
+
field :Condition, Type: Name, Default: USER_ACTION, Version: "1.7", ExtensionLevel: 3
|
457
|
+
field :Animation, Type: Animation, Version: "1.7", ExtensionLevel: 3
|
458
|
+
field :View, Type: Dictionary, Version: "1.7", ExtensionLevel: 3
|
459
|
+
field :Configuration, Type: Dictionary, Version: "1.7", ExtensionLevel: 3
|
460
|
+
field :Presentation, Type: Presentation, Version: "1.7", ExtensionLevel: 3
|
461
|
+
field :Scripts, Type: Array.of(FileSpec), Version: "1.7", ExtensionLevel: 3
|
462
|
+
end
|
463
|
+
|
464
|
+
class Deactivation < Dictionary
|
465
|
+
include StandardObject
|
466
|
+
|
467
|
+
USER_ACTION = :XD
|
468
|
+
PAGE_CLOSE = :PC
|
469
|
+
PAGE_INVISIBLE = :PV
|
470
|
+
|
471
|
+
field :Type, Type: Name, Default: :RichMediaDeactivation, Version: "1.7", ExtensionLevel: 3
|
472
|
+
field :Condition, Type: Name, Default: USER_ACTION, Version: "1.7", ExtensionLevel: 3
|
473
|
+
end
|
474
|
+
|
475
|
+
class Settings < Dictionary
|
476
|
+
include StandardObject
|
477
|
+
|
478
|
+
field :Type, Type: Name, Default: :RichMediaSettings, Version: "1.7", ExtensionLevel: 3
|
479
|
+
field :Activation, Type: Activation, Version: "1.7", ExtensionLevel: 3
|
480
|
+
field :Deactivation, Type: Deactivation, Version: "1.7", ExtensionLevel: 3
|
481
|
+
end
|
482
|
+
|
483
|
+
class CuePoint < Dictionary
|
484
|
+
include StandardObject
|
485
|
+
|
486
|
+
NAVIGATION = :Navigation
|
487
|
+
EVENT = :Event
|
488
|
+
|
489
|
+
field :Type, Type: Name, Default: :CuePoint, Version: "1.7", ExtensionLevel: 3
|
490
|
+
field :Subtype, Type: Name, Version: "1.7", ExtensionLevel: 3
|
491
|
+
field :Name, Type: String, Version: "1.7", ExtensionLevel: 3, Required: true
|
492
|
+
field :Time, Type: Number, Version: "1.7", ExtensionLevel: 3, Required: true
|
493
|
+
field :A, Type: Action, Version: "1.7", ExtensionLevel: 3, Required: true
|
494
|
+
end
|
495
|
+
|
496
|
+
class Parameters < Dictionary
|
497
|
+
include StandardObject
|
498
|
+
|
499
|
+
module Binding
|
500
|
+
NONE = :None
|
501
|
+
FOREGROUND = :Foreground
|
502
|
+
BACKGROUND = :Background
|
503
|
+
MATERIAL = :Material
|
104
504
|
end
|
105
505
|
|
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
|
-
|
506
|
+
field :Type, Type: Name, Default: :RichMediaParams, Version: "1.7", ExtensionLevel: 3
|
507
|
+
field :FlashVars, Type: [String, Stream], Version: "1.7", ExtensionLevel: 3
|
508
|
+
field :Binding, Type: Name, Default: Binding::NONE, Version: "1.7", ExtensionLevel: 3
|
509
|
+
field :BindingMaterialName, Type: String, Version: "1.7", ExtensionLevel: 3
|
510
|
+
field :CuePoints, Type: Array.of(CuePoint), Default: [], Version: "1.7", ExtensionLevel: 3
|
511
|
+
field :Settings, Type: [String, Stream], Version: "1.7", ExtensionLevel: 3
|
512
|
+
end
|
513
|
+
|
514
|
+
class Instance < Dictionary
|
515
|
+
include StandardObject
|
516
|
+
|
517
|
+
U3D = :'3D'
|
518
|
+
FLASH = :Flash
|
519
|
+
SOUND = :Sound
|
520
|
+
VIDEO = :Video
|
521
|
+
|
522
|
+
field :Type, Type: Name, Default: :RichMediaInstance, Version: "1.7", ExtensionLevel: 3
|
523
|
+
field :Subtype, Type: Name, Version: "1.7", ExtensionLevel: 3
|
524
|
+
field :Params, Type: Parameters, Version: "1.7", ExtensionLevel: 3
|
525
|
+
field :Asset, Type: FileSpec, Version: "1.7", ExtensionLevel: 3
|
526
|
+
end
|
527
|
+
|
528
|
+
class Configuration < Dictionary
|
529
|
+
include StandardObject
|
530
|
+
|
531
|
+
U3D = :'3D'
|
532
|
+
FLASH = :Flash
|
533
|
+
SOUND = :Sound
|
534
|
+
VIDEO = :Video
|
535
|
+
|
536
|
+
field :Type, Type: Name, Default: :RichMediaConfiguration, Version: "1.7", ExtensionLevel: 3
|
537
|
+
field :Subtype, Type: Name, Version: "1.7", ExtensionLevel: 3
|
538
|
+
field :Name, Type: String, Version: "1.7", ExtensionLevel: 3
|
539
|
+
field :Instances, Type: Array.of(Instance), Version: "1.7", ExtensionLevel: 3
|
540
|
+
end
|
541
|
+
|
542
|
+
class Content < Dictionary
|
543
|
+
include StandardObject
|
544
|
+
|
545
|
+
field :Type, Type: Name, Default: :RichMediaContent, Version: "1.7", ExtensionLevel: 3
|
546
|
+
field :Assets, Type: Dictionary, Version: "1.7", ExtensionLevel: 3
|
547
|
+
field :Configurations, Type: Array.of(Configuration), Version: "1.7", ExtensionLevel: 3
|
548
|
+
field :Views, Type: Array, Version: "1.7", ExtensionLevel: 3
|
549
|
+
end
|
550
|
+
|
551
|
+
#
|
552
|
+
# Fields of the RichMedia Annotation.
|
553
|
+
#
|
554
|
+
field :Subtype, Type: Name, Default: :RichMedia, Version: "1.7", ExtensionLevel: 3, Required: true
|
555
|
+
field :RichMediaSettings, Type: Settings, Version: "1.7", ExtensionLevel: 3
|
556
|
+
field :RichMediaContent, Type: Content, Version: "1.7", ExtensionLevel: 3, Required: true
|
557
|
+
end
|
558
|
+
|
559
|
+
# Added in ExtensionLevel 3.
|
560
|
+
class Projection < Annotation; end
|
561
|
+
|
562
|
+
#
|
563
|
+
# Class representing a widget Annotation.
|
564
|
+
# Interactive forms use widget annotations to represent the appearance of fields and to manage user interactions.
|
565
|
+
#
|
566
|
+
class Widget < Annotation
|
567
|
+
include Field
|
568
|
+
include Triggerable
|
569
|
+
|
570
|
+
module Highlight
|
571
|
+
# No highlighting
|
572
|
+
NONE = :N
|
573
|
+
|
574
|
+
# Invert the contents of the annotation rectangle.
|
575
|
+
INVERT = :I
|
576
|
+
|
577
|
+
# Invert the annotations border.
|
578
|
+
OUTLINE = :O
|
579
|
+
|
580
|
+
# Display the annotation as if it were being pushed below the surface of the page
|
581
|
+
PUSH = :P
|
582
|
+
|
583
|
+
# Same as P.
|
584
|
+
TOGGLE = :T
|
585
|
+
end
|
586
|
+
|
587
|
+
field :Subtype, Type: Name, Default: :Widget, Required: true
|
588
|
+
field :H, Type: Name, Default: Highlight::INVERT
|
589
|
+
field :MK, Type: AppearanceCharacteristics
|
590
|
+
field :A, Type: Action, Version: "1.1"
|
591
|
+
field :AA, Type: AdditionalActions, Version: "1.2"
|
592
|
+
field :BS, Type: BorderStyle, Version: "1.2"
|
593
|
+
|
594
|
+
def onActivate(action)
|
595
|
+
unless action.is_a?(Action)
|
596
|
+
raise TypeError, "An Action object must be passed."
|
157
597
|
end
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
598
|
+
|
599
|
+
self.A = action
|
600
|
+
end
|
601
|
+
|
602
|
+
class Button < Widget
|
162
603
|
module Flags
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
NOROTATE = 1 << 4
|
168
|
-
NOVIEW = 1 << 5
|
169
|
-
READONLY = 1 << 6
|
170
|
-
LOCKED = 1 << 7
|
171
|
-
TOGGLENOVIEW = 1 << 8
|
172
|
-
LOCKEDCONTENTS = 1 << 9
|
604
|
+
NOTOGGLETOOFF = 1 << 14
|
605
|
+
RADIO = 1 << 15
|
606
|
+
PUSHBUTTON = 1 << 16
|
607
|
+
RADIOSINUNISON = 1 << 26
|
173
608
|
end
|
174
609
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
receiver.field :IRT, :Type => Dictionary, :Version => "1.5"
|
183
|
-
receiver.field :Subj, :Type => String, :Version => "1.5"
|
184
|
-
receiver.field :RT, :Type => Name, :Default => :R, :Version => "1.6"
|
185
|
-
receiver.field :IT, :Type => Name, :Version => "1.6"
|
186
|
-
receiver.field :ExData, :Type => Dictionary, :Version => "1.7"
|
187
|
-
end
|
188
|
-
end
|
610
|
+
field :FT, Type: Name, Default: Field::Type::BUTTON, Required: true
|
611
|
+
end
|
612
|
+
|
613
|
+
class PushButton < Button
|
614
|
+
def pre_build
|
615
|
+
self.Ff ||= 0
|
616
|
+
self.Ff |= Button::Flags::PUSHBUTTON
|
189
617
|
|
190
|
-
|
191
|
-
include StandardObject
|
192
|
-
|
193
|
-
SOLID = :S
|
194
|
-
DASHED = :D
|
195
|
-
BEVELED = :B
|
196
|
-
INSET = :I
|
197
|
-
UNDERLINE = :U
|
198
|
-
|
199
|
-
field :Type, :Type => Name, :Default => :Border
|
200
|
-
field :W, :Type => Number, :Default => 1
|
201
|
-
field :S, :Type => Name, :Default => SOLID
|
202
|
-
field :D, :Type => Array, :Default => [ 3 ]
|
618
|
+
super
|
203
619
|
end
|
620
|
+
end
|
204
621
|
|
205
|
-
|
206
|
-
|
622
|
+
class CheckBox < Button
|
623
|
+
def pre_build
|
624
|
+
self.Ff ||= 0
|
207
625
|
|
208
|
-
|
209
|
-
|
626
|
+
self.Ff &= ~Button::Flags::RADIO
|
627
|
+
self.Ff &= ~Button::Flags::PUSHBUTTON
|
210
628
|
|
211
|
-
|
212
|
-
field :I, :Type => Integer, :Default => 0
|
213
|
-
end
|
214
|
-
|
215
|
-
class AppearanceCharacteristics < Dictionary
|
216
|
-
include StandardObject
|
217
|
-
|
218
|
-
module CaptionStyle
|
219
|
-
CAPTION_ONLY = 0
|
220
|
-
ICON_ONLY = 1
|
221
|
-
CAPTION_BELOW = 2
|
222
|
-
CAPTION_ABOVE = 3
|
223
|
-
CAPTION_RIGHT = 4
|
224
|
-
CAPTION_LEFT = 5
|
225
|
-
CAPTION_OVERLAID = 6
|
226
|
-
end
|
227
|
-
|
228
|
-
field :R, :Type => Integer, :Default => 0
|
229
|
-
field :BC, :Type => Array.of(Number)
|
230
|
-
field :BG, :Type => Array.of(Number)
|
231
|
-
field :CA, :Type => String
|
232
|
-
field :RC, :Type => String
|
233
|
-
field :AC, :Type => String
|
234
|
-
field :I, :Type => Stream
|
235
|
-
field :RI, :Type => Stream
|
236
|
-
field :IX, :Type => Stream
|
237
|
-
field :IF, :Type => Dictionary
|
238
|
-
field :TP, :Type => Integer, :Default => CaptionStyle::CAPTION_ONLY
|
239
|
-
end
|
240
|
-
|
241
|
-
class Shape < Annotation
|
242
|
-
include Markup
|
243
|
-
|
244
|
-
field :Subtype, :Type => Name, :Required => true
|
245
|
-
field :BS, :Type => BorderStyle
|
246
|
-
field :IC, :Type => Array.of(Number)
|
247
|
-
field :BE, :Type => BorderEffect, :Version => "1.5"
|
248
|
-
field :RD, :Type => Rectangle, :Version => "1.5"
|
249
|
-
end
|
250
|
-
|
251
|
-
class Square < Shape
|
252
|
-
field :Subtype, :Type => Name, :Default => :Square, :Required => true
|
253
|
-
end
|
254
|
-
|
255
|
-
class Circle < Shape
|
256
|
-
field :Subtype, :Type => Name, :Default => :Circle, :Required => true
|
629
|
+
super
|
257
630
|
end
|
631
|
+
end
|
258
632
|
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
class Text < Annotation
|
263
|
-
include Markup
|
264
|
-
|
265
|
-
module TextName
|
266
|
-
COMMENT = :C
|
267
|
-
KEY = :K
|
268
|
-
NOTE = :N
|
269
|
-
HELP = :H
|
270
|
-
NEWPARAGRAPH = :NP
|
271
|
-
PARAGRAPH = :P
|
272
|
-
INSERT = :I
|
273
|
-
end
|
274
|
-
|
275
|
-
field :Subtype, :Type => Name, :Default => :Text, :Required => true
|
276
|
-
field :Open, :Type => Boolean, :Default => false
|
277
|
-
field :Name, :Type => Name, :Default => TextName::NOTE
|
278
|
-
field :State, :Type => String, :Version => "1.5"
|
279
|
-
field :StateModel, :Type => String, :Version => "1.5"
|
280
|
-
|
281
|
-
def pre_build
|
282
|
-
model = self.StateModel
|
283
|
-
state = self.State
|
284
|
-
|
285
|
-
case model
|
286
|
-
when "Marked"
|
287
|
-
self.State = "Unmarked" if state.nil?
|
288
|
-
when "Review"
|
289
|
-
self.State = "None" if state.nil?
|
290
|
-
end
|
291
|
-
|
292
|
-
super
|
293
|
-
end
|
294
|
-
end
|
633
|
+
class Radio < Button
|
634
|
+
def pre_build
|
635
|
+
self.Ff ||= 0
|
295
636
|
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
include Markup
|
301
|
-
|
302
|
-
module Intent
|
303
|
-
FREETEXT = :FreeText
|
304
|
-
FREETEXTCALLOUT = :FreeTextCallout
|
305
|
-
FREETEXTTYPEWRITER = :FreeTextTypeWriter
|
306
|
-
end
|
307
|
-
|
308
|
-
field :Subtype, :Type => Name, :Default => :FreeText, :Required => true
|
309
|
-
field :DA, :Type => String, :Default => "/F1 10 Tf 0 g", :Required => true
|
310
|
-
field :Q, :Type => Integer, :Default => Field::TextAlign::LEFT, :Version => "1.4"
|
311
|
-
field :RC, :Type => [String, Stream], :Version => "1.5"
|
312
|
-
field :DS, :Type => String, :Version => "1.5"
|
313
|
-
field :CL, :Type => Array.of(Number), :Version => "1.6"
|
314
|
-
field :IT, :Type => Name, :Default => Intent::FREETEXT, :Version => "1.6"
|
315
|
-
field :BE, :Type => BorderEffect, :Version => "1.6"
|
316
|
-
field :RD, :Type => Rectangle, :Version => "1.6"
|
317
|
-
field :BS, :Type => BorderStyle, :Version => "1.6"
|
318
|
-
field :LE, :Type => Name, :Default => :None, :Version => "1.6"
|
319
|
-
end
|
320
|
-
|
321
|
-
#
|
322
|
-
# Class representing an link annotation.
|
323
|
-
#
|
324
|
-
class Link < Annotation
|
325
|
-
|
326
|
-
#
|
327
|
-
# The annotations highlighting mode.
|
328
|
-
# The visual effect to be used when the mouse button is pressed or held down inside its active area.
|
329
|
-
#
|
330
|
-
module Highlight
|
331
|
-
# No highlighting
|
332
|
-
NONE = :N
|
333
|
-
|
334
|
-
# Invert the contents of the annotation rectangle.
|
335
|
-
INVERT = :I
|
336
|
-
|
337
|
-
# Invert the annotations border.
|
338
|
-
OUTLINE = :O
|
339
|
-
|
340
|
-
# Display the annotation as if it were being pushed below the surface of the page
|
341
|
-
PUSH = :P
|
342
|
-
end
|
343
|
-
|
344
|
-
field :Subtype, :Type => Name, :Default => :Link, :Required => true
|
345
|
-
field :A, :Type => Action, :Version => "1.1"
|
346
|
-
field :Dest, :Type => [ Destination, Name, String ]
|
347
|
-
field :H, :Type => Name, :Default => Highlight::INVERT, :Version => "1.2"
|
348
|
-
field :PA, :Type => Dictionary, :Version => "1.3"
|
349
|
-
field :QuadPoints, :Type => Array.of(Number), :Version => "1.6"
|
350
|
-
field :BS, :Type => BorderStyle, :Version => "1.6"
|
351
|
-
end
|
352
|
-
|
353
|
-
#
|
354
|
-
# Class representing a file attachment annotation.
|
355
|
-
#
|
356
|
-
class FileAttachment < Annotation
|
357
|
-
include Markup
|
358
|
-
|
359
|
-
# Icons to be displayed for file attachment.
|
360
|
-
module Icons
|
361
|
-
GRAPH = :Graph
|
362
|
-
PAPERCLIP = :Paperclip
|
363
|
-
PUSHPIN = :PushPin
|
364
|
-
TAG = :Tag
|
365
|
-
end
|
366
|
-
|
367
|
-
field :Subtype, :Type => Name, :Default => :FileAttachment, :Required => true
|
368
|
-
field :FS, :Type => FileSpec, :Required => true
|
369
|
-
field :Name, :Type => Name, :Default => Icons::PUSHPIN
|
637
|
+
self.Ff &= ~Button::Flags::PUSHBUTTON
|
638
|
+
self.Ff |= Button::Flags::RADIO
|
639
|
+
|
640
|
+
super
|
370
641
|
end
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
field :A, :Type => Action, :Version => "1.1"
|
383
|
-
field :AA, :Type => AdditionalActions, :Version => "1.2"
|
642
|
+
end
|
643
|
+
|
644
|
+
class Text < Widget
|
645
|
+
module Flags
|
646
|
+
MULTILINE = 1 << 12
|
647
|
+
PASSWORD = 1 << 13
|
648
|
+
FILESELECT = 1 << 20
|
649
|
+
DONOTSPELLCHECK = 1 << 22
|
650
|
+
DONOTSCROLL = 1 << 23
|
651
|
+
COMB = 1 << 24
|
652
|
+
RICHTEXT = 1 << 25
|
384
653
|
end
|
385
654
|
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
655
|
+
field :FT, Type: Name, Default: Field::Type::TEXT, Required: true
|
656
|
+
field :MaxLen, Type: Integer
|
657
|
+
end
|
658
|
+
|
659
|
+
class Choice < Widget
|
660
|
+
module Flags
|
661
|
+
COMBO = 1 << 17
|
662
|
+
EDIT = 1 << 18
|
663
|
+
SORT = 1 << 19
|
664
|
+
MULTISELECT = 1 << 21
|
665
|
+
DONOTSPELLCHECK = 1 << 22
|
666
|
+
COMMITONSELCHANGE = 1 << 26
|
397
667
|
end
|
398
668
|
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
field :HOffset, :Type => Number, :Default => 18, :Version => "1.7", :ExtensionLevel => 3
|
412
|
-
field :VOffset, :Type => Number, :Default => 18, :Version => "1.7", :ExtensionLevel => 3
|
413
|
-
end
|
414
|
-
|
415
|
-
class Window < Dictionary
|
416
|
-
include StandardObject
|
417
|
-
|
418
|
-
field :Type, :Type => Name, :Default => :RichMediaWindow, :Version => "1.7", :ExtensionLevel => 3
|
419
|
-
field :Width, :Type => Dictionary, :Default => {:Default => 288, :Max => 576, :Min => 72}, :Version => "1.7", :ExtensionLevel => 3
|
420
|
-
field :Height, :Type => Dictionary, :Default => {:Default => 216, :Max => 432, :Min => 72}, :Version => "1.7", :ExtensionLevel => 3
|
421
|
-
field :Position, :Type => Position, :Version => "1.7", :ExtensionLevel => 3
|
422
|
-
end
|
423
|
-
|
424
|
-
class Presentation < Dictionary
|
425
|
-
include StandardObject
|
426
|
-
|
427
|
-
WINDOWED = :Windowed
|
428
|
-
EMBEDDED = :Embedded
|
429
|
-
|
430
|
-
field :Type, :Type => Name, :Default => :RichMediaPresentation, :Version => "1.7", :ExtensionLevel => 3
|
431
|
-
field :Style, :Type => Name, :Default => EMBEDDED, :Version => "1.7", :ExtensionLevel => 3
|
432
|
-
field :Window, :Type => Window, :Version => "1.7", :ExtensionLevel => 3
|
433
|
-
field :Transparent, :Type => Boolean, :Default => false, :Version => "1.7", :ExtensionLevel => 3
|
434
|
-
field :NavigationPane, :Type => Boolean, :Default => false, :Version => "1.7", :ExtensionLevel => 3
|
435
|
-
field :Toolbar, :Type => Boolean, :Version => "1.7", :ExtensionLevel => 3
|
436
|
-
field :PassContextClick, :Type => Boolean, :Default => false, :Version => "1.7", :ExtensionLevel => 3
|
437
|
-
end
|
438
|
-
|
439
|
-
class Animation < Dictionary
|
440
|
-
include StandardObject
|
441
|
-
|
442
|
-
NONE = :None
|
443
|
-
LINEAR = :Linear
|
444
|
-
OSCILLATING = :Oscillating
|
445
|
-
|
446
|
-
field :Type, :Type => Name, :Default => :RichMediaAnimation, :Version => "1.7", :ExtensionLevel => 3
|
447
|
-
field :Subtype, :Type => Name, :Default => NONE, :Version => "1.7", :ExtensionLevel => 3
|
448
|
-
field :PlayCount, :Type => Integer, :Default => -1, :Version => "1.7", :ExtensionLevel => 3
|
449
|
-
field :Speed, :Type => Number, :Default => 1, :Version => "1.7", :ExtensionLevel => 3
|
450
|
-
end
|
451
|
-
|
452
|
-
class Activation < Dictionary
|
453
|
-
include StandardObject
|
454
|
-
|
455
|
-
USER_ACTION = :XA
|
456
|
-
PAGE_OPEN = :PO
|
457
|
-
PAGE_VISIBLE = :PV
|
458
|
-
|
459
|
-
field :Type, :Type => Name, :Default => :RichMediaActivation, :Version => "1.7", :ExtensionLevel => 3
|
460
|
-
field :Condition, :Type => Name, :Default => USER_ACTION, :Version => "1.7", :ExtensionLevel => 3
|
461
|
-
field :Animation, :Type => Animation, :Version => "1.7", :ExtensionLevel => 3
|
462
|
-
field :View, :Type => Dictionary, :Version => "1.7", :ExtensionLevel => 3
|
463
|
-
field :Configuration, :Type => Dictionary, :Version => "1.7", :ExtensionLevel => 3
|
464
|
-
field :Presentation, :Type => Presentation, :Version => "1.7", :ExtensionLevel => 3
|
465
|
-
field :Scripts, :Type => Array.of(FileSpec), :Version => "1.7", :ExtensionLevel => 3
|
466
|
-
end
|
467
|
-
|
468
|
-
class Deactivation < Dictionary
|
469
|
-
include StandardObject
|
470
|
-
|
471
|
-
USER_ACTION = :XD
|
472
|
-
PAGE_CLOSE = :PC
|
473
|
-
PAGE_INVISIBLE = :PV
|
474
|
-
|
475
|
-
field :Type, :Type => Name, :Default => :RichMediaDeactivation, :Version => "1.7", :ExtensionLevel => 3
|
476
|
-
field :Condition, :Type => Name, :Default => USER_ACTION, :Version => "1.7", :ExtensionLevel => 3
|
477
|
-
end
|
478
|
-
|
479
|
-
class Settings < Dictionary
|
480
|
-
include StandardObject
|
481
|
-
|
482
|
-
field :Type, :Type => Name, :Default => :RichMediaSettings, :Version => "1.7", :ExtensionLevel => 3
|
483
|
-
field :Activation, :Type => Activation, :Version => "1.7", :ExtensionLevel => 3
|
484
|
-
field :Deactivation, :Type => Deactivation, :Version => "1.7", :ExtensionLevel => 3
|
485
|
-
end
|
486
|
-
|
487
|
-
class CuePoint < Dictionary
|
488
|
-
include StandardObject
|
489
|
-
|
490
|
-
NAVIGATION = :Navigation
|
491
|
-
EVENT = :Event
|
492
|
-
|
493
|
-
field :Type, :Type => Name, :Default => :CuePoint, :Version => "1.7", :ExtensionLevel => 3
|
494
|
-
field :Subtype, :Type => Name, :Version => "1.7", :ExtensionLevel => 3
|
495
|
-
field :Name, :Type => String, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
496
|
-
field :Time, :Type => Number, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
497
|
-
field :A, :Type => Action, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
498
|
-
end
|
499
|
-
|
500
|
-
class Parameters < Dictionary
|
501
|
-
include StandardObject
|
502
|
-
|
503
|
-
module Binding
|
504
|
-
NONE = :None
|
505
|
-
FOREGROUND = :Foreground
|
506
|
-
BACKGROUND = :Background
|
507
|
-
MATERIAL = :Material
|
508
|
-
end
|
509
|
-
|
510
|
-
field :Type, :Type => Name, :Default => :RichMediaParams, :Version => "1.7", :ExtensionLevel => 3
|
511
|
-
field :FlashVars, :Type => [String, Stream], :Version => "1.7", :ExtensionLevel => 3
|
512
|
-
field :Binding, :Type => Name, :Default => Binding::NONE, :Version => "1.7", :ExtensionLevel => 3
|
513
|
-
field :BindingMaterialName, :Type => String, :Version => "1.7", :ExtensionLevel => 3
|
514
|
-
field :CuePoints, :Type => Array.of(CuePoint), :Default => [], :Version => "1.7", :ExtensionLevel => 3
|
515
|
-
field :Settings, :Type => [String, Stream], :Version => "1.7", :ExtensionLevel => 3
|
516
|
-
end
|
517
|
-
|
518
|
-
class Instance < Dictionary
|
519
|
-
include StandardObject
|
520
|
-
|
521
|
-
U3D = :"3D"
|
522
|
-
FLASH = :Flash
|
523
|
-
SOUND = :Sound
|
524
|
-
VIDEO = :Video
|
525
|
-
|
526
|
-
field :Type, :Type => Name, :Default => :RichMediaInstance, :Version => "1.7", :ExtensionLevel => 3
|
527
|
-
field :Subtype, :Type => Name, :Version => "1.7", :ExtensionLevel => 3
|
528
|
-
field :Params, :Type => Parameters, :Version => "1.7", :ExtensionLevel => 3
|
529
|
-
field :Asset, :Type => FileSpec, :Version => "1.7", :ExtensionLevel => 3
|
530
|
-
end
|
531
|
-
|
532
|
-
class Configuration < Dictionary
|
533
|
-
include StandardObject
|
534
|
-
|
535
|
-
U3D = :"3D"
|
536
|
-
FLASH = :Flash
|
537
|
-
SOUND = :Sound
|
538
|
-
VIDEO = :Video
|
539
|
-
|
540
|
-
field :Type, :Type => Name, :Default => :RichMediaConfiguration, :Version => "1.7", :ExtensionLevel => 3
|
541
|
-
field :Subtype, :Type => Name, :Version => "1.7", :ExtensionLevel => 3
|
542
|
-
field :Name, :Type => String, :Version => "1.7", :ExtensionLevel => 3
|
543
|
-
field :Instances, :Type => Array.of(Instance), :Version => "1.7", :ExtensionLevel => 3
|
544
|
-
end
|
545
|
-
|
546
|
-
class Content < Dictionary
|
547
|
-
include StandardObject
|
548
|
-
|
549
|
-
field :Type, :Type => Name, :Default => :RichMediaContent, :Version => "1.7", :ExtensionLevel => 3
|
550
|
-
field :Assets, :Type => Dictionary, :Version => "1.7", :ExtensionLevel => 3
|
551
|
-
field :Configurations, :Type => Array.of(Configuration), :Version => "1.7", :ExtensionLevel => 3
|
552
|
-
field :Views, :Type => Array, :Version => "1.7", :ExtensionLevel => 3
|
553
|
-
end
|
554
|
-
|
555
|
-
#
|
556
|
-
# Fields of the RichMedia Annotation.
|
557
|
-
#
|
558
|
-
field :Subtype, :Type => Name, :Default => :RichMedia, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
559
|
-
field :RichMediaSettings, :Type => Settings, :Version => "1.7", :ExtensionLevel => 3
|
560
|
-
field :RichMediaContent, :Type => Content, :Version => "1.7", :ExtensionLevel => 3, :Required => true
|
669
|
+
field :FT, Type: Name, Default: Field::Type::CHOICE, Required: true
|
670
|
+
field :Opt, Type: Array
|
671
|
+
field :TI, Type: Integer, Default: 0
|
672
|
+
field :I, Type: Array, Version: "1.4"
|
673
|
+
end
|
674
|
+
|
675
|
+
class ComboBox < Choice
|
676
|
+
def pre_build
|
677
|
+
self.Ff ||= 0
|
678
|
+
self.Ff |= Choice::Flags::COMBO
|
679
|
+
|
680
|
+
super
|
561
681
|
end
|
682
|
+
end
|
683
|
+
|
684
|
+
class ListBox < Choice
|
685
|
+
def pre_build
|
686
|
+
self.Ff ||= 0
|
687
|
+
self.Ff &= ~Choice::Flags::COMBO
|
562
688
|
|
563
|
-
|
564
|
-
class Projection < Annotation; end
|
565
|
-
|
566
|
-
#
|
567
|
-
# Class representing a widget Annotation.
|
568
|
-
# Interactive forms use widget annotations to represent the appearance of fields and to manage user interactions.
|
569
|
-
#
|
570
|
-
class Widget < Annotation
|
571
|
-
include Field
|
572
|
-
include Triggerable
|
573
|
-
|
574
|
-
module Highlight
|
575
|
-
# No highlighting
|
576
|
-
NONE = :N
|
577
|
-
|
578
|
-
# Invert the contents of the annotation rectangle.
|
579
|
-
INVERT = :I
|
580
|
-
|
581
|
-
# Invert the annotations border.
|
582
|
-
OUTLINE = :O
|
583
|
-
|
584
|
-
# Display the annotation as if it were being pushed below the surface of the page
|
585
|
-
PUSH = :P
|
586
|
-
|
587
|
-
# Same as P.
|
588
|
-
TOGGLE = :T
|
589
|
-
end
|
590
|
-
|
591
|
-
field :Subtype, :Type => Name, :Default => :Widget, :Required => true
|
592
|
-
field :H, :Type => Name, :Default => Highlight::INVERT
|
593
|
-
field :MK, :Type => AppearanceCharacteristics
|
594
|
-
field :A, :Type => Action, :Version => "1.1"
|
595
|
-
field :AA, :Type => AdditionalActions, :Version => "1.2"
|
596
|
-
field :BS, :Type => BorderStyle, :Version => "1.2"
|
597
|
-
|
598
|
-
def onActivate(action)
|
599
|
-
unless action.is_a?(Action)
|
600
|
-
raise TypeError, "An Action object must be passed."
|
601
|
-
end
|
602
|
-
|
603
|
-
self.A = action
|
604
|
-
end
|
605
|
-
|
606
|
-
class Button < Widget
|
607
|
-
|
608
|
-
module Flags
|
609
|
-
NOTOGGLETOOFF = 1 << 14
|
610
|
-
RADIO = 1 << 15
|
611
|
-
PUSHBUTTON = 1 << 16
|
612
|
-
RADIOSINUNISON = 1 << 26
|
613
|
-
end
|
614
|
-
|
615
|
-
field :FT, :Type => Name, :Default => Field::Type::BUTTON, :Required => true
|
616
|
-
end
|
617
|
-
|
618
|
-
class PushButton < Button
|
619
|
-
|
620
|
-
def pre_build
|
621
|
-
self.Ff ||= 0
|
622
|
-
self.Ff |= Button::Flags::PUSHBUTTON
|
623
|
-
|
624
|
-
super
|
625
|
-
end
|
626
|
-
end
|
627
|
-
|
628
|
-
class CheckBox < Button
|
629
|
-
|
630
|
-
def pre_build
|
631
|
-
self.Ff ||= 0
|
632
|
-
|
633
|
-
self.Ff &= ~Button::Flags::RADIO
|
634
|
-
self.Ff &= ~Button::Flags::PUSHBUTTON
|
635
|
-
|
636
|
-
super
|
637
|
-
end
|
638
|
-
end
|
639
|
-
|
640
|
-
class Radio < Button
|
641
|
-
|
642
|
-
def pre_build
|
643
|
-
self.Ff ||= 0
|
644
|
-
|
645
|
-
self.Ff &= ~Button::Flags::PUSHBUTTON
|
646
|
-
self.Ff |= Button::Flags::RADIO
|
647
|
-
|
648
|
-
super
|
649
|
-
end
|
650
|
-
end
|
651
|
-
|
652
|
-
class Text < Widget
|
653
|
-
module Flags
|
654
|
-
MULTILINE = 1 << 12
|
655
|
-
PASSWORD = 1 << 13
|
656
|
-
FILESELECT = 1 << 20
|
657
|
-
DONOTSPELLCHECK = 1 << 22
|
658
|
-
DONOTSCROLL = 1 << 23
|
659
|
-
COMB = 1 << 24
|
660
|
-
RICHTEXT = 1 << 25
|
661
|
-
end
|
662
|
-
|
663
|
-
field :FT, :Type => Name, :Default => Field::Type::TEXT, :Required => true
|
664
|
-
field :MaxLen, :Type => Integer
|
665
|
-
end
|
666
|
-
|
667
|
-
class Choice < Widget
|
668
|
-
module Flags
|
669
|
-
COMBO = 1 << 17
|
670
|
-
EDIT = 1 << 18
|
671
|
-
SORT = 1 << 19
|
672
|
-
MULTISELECT = 1 << 21
|
673
|
-
DONOTSPELLCHECK = 1 << 22
|
674
|
-
COMMITONSELCHANGE = 1 << 26
|
675
|
-
end
|
676
|
-
|
677
|
-
field :FT, :Type => Name, :Default => Field::Type::CHOICE, :Required => true
|
678
|
-
field :Opt, :Type => Array
|
679
|
-
field :TI, :Type => Integer, :Default => 0
|
680
|
-
field :I, :Type => Array, :Version => "1.4"
|
681
|
-
end
|
682
|
-
|
683
|
-
class ComboBox < Choice
|
684
|
-
|
685
|
-
def pre_build
|
686
|
-
self.Ff ||= 0
|
687
|
-
self.Ff |= Choice::Flags::COMBO
|
688
|
-
|
689
|
-
super
|
690
|
-
end
|
691
|
-
end
|
692
|
-
|
693
|
-
class ListBox < Choice
|
694
|
-
|
695
|
-
def pre_build
|
696
|
-
self.Ff ||= 0
|
697
|
-
self.Ff &= ~Choice::Flags::COMBO
|
698
|
-
|
699
|
-
super
|
700
|
-
end
|
701
|
-
end
|
702
|
-
|
703
|
-
class Signature < Widget
|
704
|
-
field :FT, :Type => Name, :Default => Field::Type::SIGNATURE
|
705
|
-
field :Lock, :Type => SignatureLock, :Version => "1.5"
|
706
|
-
field :SV, :Type => SignatureSeedValue, :Version => "1.5"
|
707
|
-
end
|
689
|
+
super
|
708
690
|
end
|
709
|
-
|
691
|
+
end
|
710
692
|
|
693
|
+
class Signature < Widget
|
694
|
+
field :FT, Type: Name, Default: Field::Type::SIGNATURE
|
695
|
+
field :Lock, Type: SignatureLock, Version: "1.5"
|
696
|
+
field :SV, Type: SignatureSeedValue, Version: "1.5"
|
697
|
+
end
|
698
|
+
end
|
699
|
+
end
|
711
700
|
end
|