| 1 |
%% |
| 2 |
%% This is file `l3pdffield.sty', |
| 3 |
%% generated with the docstrip utility. |
| 4 |
%% |
| 5 |
%% The original source files were: |
| 6 |
%% |
| 7 |
%% l3pdffield.dtx (with options: `package') |
| 8 |
%% l3pdffield-checkbox.dtx (with options: `package') |
| 9 |
%% l3pdffield-radiobutton.dtx (with options: `package') |
| 10 |
%% l3pdffield-textfield.dtx (with options: `package') |
| 11 |
%% l3pdffield-pushbutton.dtx (with options: `package') |
| 12 |
%% l3pdffield-choice.dtx (with options: `package') |
| 13 |
%% l3pdffield-action.dtx (with options: `package') |
| 14 |
%% |
| 15 |
%% Copyright (C) 2019-2026 The LaTeX Project |
| 16 |
%% |
| 17 |
%% It may be distributed and/or modified under the conditions of |
| 18 |
%% the LaTeX Project Public License (LPPL), either version 1.3c of |
| 19 |
%% this license or (at your option) any later version. The latest |
| 20 |
%% version of this license is in the file: |
| 21 |
%% |
| 22 |
%% https://www.latex-project.org/lppl.txt |
| 23 |
%% |
| 24 |
%% This file is part of the "LaTeX PDF management bundle" (The Work in LPPL) |
| 25 |
%% and all files in that bundle must be distributed together. |
| 26 |
%% |
| 27 |
%% File: l3pdffield.dtx |
| 28 |
|
| 29 |
\NeedsTeXFormat{LaTeX2e} |
| 30 |
\ProvidesExplPackage{l3pdffield}{2026-05-26}{0.97c}% |
| 31 |
{form fields} |
| 32 |
\csname HyField@NeedAppearancesfalse\endcsname % suppress NeedAppearances |
| 33 |
\str_new:N \l__pdffield_tmpa_str |
| 34 |
\str_new:N \l__pdffield_tmpb_str |
| 35 |
\tl_new:N \l__pdffield_tmpa_tl |
| 36 |
\tl_new:N \l__pdffield_tmpa_keys_tl |
| 37 |
\tl_new:N \l__pdffield_currentparent_tl |
| 38 |
\tl_new:N \l__pdffield_fieldID_tl |
| 39 |
\tl_new:N \l__pdffield_caption_tl |
| 40 |
\tl_new:N \l__pdffield_rollover_caption_tl |
| 41 |
\tl_new:N \l__pdffield_down_caption_tl |
| 42 |
\prop_new:N \g__pdffield_CO_sortkeys_prop |
| 43 |
\seq_new:N \g__pdffield_CO_sortkeys_seq |
| 44 |
\str_new:N \l__pdffield_CO_sortkey_str |
| 45 |
\tl_new:N \g__pdffield_annot_ref_last_tl |
| 46 |
\bool_new:N \l__pdffield_tag_bool |
| 47 |
\bool_set_true:N \l__pdffield_tag_bool |
| 48 |
\cs_new_protected:Npn \__pdffield_tmpa:n #1 {} |
| 49 |
\cs_new_protected:Npn \__pdffield_tmpa:nn #1 #2 {} |
| 50 |
|
| 51 |
\msg_new:nnn {pdffield}{no-period} |
| 52 |
{ |
| 53 |
The~field~name~'#1'~contains~a~period. \\ |
| 54 |
This~is~not~allowed. |
| 55 |
} |
| 56 |
\msg_new:nnn {pdffield}{empty-name} |
| 57 |
{ |
| 58 |
The~field~name~is~empty. \\ |
| 59 |
This~is~not~allowed. |
| 60 |
} |
| 61 |
\msg_new:nnn {pdffield}{appearance-missing} |
| 62 |
{ |
| 63 |
The~appearance~definition~'#1'~is~missing~for~the~#2~appearance. |
| 64 |
} |
| 65 |
\msg_new:nnn {pdffield}{not-implemented} |
| 66 |
{ |
| 67 |
Support~for~'/#1'~is~not~implemented\\ |
| 68 |
The~key~is~ignored. |
| 69 |
} |
| 70 |
\msg_new:nnn {pdffield}{key-disabled} |
| 71 |
{ |
| 72 |
key~'#2'~is~disabled~and~ignored~in~the~'#1'~command.\\ |
| 73 |
Use~key~'#3'~instead. |
| 74 |
} |
| 75 |
\msg_new:nnn {pdffield}{parent-field-missing} |
| 76 |
{ |
| 77 |
The~parent~field~'#1'~doesn't~exist\\ |
| 78 |
Create~it~with~\tl_to_str:n{\pdffield_field:nn} |
| 79 |
} |
| 80 |
\msg_new:nnn {pdffield}{key-ignored} |
| 81 |
{ |
| 82 |
key~'#1'~has~no~function~and~is~ignored |
| 83 |
} |
| 84 |
|
| 85 |
\cs_new_protected:Npn \__pdffield_key_disable:nnn #1#2#3 |
| 86 |
{ |
| 87 |
\keys_define:nn {pdffield} |
| 88 |
{ |
| 89 |
#2 .code:n = |
| 90 |
{ |
| 91 |
\msg_warning:nnnnn {pdffield}{key-disabled}{#1}{#2}{#3} |
| 92 |
} |
| 93 |
} |
| 94 |
} |
| 95 |
\bitset_new:Nn \l__pdffield_Ff_bitset |
| 96 |
{ |
| 97 |
ReadOnly = 1, |
| 98 |
Required = 2, |
| 99 |
NoExport = 3, |
| 100 |
Multiline = 13,%Tx |
| 101 |
Password = 14, |
| 102 |
NoToggleToOff = 15,%Btn, radio button |
| 103 |
Radio = 16,%Btn: Radio: 16=1, 17=0 |
| 104 |
Pushbutton = 17,%Btn: Checkbox: 16=0, 17=0 |
| 105 |
%Btn: Pushbutton: 17=1 |
| 106 |
Combo = 18,%Ch: Combo=1 List=0 |
| 107 |
Edit = 19,%Ch, Combo=1 -> + edit field |
| 108 |
Sort = 20,%Ch, not relevant for view... |
| 109 |
FileSelect = 21,%Tx |
| 110 |
MultiSelect = 22,%Ch |
| 111 |
DoNotSpellCheck = 23,%Tx, Ch (if Combo + Edit set) |
| 112 |
DoNotScroll = 24,%Tx |
| 113 |
Comb = 25,%Tx, requires MaxLen in dict |
| 114 |
RadiosInUnison = 26,%Btn Radio |
| 115 |
RichText = 26,%Tx |
| 116 |
CommitOnSelChange = 27, |
| 117 |
readonly = 1, |
| 118 |
required = 2, |
| 119 |
noexport = 3, |
| 120 |
multiline = 13,%Tx |
| 121 |
password = 14, |
| 122 |
notoggletooff = 15,%Btn, radio button |
| 123 |
radio = 16,%Btn: Radio: 15=1, 16=0 |
| 124 |
pushbutton = 17,%Btn: Checkbox: 15=0, 16=0 |
| 125 |
%Btn: Pushbutton: 16=1 |
| 126 |
combo = 18,%Ch: Combo=1 List=0 |
| 127 |
edit = 19,%Ch, Combo=1 -> + edit field |
| 128 |
sort = 20,%Ch, not relevant for view... |
| 129 |
fileselect = 21,%Tx |
| 130 |
multiselect = 22,%Ch |
| 131 |
donotspellcheck = 23,%Tx, Ch (if Combo + Edit set) |
| 132 |
donotscroll = 24,%Tx |
| 133 |
comb = 25,%Tx, requires MaxLen in dict |
| 134 |
radiosinunison = 26,%Btn Radio |
| 135 |
richtext = 26,%Tx |
| 136 |
commitonselchange = 27 |
| 137 |
} |
| 138 |
|
| 139 |
\bitset_new:Nn \l__pdffield_F_bitset |
| 140 |
{ |
| 141 |
Invisible = 1, |
| 142 |
Hidden = 2, |
| 143 |
Print = 3, |
| 144 |
NoZoom = 4, |
| 145 |
NoRotate = 5, |
| 146 |
NoView = 6, |
| 147 |
ReadOnly = 7, |
| 148 |
Locked = 8, |
| 149 |
ToggleNoView = 9, |
| 150 |
LockedContents = 10, |
| 151 |
invisible = 1, |
| 152 |
hidden = 2, |
| 153 |
print = 3, |
| 154 |
nozoom = 4, |
| 155 |
norotate = 5, |
| 156 |
noview = 6, |
| 157 |
readonly = 7, |
| 158 |
locked = 8, |
| 159 |
togglenoview = 9, |
| 160 |
lockedcontents = 10 |
| 161 |
} |
| 162 |
\pdfdict_new:n {l__pdffield/field} |
| 163 |
\pdfdict_new:n {l__pdffield/field/AA} |
| 164 |
\cs_new_protected:Npn \__pdffield_field:n #1 |
| 165 |
{ |
| 166 |
\pdf_object_new:n {__pdffield/field/#1} |
| 167 |
\pdf_object_new:n {__pdffield/field/Kids/#1} |
| 168 |
\tl_if_empty:NTF \l__pdffield_currentparent_tl |
| 169 |
{ |
| 170 |
\pdfmanagement_add:nne |
| 171 |
{ Catalog / AcroForm } |
| 172 |
{ Fields } |
| 173 |
{\pdf_object_ref:n {__pdffield/field/#1} } |
| 174 |
} |
| 175 |
{ |
| 176 |
\exp_args:Ne |
| 177 |
\pdf_object_if_exist:nTF {__pdffield/field/\l__pdffield_currentparent_tl} |
| 178 |
{ |
| 179 |
\pdfdict_put:nne { l__pdffield/field }{Parent} |
| 180 |
{\exp_args:Ne \pdf_object_ref:n{__pdffield/field/\l__pdffield_currentparent_tl}} |
| 181 |
\seq_gput_right:ce {g__pdffield_field/Kids/\l__pdffield_currentparent_tl _seq} |
| 182 |
{ \exp_args:Ne \pdf_object_ref:n{__pdffield/field/#1}} |
| 183 |
} |
| 184 |
{ |
| 185 |
\msg_error:nne {pdffield}{parent-field-missing}{\l__pdffield_currentparent_tl} |
| 186 |
} |
| 187 |
} |
| 188 |
\seq_new:c {g__pdffield_field/Kids/#1_seq} |
| 189 |
\pdfdict_put:nne {l__pdffield/field} |
| 190 |
{Kids} |
| 191 |
{ |
| 192 |
\pdf_object_ref:n {__pdffield/field/Kids/#1} |
| 193 |
} |
| 194 |
\pdfdict_put:nne {l__pdffield/field} |
| 195 |
{Ff} |
| 196 |
{\bitset_to_arabic:N \l__pdffield_Ff_bitset } |
| 197 |
\pdfdict_if_empty:nF{l__pdffield/field/AA} |
| 198 |
{ |
| 199 |
\pdfmeta_standard_verify:nT |
| 200 |
{annot_widget_no_AA} |
| 201 |
{ |
| 202 |
\pdf_object_unnamed_write:ne {dict}{\pdfdict_use:n {l__pdffield/field/AA}} |
| 203 |
\pdfdict_put:nne |
| 204 |
{l__pdffield/field} |
| 205 |
{AA} |
| 206 |
{\pdf_object_ref_last:} |
| 207 |
\pdfdict_get:nnN {l__pdffield/field/AA}{C}\l__pdffield_tmpa_tl |
| 208 |
\quark_if_no_value:NF \l__pdffield_tmpa_tl |
| 209 |
{ |
| 210 |
\prop_gput:Nee\g__pdffield_CO_sortkeys_prop |
| 211 |
{ \pdf_object_ref:n {__pdffield/field/#1} }{ \l__pdffield_CO_sortkey_str } |
| 212 |
\seq_gput_right:Ne\g__pdffield_CO_sortkeys_seq |
| 213 |
{ \pdf_object_ref:n {__pdffield/field/#1} } |
| 214 |
} |
| 215 |
} |
| 216 |
} |
| 217 |
\hook_gput_code:nnn {shipout/lastpage}{pdffield} %xetex needs this ... |
| 218 |
{ |
| 219 |
\pdf_object_write:nne {__pdffield/field/Kids/#1} { array } |
| 220 |
{ |
| 221 |
\seq_use:cn{g__pdffield_field/Kids/#1_seq}{~} |
| 222 |
} |
| 223 |
} |
| 224 |
\pdf_object_write:nne {__pdffield/field/#1} { dict } { \pdfdict_use:n {l__pdffield/field} } |
| 225 |
} |
| 226 |
|
| 227 |
\hook_gput_code:nnn {shipout/lastpage}{pdffield} |
| 228 |
{ |
| 229 |
\prop_if_empty:NF \g__pdffield_CO_sortkeys_prop |
| 230 |
{ |
| 231 |
\seq_gsort:Nn \g__pdffield_CO_sortkeys_seq |
| 232 |
{ |
| 233 |
\str_compare:eNeTF |
| 234 |
{ \prop_item:Nn \g__pdffield_CO_sortkeys_prop {#1} } |
| 235 |
> |
| 236 |
{ \prop_item:Nn \g__pdffield_CO_sortkeys_prop {#2} } |
| 237 |
{ \sort_return_swapped: } |
| 238 |
{ \sort_return_same: } |
| 239 |
} |
| 240 |
\pdfmanagement_add:nne |
| 241 |
{ Catalog / AcroForm } |
| 242 |
{ CO } |
| 243 |
{ \seq_use:Nn \g__pdffield_CO_sortkeys_seq{~} } |
| 244 |
} |
| 245 |
} |
| 246 |
|
| 247 |
\cs_new_protected:Npn \pdffield_field:nn #1 #2 |
| 248 |
{ |
| 249 |
\group_begin: |
| 250 |
\keys_set:nn { pdffield } {#1} |
| 251 |
\__pdffield_field:n {#2} |
| 252 |
\group_end: |
| 253 |
} |
| 254 |
\cs_new_protected:Npn \__pdffield_annot: |
| 255 |
{ |
| 256 |
\pdfmeta_standard_verify:nF |
| 257 |
{annot_flags} |
| 258 |
{ |
| 259 |
\bitset_set_true:Nn \l__pdffield_F_bitset {Print} |
| 260 |
\bitset_set_false:Nn \l__pdffield_F_bitset {Hidden} |
| 261 |
\bitset_set_false:Nn \l__pdffield_F_bitset {Invisible} |
| 262 |
\bitset_set_false:Nn \l__pdffield_F_bitset {NoView} |
| 263 |
} |
| 264 |
\pdfannot_dict_put:nne {widget}{F}{ \bitset_to_arabic:N \l__pdffield_F_bitset } |
| 265 |
\__pdffield_tag_add_struct_parent: |
| 266 |
\tl_if_empty:NF \l__pdffield_currentparent_tl |
| 267 |
{ |
| 268 |
\exp_args:Ne |
| 269 |
\pdf_object_if_exist:nTF { __pdffield/field/\l__pdffield_currentparent_tl } |
| 270 |
{ |
| 271 |
\pdfannot_dict_put:nne {widget}{Parent} |
| 272 |
{ |
| 273 |
\exp_args:Ne |
| 274 |
\pdf_object_ref:n{__pdffield/field/\l__pdffield_currentparent_tl} |
| 275 |
} |
| 276 |
} |
| 277 |
{ |
| 278 |
\msg_error:nne { pdffield }{parent-field-missing}{\l__pdffield_currentparent_tl} |
| 279 |
} |
| 280 |
} |
| 281 |
\mode_leave_vertical: |
| 282 |
\__pdffield_tag_struct_begin: |
| 283 |
\hbox_to_wd:nn |
| 284 |
{ \l__pdffield_annot_wd_dim } |
| 285 |
{ |
| 286 |
\rule [-\l__pdffield_annot_dp_dim]{0pt}{\dim_eval:n{\l__pdffield_annot_ht_dim+\l__pdffield_annot_dp_dim} } |
| 287 |
\pdfannot_widget_box:nnn |
| 288 |
{ \l__pdffield_annot_wd_dim } |
| 289 |
{ \l__pdffield_annot_ht_dim } |
| 290 |
{ \l__pdffield_annot_dp_dim } |
| 291 |
\hfill |
| 292 |
} |
| 293 |
\tl_gset:Ne \g__pdffield_annot_ref_last_tl { \pdfannot_box_ref_last: } |
| 294 |
\exp_args:NV \__pdffield_tag_add_objr:n \g__pdffield_annot_ref_last_tl |
| 295 |
\__pdffield_tag_struct_end: |
| 296 |
\tl_if_empty:NF \l__pdffield_currentparent_tl |
| 297 |
{ |
| 298 |
\seq_if_exist:cTF {g__pdffield_field/Kids/\l__pdffield_currentparent_tl _seq} |
| 299 |
{ |
| 300 |
\seq_gput_right:ce |
| 301 |
{g__pdffield_field/Kids/\l__pdffield_currentparent_tl _seq} |
| 302 |
{ \g__pdffield_annot_ref_last_tl } |
| 303 |
} |
| 304 |
{ |
| 305 |
\msg_error:nne { pdffield}{parent-field-missing}{\l__pdffield_currentparent_tl} |
| 306 |
} |
| 307 |
} |
| 308 |
} |
| 309 |
\cs_new_protected:Npn \pdffield_annot:n #1 |
| 310 |
{ |
| 311 |
\group_begin: |
| 312 |
\keys_set:nn { pdffield } {#1} |
| 313 |
\__pdffield_annot: |
| 314 |
\group_end: |
| 315 |
} |
| 316 |
\cs_new:Npn \pdffield_annot_ref_last: { \g__pdffield_annot_ref_last_tl } |
| 317 |
\cs_new_protected:Npn \__pdffield_tag_add_struct_parent: {} |
| 318 |
\cs_new_protected:Npn \__pdffield_tag_add_objr:n #1 {} |
| 319 |
\cs_new_protected:Npn \__pdffield_tag_struct_begin: {} |
| 320 |
\cs_new_protected:Npn \__pdffield_tag_struct_end: {} |
| 321 |
\hook_gput_code:nnn {begindocument} { l3pdffield } |
| 322 |
{ |
| 323 |
\cs_if_exist:NT \tag_if_active:T |
| 324 |
{ |
| 325 |
\tag_if_active:T |
| 326 |
{ |
| 327 |
\cs_set_protected:Npn \__pdffield_tag_add_struct_parent: |
| 328 |
{ |
| 329 |
\bool_if:NT \l__pdffield_tag_bool |
| 330 |
{ |
| 331 |
\pdfannot_dict_put:nne {widget}{StructParent}{ \tag_struct_parent_int: } |
| 332 |
} |
| 333 |
} |
| 334 |
\cs_set_protected:Npn \__pdffield_tag_add_objr:n #1 |
| 335 |
{ |
| 336 |
\bool_if:NT \l__pdffield_tag_bool |
| 337 |
{ |
| 338 |
\exp_args:Nne |
| 339 |
\tag_struct_insert_annot:nn {#1}{ \tag_struct_parent_int: } |
| 340 |
} |
| 341 |
} |
| 342 |
\cs_set_protected:Npn \__pdffield_tag_struct_begin: |
| 343 |
{ |
| 344 |
\bool_if:NT \l__pdffield_tag_bool |
| 345 |
{ |
| 346 |
\tag_mc_end_push: |
| 347 |
\tag_struct_begin:n{tag=Form} |
| 348 |
} |
| 349 |
} |
| 350 |
\cs_set_protected:Npn \__pdffield_tag_struct_end: |
| 351 |
{ |
| 352 |
\bool_if:NT \l__pdffield_tag_bool |
| 353 |
{ |
| 354 |
\tag_struct_end: |
| 355 |
\tag_mc_begin_pop:n{} |
| 356 |
} |
| 357 |
} |
| 358 |
} |
| 359 |
} |
| 360 |
} |
| 361 |
\cs_new_protected:Npn \__pdffield_color_set:nn #1 #2 |
| 362 |
{ |
| 363 |
\tl_if_head_eq_charcode:nNTF {#2}[ %] |
| 364 |
{ |
| 365 |
\__pdffield_color_set_aux:nwn { #1 } #2 |
| 366 |
} |
| 367 |
{ |
| 368 |
\color_set:nn {#1} {#2} |
| 369 |
} |
| 370 |
} |
| 371 |
|
| 372 |
\cs_new_protected:Npn \__pdffield_color_set_aux:nwn #1 [#2] #3 |
| 373 |
{ |
| 374 |
\color_set:nnn {#1}{#2}{#3} |
| 375 |
} |
| 376 |
|
| 377 |
\cs_new_protected:Npn \__pdffield_V_handler:nN #1#2 |
| 378 |
{ |
| 379 |
\tl_set:Nn #2 {#1} |
| 380 |
} |
| 381 |
\keys_define:nn { pdffield } |
| 382 |
{ |
| 383 |
,parent .tl_set:N = \l__pdffield_currentparent_tl |
| 384 |
,parent .groups:n = {field,annot} |
| 385 |
,T .code:n = |
| 386 |
{ |
| 387 |
\pdf_string_from_unicode:nnN {utf8/string-raw}{#1}\l__pdffield_tmpa_str |
| 388 |
\str_if_in:NnT \l__pdffield_tmpa_str {.} |
| 389 |
{ |
| 390 |
\msg_error:nne {pdffield}{no-period}{\l__pdffield_tmpa_str} |
| 391 |
} |
| 392 |
\str_if_empty:NTF\l__pdffield_tmpa_str |
| 393 |
{ |
| 394 |
\msg_warning:nn {pdffield}{empty-name} |
| 395 |
\pdfdict_remove:nn { l__pdffield/field }{T} |
| 396 |
} |
| 397 |
{ |
| 398 |
\pdfdict_put:nne { l__pdffield/field }{T}{(\l__pdffield_tmpa_str)} |
| 399 |
} |
| 400 |
} |
| 401 |
,T .value_required:n = true |
| 402 |
,T .groups:n = {field} |
| 403 |
,name .meta:n = {T={#1}} |
| 404 |
,name .value_required:n = true |
| 405 |
,name .groups:n = {field} |
| 406 |
,TU .groups:n = {field} |
| 407 |
,TU .code:n = |
| 408 |
{ |
| 409 |
\tl_if_empty:nTF {#1} |
| 410 |
{ |
| 411 |
\pdfdict_remove:nn { l__pdffield/field }{TU} |
| 412 |
} |
| 413 |
{ |
| 414 |
\pdf_string_from_unicode:nnN {utf16/hex}{#1}\l__pdffield_tmpa_str |
| 415 |
\pdfdict_put:nne { l__pdffield/field }{TU}{\l__pdffield_tmpa_str} |
| 416 |
} |
| 417 |
} |
| 418 |
,TU .groups:n = {field} |
| 419 |
,altname .meta:n = {TU={#1}} |
| 420 |
,altname .groups:n = {field} |
| 421 |
,TM .code:n = |
| 422 |
{ |
| 423 |
\tl_if_empty:nTF {#1} |
| 424 |
{ |
| 425 |
\pdfdict_remove:nn { l__pdffield/field }{TM} |
| 426 |
} |
| 427 |
{ |
| 428 |
\pdf_string_from_unicode:nnN {utf16/hex}{#1}\l__pdffield_tmpa_str |
| 429 |
\pdfdict_put:nne { l__pdffield/field }{TM}{\l__pdffield_tmpa_str} |
| 430 |
} |
| 431 |
} |
| 432 |
,TM .groups:n = {field} |
| 433 |
,mappingname .meta:n = {TM={#1}} |
| 434 |
,mappingname .groups:n = {field} |
| 435 |
} |
| 436 |
\keys_define:nn { pdffield } |
| 437 |
{ |
| 438 |
fieldID .tl_set:N = \l__pdffield_fieldID_tl |
| 439 |
} |
| 440 |
\keys_define:nn{pdffield} |
| 441 |
{ |
| 442 |
,FT .choices:nn = |
| 443 |
{ Btn, Tx, Ch, Sig } |
| 444 |
{ |
| 445 |
\pdfdict_put:nnn { l__pdffield/field }{FT}{ /#1 } |
| 446 |
} |
| 447 |
,FT .groups:n = {field} |
| 448 |
,V .code:n = |
| 449 |
{ |
| 450 |
\tl_if_empty:nTF {#1} |
| 451 |
{ |
| 452 |
\pdfdict_remove:nn { l__pdffield/field }{V} |
| 453 |
} |
| 454 |
{ |
| 455 |
\__pdffield_V_handler:nN{#1}\l__pdffield_tmpa_str |
| 456 |
\pdfdict_put:nne { l__pdffield/field }{V}{ \l__pdffield_tmpa_str } |
| 457 |
} |
| 458 |
} |
| 459 |
,V .groups:n = {field} |
| 460 |
,DV .code:n = |
| 461 |
{ |
| 462 |
\tl_if_empty:nTF {#1} |
| 463 |
{ |
| 464 |
\pdfdict_remove:nn { l__pdffield/field }{DV} |
| 465 |
} |
| 466 |
{ |
| 467 |
\__pdffield_V_handler:nN{#1}\l__pdffield_tmpa_str |
| 468 |
\pdfdict_put:nne { l__pdffield/field }{DV}{ \l__pdffield_tmpa_str } |
| 469 |
} |
| 470 |
} |
| 471 |
,DV .groups:n = {field} |
| 472 |
,MaxLen .code:n = |
| 473 |
{ |
| 474 |
\tl_if_empty:nTF {#1} |
| 475 |
{ |
| 476 |
\pdfdict_remove:nn { l__pdffield/field }{MaxLen} |
| 477 |
} |
| 478 |
{ |
| 479 |
\pdfdict_put:nne { l__pdffield/field }{MaxLen}{ #1 } |
| 480 |
} |
| 481 |
} |
| 482 |
,MaxLen .groups:n = {field} |
| 483 |
,Lock .code:n = |
| 484 |
{ |
| 485 |
\tl_if_empty:nTF {#1} |
| 486 |
{ |
| 487 |
\pdfdict_remove:nn { l__pdffield/field }{Lock} |
| 488 |
} |
| 489 |
{ |
| 490 |
\pdfdict_put:nne { l__pdffield/field }{Lock}{ \pdf_object_ref:n{#1} } |
| 491 |
} |
| 492 |
} |
| 493 |
,Lock .groups:n = {field} |
| 494 |
,SV .code:n = |
| 495 |
{ |
| 496 |
\tl_if_empty:nTF {#1} |
| 497 |
{ |
| 498 |
\pdfdict_remove:nn { l__pdffield/field }{SV} |
| 499 |
} |
| 500 |
{ |
| 501 |
\pdfdict_put:nne { l__pdffield/field }{SV}{ \pdf_object_ref:n{#1} } |
| 502 |
} |
| 503 |
} |
| 504 |
,SV .groups:n = {field} |
| 505 |
,Opt .code:n = |
| 506 |
{ |
| 507 |
\tl_if_empty:nTF {#1} |
| 508 |
{ |
| 509 |
\pdfdict_remove:nn { l__pdffield/field }{Opt} |
| 510 |
} |
| 511 |
{ |
| 512 |
\pdfdict_put:nne { l__pdffield/field }{Opt}{ \pdf_object_ref:n{#1} } |
| 513 |
} |
| 514 |
} |
| 515 |
,Opt .groups:n = {field} |
| 516 |
,TI .code:n = |
| 517 |
{ |
| 518 |
\tl_if_empty:nTF {#1} |
| 519 |
{ |
| 520 |
\pdfdict_remove:nn { l__pdffield/field }{TI} |
| 521 |
} |
| 522 |
{ |
| 523 |
\pdfdict_put:nne { l__pdffield/field }{TI}{ #1 } |
| 524 |
} |
| 525 |
} |
| 526 |
,TI .groups:n = {field} |
| 527 |
,I .code:n = |
| 528 |
{ |
| 529 |
\tl_if_empty:nTF {#1} |
| 530 |
{ |
| 531 |
\pdfdict_remove:nn { l__pdffield/field }{I} |
| 532 |
} |
| 533 |
{ |
| 534 |
\pdfdict_put:nne { l__pdffield/field }{I}{ \pdf_object_ref:n{#1} } |
| 535 |
} |
| 536 |
} |
| 537 |
,I .groups:n = {field} |
| 538 |
} |
| 539 |
\keys_define:nn { pdffield } |
| 540 |
{ |
| 541 |
,setFf .code:n = |
| 542 |
{ |
| 543 |
\clist_map_inline:nn {#1} |
| 544 |
{ |
| 545 |
\bitset_set_true:Nn \l__pdffield_Ff_bitset {##1} |
| 546 |
} |
| 547 |
} |
| 548 |
,setFf .groups:n = {field} |
| 549 |
,setfieldflags .meta:n = |
| 550 |
{setFf={#1}} |
| 551 |
,setfieldflags .groups:n = {field} |
| 552 |
,unsetFf .multichoice: |
| 553 |
,unsetFf / all .code:n = { \bitset_clear:N \l__pdffield_Ff_bitset} |
| 554 |
,unsetFf / unknown .code:n = |
| 555 |
{ |
| 556 |
\bitset_set_false:Nn \l__pdffield_Ff_bitset {#1} |
| 557 |
} |
| 558 |
,unsetFf .groups:n = {field} |
| 559 |
,unsetfieldflags .meta:n = {unsetFf={#1}} |
| 560 |
,unsetfieldflags .groups:n = {field} |
| 561 |
} |
| 562 |
|
| 563 |
\cs_set_protected:Npn \__pdffield_tmpa:n #1 % |
| 564 |
{ |
| 565 |
\keys_define:nn { pdffield } |
| 566 |
{ |
| 567 |
AA/#1 .code:n = |
| 568 |
{ |
| 569 |
\tl_if_empty:nTF {#1} |
| 570 |
{ |
| 571 |
\pdfdict_remove:nn {l__pdffield/field/AA}{#1} |
| 572 |
} |
| 573 |
{ |
| 574 |
\pdfdict_put:nne {l__pdffield/field/AA} |
| 575 |
{#1} |
| 576 |
{<</S/JavaScript/JS\c_space_tl ##1>>} |
| 577 |
} |
| 578 |
}, |
| 579 |
AA/#1 .groups:n = {field} |
| 580 |
} |
| 581 |
} |
| 582 |
|
| 583 |
\clist_map_inline:nn {K,F,V,C}{\__pdffield_tmpa:n{#1}} |
| 584 |
|
| 585 |
\cs_set_protected:Npn \__pdffield_tmpa:nn #1 #2 |
| 586 |
{ |
| 587 |
\keys_define:nn { pdffield } |
| 588 |
{ |
| 589 |
#1 .meta:nn = |
| 590 |
{ pdffield }{AA/#2={##1}}, |
| 591 |
#1 .groups:n = {field} |
| 592 |
} |
| 593 |
} |
| 594 |
\__pdffield_tmpa:nn {keystroke}{K} |
| 595 |
\__pdffield_tmpa:nn {format} {F} |
| 596 |
\__pdffield_tmpa:nn {validate} {V} |
| 597 |
\__pdffield_tmpa:nn {calculate}{C} |
| 598 |
|
| 599 |
\keys_define:nn {pdffield} |
| 600 |
{ |
| 601 |
sortkey .code:n = {\str_set:Ne \l__pdffield_CO_sortkey_str {\tl_to_str:n{#1}}} |
| 602 |
} |
| 603 |
\keys_define:nn { pdffield } |
| 604 |
{ |
| 605 |
DA .code:n = |
| 606 |
{ |
| 607 |
\tl_if_empty:nTF {#1} |
| 608 |
{ |
| 609 |
\pdfdict_remove:nn { l__pdffield/field }{DA} |
| 610 |
} |
| 611 |
{ |
| 612 |
\pdfdict_put:nne { l__pdffield/field }{DA}{ (#1) } |
| 613 |
} |
| 614 |
} |
| 615 |
,DA .groups:n = {field} |
| 616 |
,Q .choices:nn = {left,center,right} |
| 617 |
{ |
| 618 |
\pdfdict_put:nne { l__pdffield/field }{Q}{ \int_eval:n{\l_keys_choice_int-1} } |
| 619 |
} |
| 620 |
,Q / .code:n = { \pdfdict_remove:nn { l__pdffield/field }{Q} } |
| 621 |
,Q .groups:n = {field} |
| 622 |
,align .meta:n={Q=#1} |
| 623 |
,DS .code:n = |
| 624 |
{ |
| 625 |
\msg_warning:nnn {pdffield}{not-implemented}{DS} |
| 626 |
} |
| 627 |
,DS .groups:n = {field} |
| 628 |
,RV .code:n = |
| 629 |
{ |
| 630 |
\msg_warning:nnn {pdffield}{not-implemented}{RV} |
| 631 |
} |
| 632 |
,RV .groups:n = {field} |
| 633 |
} |
| 634 |
\dim_new:N \l__pdffield_annot_ht_dim |
| 635 |
\dim_new:N \l__pdffield_annot_wd_dim |
| 636 |
\dim_new:N \l__pdffield_annot_dp_dim |
| 637 |
\keys_define:nn { pdffield } |
| 638 |
{ |
| 639 |
,width .dim_set:N = \l__pdffield_annot_wd_dim |
| 640 |
,height .dim_set:N = \l__pdffield_annot_ht_dim |
| 641 |
,depth .dim_set:N = \l__pdffield_annot_dp_dim |
| 642 |
,width .initial:n = 0pt |
| 643 |
,height .initial:n = 0pt |
| 644 |
,depth .initial:n = 0pt |
| 645 |
} |
| 646 |
\keys_define:nn { pdffield } |
| 647 |
{ |
| 648 |
,tag .bool_set:N = \l__pdffield_tag_bool |
| 649 |
} |
| 650 |
\cs_new_protected:Npn \__pdffield_appearance_handler:nnn #1#2#3 |
| 651 |
{ |
| 652 |
\pdfxform_if_exist:nTF { #1 } |
| 653 |
{ |
| 654 |
\pdfannot_dict_put:nne {widget/AP}{#2} |
| 655 |
{ |
| 656 |
\pdfxform_ref:n {#1} |
| 657 |
} |
| 658 |
} |
| 659 |
{ |
| 660 |
\msg_error:nnnn{pdffield}{appearance-missing}{#1}{#3} |
| 661 |
} |
| 662 |
} |
| 663 |
\keys_define:nn { pdffield } |
| 664 |
{ |
| 665 |
%parent is defined in field |
| 666 |
,AS .code:n = |
| 667 |
{ |
| 668 |
\tl_if_empty:nTF {#1} |
| 669 |
{ |
| 670 |
\pdfannot_dict_remove:nn { widget }{AS} |
| 671 |
} |
| 672 |
{ |
| 673 |
\pdfannot_dict_put:nne {widget}{AS}{\pdf_name_from_unicode_e:n{#1}} |
| 674 |
} |
| 675 |
} |
| 676 |
,AS .groups:n = annot |
| 677 |
} |
| 678 |
\keys_define:nn { pdffield } |
| 679 |
{ |
| 680 |
AP/N .code:n = |
| 681 |
{ |
| 682 |
\tl_if_empty:nTF {#1} |
| 683 |
{ |
| 684 |
\pdfannot_dict_remove:nn { widget/AP }{N} |
| 685 |
} |
| 686 |
{ |
| 687 |
\__pdffield_appearance_handler:nnn {#1}{N}{normal} |
| 688 |
} |
| 689 |
} |
| 690 |
,AP/N .groups:n = annot |
| 691 |
,appearance .meta:n = {AP/N={#1}} |
| 692 |
,appearance .groups:n = annot |
| 693 |
} |
| 694 |
\keys_define:nn { pdffield } |
| 695 |
{ |
| 696 |
AP/R .code:n = |
| 697 |
{ |
| 698 |
\tl_if_empty:nTF {#1} |
| 699 |
{ |
| 700 |
\pdfannot_dict_remove:nn { widget/AP }{R} |
| 701 |
} |
| 702 |
{ |
| 703 |
\__pdffield_appearance_handler:nnn {#1}{R}{rollover} |
| 704 |
} |
| 705 |
} |
| 706 |
,AP/R .groups:n = annot |
| 707 |
,rollover-appearance .meta:n = {AP/R={#1}} |
| 708 |
,rollover-appearance .groups:n = annot |
| 709 |
} |
| 710 |
\keys_define:nn { pdffield } |
| 711 |
{ |
| 712 |
AP/D .code:n = |
| 713 |
{ |
| 714 |
\tl_if_empty:nTF {#1} |
| 715 |
{ |
| 716 |
\pdfannot_dict_remove:nn { widget/AP }{D} |
| 717 |
} |
| 718 |
{ |
| 719 |
\__pdffield_appearance_handler:nnn {#1}{D}{down} |
| 720 |
} |
| 721 |
} |
| 722 |
,AP/D .groups:n = annot |
| 723 |
,down-appearance .meta:n = {AP/D={#1}} |
| 724 |
,down-appearance .groups:n = annot |
| 725 |
} |
| 726 |
\keys_define:nn { pdffield } |
| 727 |
{ |
| 728 |
MK/R .choices:nn = {0,90,180,270} |
| 729 |
{ |
| 730 |
\pdfannot_dict_put:nne {widget/MK}{R}{#1} |
| 731 |
} |
| 732 |
,MK/R / .code:n = |
| 733 |
{ |
| 734 |
\pdfannot_dict_remove:nn { widget/MK }{R} |
| 735 |
} |
| 736 |
,MK/R .groups:n = annot |
| 737 |
,rotate .meta:n = {MK/R=#1} |
| 738 |
} |
| 739 |
|
| 740 |
\keys_define:nn { pdffield } |
| 741 |
{ |
| 742 |
MK/BC .code:n = |
| 743 |
{ |
| 744 |
\tl_if_empty:nTF {#1} |
| 745 |
{ |
| 746 |
\pdfannot_dict_remove:nn { widget/MK }{BC} |
| 747 |
} |
| 748 |
{ |
| 749 |
\__pdffield_color_set:nn {__pdffield/tmp}{#1} |
| 750 |
\color_export:nnN{__pdffield/tmp}{space-sep-rgb}\l__pdffield_tmpa_tl |
| 751 |
\pdfannot_dict_put:nne {widget/MK}{BC}{[\l__pdffield_tmpa_tl]} |
| 752 |
} |
| 753 |
} |
| 754 |
,MK/BC .groups:n = annot |
| 755 |
,bordercolor .meta:n = {MK/BC=#1} |
| 756 |
} |
| 757 |
|
| 758 |
\keys_define:nn { pdffield } |
| 759 |
{ |
| 760 |
MK/BG .code:n = |
| 761 |
{ |
| 762 |
\tl_if_empty:nTF {#1} |
| 763 |
{ |
| 764 |
\pdfannot_dict_remove:nn { widget/MK }{BG} |
| 765 |
} |
| 766 |
{ |
| 767 |
\__pdffield_color_set:nn {__pdffield/tmp}{#1} |
| 768 |
\color_export:nnN{__pdffield/tmp}{space-sep-rgb}\l__pdffield_tmpa_tl |
| 769 |
\pdfannot_dict_put:nne {widget/MK}{BG}{[\l__pdffield_tmpa_tl]} |
| 770 |
} |
| 771 |
} |
| 772 |
,MK/BG .groups:n = annot |
| 773 |
,backgroundcolor .meta:n = {MK/BG=#1} |
| 774 |
} |
| 775 |
|
| 776 |
\keys_define:nn { pdffield } |
| 777 |
{ |
| 778 |
MK/CA .code:n = |
| 779 |
{ |
| 780 |
\tl_set:Nn \l__pdffield_caption_tl {#1} |
| 781 |
\tl_if_empty:nTF {#1} |
| 782 |
{ |
| 783 |
\pdfannot_dict_remove:nn { widget/MK }{CA} |
| 784 |
} |
| 785 |
{ |
| 786 |
\pdf_string_from_unicode:nnN {utf8/string}{#1}\l__pdffield_tmpa_str |
| 787 |
\pdfannot_dict_put:nne {widget/MK}{CA}{\l__pdffield_tmpa_str} |
| 788 |
} |
| 789 |
} |
| 790 |
,MK/CA .groups:n = annot |
| 791 |
,caption .meta:n = {MK/CA=#1} |
| 792 |
} |
| 793 |
|
| 794 |
\keys_define:nn { pdffield } |
| 795 |
{ |
| 796 |
MK/RC .code:n = |
| 797 |
{ |
| 798 |
\tl_set:Nn \l__pdffield_rollover_caption_tl {#1} |
| 799 |
\tl_if_empty:nTF {#1} |
| 800 |
{ |
| 801 |
\pdfannot_dict_remove:nn { widget/MK }{RC} |
| 802 |
} |
| 803 |
{ |
| 804 |
\pdf_string_from_unicode:nnN {utf8/string}{#1}\l__pdffield_tmpa_str |
| 805 |
\pdfannot_dict_put:nne {widget/MK}{RC}{\l__pdffield_tmpa_str} |
| 806 |
} |
| 807 |
} |
| 808 |
,MK/RC .groups:n = annot |
| 809 |
,rollover-caption .meta:n = {MK/RC=#1} |
| 810 |
} |
| 811 |
|
| 812 |
\keys_define:nn { pdffield } |
| 813 |
{ |
| 814 |
MK/AC .code:n = |
| 815 |
{ |
| 816 |
\tl_set:Nn \l__pdffield_down_caption_tl {#1} |
| 817 |
\tl_if_empty:nTF {#1} |
| 818 |
{ |
| 819 |
\pdfannot_dict_remove:nn { widget/MK }{AC} |
| 820 |
} |
| 821 |
{ |
| 822 |
\pdf_string_from_unicode:nnN {utf8/string}{#1}\l__pdffield_tmpa_str |
| 823 |
\pdfannot_dict_put:nne {widget/MK}{AC}{\l__pdffield_tmpa_str} |
| 824 |
} |
| 825 |
} |
| 826 |
,MK/AC .groups:n = annot |
| 827 |
,down-caption .meta:n = {MK/AC=#1} |
| 828 |
} |
| 829 |
|
| 830 |
\cs_set_protected:Npn \__pdffield_tmpa:n #1 |
| 831 |
{ |
| 832 |
\keys_define:nn { pdffield } |
| 833 |
{ |
| 834 |
MK/#1 .code:n = |
| 835 |
{ |
| 836 |
\tl_if_empty:nTF {##1} |
| 837 |
{ |
| 838 |
\pdfannot_dict_remove:nn { widget/MK }{#1} |
| 839 |
} |
| 840 |
{ |
| 841 |
\pdfannot_dict_put:nne {widget/MK}{#1}{##1} |
| 842 |
} |
| 843 |
} |
| 844 |
,MK/#1 .groups:n = annot |
| 845 |
} |
| 846 |
} |
| 847 |
|
| 848 |
\clist_map_inline:nn {I,RI,IX,IF,TP} |
| 849 |
{ \__pdffield_tmpa:n {#1} } |
| 850 |
\keys_define:nn { pdffield } |
| 851 |
{ |
| 852 |
,setF .code:n = |
| 853 |
{ |
| 854 |
\clist_map_inline:nn {#1} |
| 855 |
{ |
| 856 |
\bitset_set_true:Nn \l__pdffield_F_bitset {##1} |
| 857 |
} |
| 858 |
} |
| 859 |
,setF .groups:n = annot |
| 860 |
,setannotflags .meta:nn = |
| 861 |
{ pdffield }{setF={#1}} |
| 862 |
,setannotflags .groups:n = annot |
| 863 |
,unsetF .multichoice: |
| 864 |
,unsetF / all .code:n = { \bitset_clear:N \l__pdffield_F_bitset} |
| 865 |
,unsetF / unknown .code:n = |
| 866 |
{ |
| 867 |
\bitset_set_false:Nn \l__pdffield_F_bitset {#1} |
| 868 |
} |
| 869 |
,unsetF .groups:n = annot |
| 870 |
,unsetannotflags .meta:nn = |
| 871 |
{ pdffield }{unsetF= {#1} } |
| 872 |
,unsetannotflags .groups:n = annot |
| 873 |
} |
| 874 |
|
| 875 |
\cs_set_protected:Npn \__pdffield_tmpa:n #1 % |
| 876 |
{ |
| 877 |
\keys_define:nn { pdffield } |
| 878 |
{ |
| 879 |
AA/#1 .code:n = |
| 880 |
{ |
| 881 |
\tl_if_empty:nTF {#1} |
| 882 |
{ |
| 883 |
\pdfannot_dict_remove:nn {widget/AA}{#1} |
| 884 |
} |
| 885 |
{ |
| 886 |
\pdfannot_dict_put:nne {widget/AA} |
| 887 |
{#1} |
| 888 |
{<</S/JavaScript/JS\c_space_tl##1>>} |
| 889 |
} |
| 890 |
}, |
| 891 |
,AA/#1 .groups:n = annot |
| 892 |
} |
| 893 |
} |
| 894 |
|
| 895 |
\clist_map_inline:nn {Fo,Bl,D,U,E,X,PO,PC,PV,PI}{\__pdffield_tmpa:n{#1}} |
| 896 |
|
| 897 |
\cs_set_protected:Npn \__pdffield_tmpa:nn #1 #2 |
| 898 |
{ |
| 899 |
\keys_define:nn { pdffield } |
| 900 |
{ |
| 901 |
#1 .meta:nn = |
| 902 |
{ pdffield }{AA/#2={##1}}, |
| 903 |
#1 .groups:n = {annot} |
| 904 |
} |
| 905 |
} |
| 906 |
\__pdffield_tmpa:nn {onfocus} {Fo} |
| 907 |
\__pdffield_tmpa:nn {onblur} {Bl} |
| 908 |
\__pdffield_tmpa:nn {onmousedown}{D} |
| 909 |
\__pdffield_tmpa:nn {onmouseup}{U} |
| 910 |
\__pdffield_tmpa:nn {onenter} {E} |
| 911 |
\__pdffield_tmpa:nn {onexit} {X} |
| 912 |
\cs_new_protected:Npn \pdffield_appearance:nn #1 #2 |
| 913 |
{ |
| 914 |
\pdfxform_new:nnn {#1}{}{#2} |
| 915 |
} |
| 916 |
|
| 917 |
\cs_set_eq:NN \pdffield_store_appearance:nn\pdffield_appearance:nn |
| 918 |
\keys_define:nn { pdffield / setup } |
| 919 |
{ |
| 920 |
,create-style .code:n = { \__pdffield_style_create:nn #1 } |
| 921 |
,preset-checkbox .code:n = |
| 922 |
{ |
| 923 |
\keys_define:nn { pdffield } |
| 924 |
{ |
| 925 |
__pdffield/preset/checkbox .meta:n = {#1}, |
| 926 |
} |
| 927 |
} |
| 928 |
,preset-radiobutton .code:n = |
| 929 |
{ |
| 930 |
\keys_define:nn { pdffield } |
| 931 |
{ |
| 932 |
__pdffield/preset/radiobutton .meta:n = {#1}, |
| 933 |
} |
| 934 |
} |
| 935 |
,preset-textfield .code:n = |
| 936 |
{ |
| 937 |
\keys_define:nn { pdffield } |
| 938 |
{ |
| 939 |
__pdffield/preset/textfield .meta:n = {#1}, |
| 940 |
} |
| 941 |
} |
| 942 |
,preset-pushbutton .code:n = |
| 943 |
{ |
| 944 |
\keys_define:nn { pdffield } |
| 945 |
{ |
| 946 |
__pdffield/preset/pushbutton .meta:n = {#1}, |
| 947 |
} |
| 948 |
} |
| 949 |
,preset-choice .code:n = |
| 950 |
{ |
| 951 |
\keys_define:nn { pdffield } |
| 952 |
{ |
| 953 |
__pdffield/preset/choice .meta:n = {#1}, |
| 954 |
} |
| 955 |
} |
| 956 |
} |
| 957 |
\keys_set:nn{ pdffield / setup }{preset-checkbox={}} |
| 958 |
\keys_set:nn{ pdffield / setup }{preset-textfield={}} |
| 959 |
\keys_set:nn{ pdffield / setup }{preset-radiobutton={}} |
| 960 |
\keys_set:nn{ pdffield / setup }{preset-pushbutton={}} |
| 961 |
\keys_set:nn{ pdffield / setup }{preset-choice={}} |
| 962 |
\cs_new_protected:Npn \__pdffield_style_create:nn #1#2 |
| 963 |
{ |
| 964 |
\keys_define:nn { pdffield } |
| 965 |
{ |
| 966 |
__pdffield/style/#1 .meta:n = {#2}, |
| 967 |
} |
| 968 |
} |
| 969 |
|
| 970 |
\cs_new_protected:Npn \pdffield_setup:n #1 |
| 971 |
{ |
| 972 |
\keys_set:nn{ pdffield / setup }{#1} |
| 973 |
} |
| 974 |
|
| 975 |
\keys_define:nn { pdffield } |
| 976 |
{ |
| 977 |
style .code:n = {\keys_set:nn {pdffield}{__pdffield/style/#1={#1}}} |
| 978 |
} |
| 979 |
\cs_new_protected:Npn \__pdffield_value_handler:n #1 |
| 980 |
{ |
| 981 |
\msg_info:nnn {pdffield}{key-ignored}{value} |
| 982 |
} |
| 983 |
\cs_new_protected:Npn \__pdffield_default_handler:n #1 |
| 984 |
{ |
| 985 |
\msg_info:nnn {pdffield}{key-ignored}{default} |
| 986 |
} |
| 987 |
\keys_define:nn {pdffield} |
| 988 |
{ |
| 989 |
value .code:n = { \__pdffield_value_handler:n {#1} } |
| 990 |
,default .code:n = { \__pdffield_default_handler:n {#1}} |
| 991 |
} |
| 992 |
%% File: l3pdffield-checkbox.dtx |
| 993 |
\cs_new_protected:Npn \__pdffield_checkbox_default_appearances: |
| 994 |
{ |
| 995 |
\pdffield_appearance:nn {pdffield/checkbox/default/Yes} |
| 996 |
{ |
| 997 |
\normalsize |
| 998 |
\fboxsep 0pt |
| 999 |
\framebox |
| 1000 |
[ \dim_eval:n { \box_ht:N\strutbox+\box_dp:N\strutbox } ] |
| 1001 |
{ \texttimes \strut } |
| 1002 |
} |
| 1003 |
\pdffield_appearance:nn {pdffield/checkbox/default/Off} |
| 1004 |
{ |
| 1005 |
\normalsize |
| 1006 |
\fboxsep 0pt |
| 1007 |
\framebox |
| 1008 |
[ \dim_eval:n { \box_ht:N\strutbox+\box_dp:N\strutbox } ] |
| 1009 |
{ \phantom{\texttimes} \strut } |
| 1010 |
} |
| 1011 |
\cs_gset_eq:NN \__pdffield_checkbox_default_appearances: \prg_do_nothing: |
| 1012 |
} |
| 1013 |
\cs_new_protected:Npn \__pdffield_checkbox_field:n #1 %name |
| 1014 |
{ |
| 1015 |
\pdf_object_if_exist:nF {__pdffield/field/__pdffield/checkbox/#1} |
| 1016 |
{ |
| 1017 |
\__pdffield_field:n { __pdffield/checkbox/#1 } |
| 1018 |
} |
| 1019 |
\keys_set:nn {pdffield}{parent={__pdffield/checkbox/#1}} |
| 1020 |
} |
| 1021 |
\cs_generate_variant:Nn \__pdffield_checkbox_field:n {V} |
| 1022 |
\cs_new_protected:Npn \__pdffield_checkbox:n #1 |
| 1023 |
{ |
| 1024 |
\group_begin: |
| 1025 |
\__pdffield_checkbox_default_appearances: |
| 1026 |
\cs_set_eq:NN\__pdffield_appearance_handler:nnn \__pdffield_checkbox_appearance_handler:nnn |
| 1027 |
\cs_set_eq:NN\__pdffield_value_handler:n \__pdffield_checkbox_value_handler:n |
| 1028 |
\cs_set_eq:NN\__pdffield_default_handler:n \__pdffield_checkbox_default_handler:n |
| 1029 |
\keys_set:nn {pdffield} |
| 1030 |
{ |
| 1031 |
fieldID=, |
| 1032 |
name=checkbox, |
| 1033 |
appearance = pdffield/checkbox/default, |
| 1034 |
checked=false, |
| 1035 |
width = \normalbaselineskip, |
| 1036 |
height = \normalbaselineskip, |
| 1037 |
} |
| 1038 |
\__pdffield_key_disable:nnn{checkbox}{V}{checked} |
| 1039 |
\__pdffield_key_disable:nnn{checkbox}{DV}{checked} |
| 1040 |
\__pdffield_key_disable:nnn{checkbox}{AS}{checked} |
| 1041 |
\keys_set:nn { pdffield }{__pdffield/preset/checkbox,#1} |
| 1042 |
\keys_set:nn { pdffield } |
| 1043 |
{ |
| 1044 |
,unsetFf={Radio,Pushbutton} |
| 1045 |
,FT= Btn |
| 1046 |
} |
| 1047 |
\tl_if_empty:NT\l__pdffield_fieldID_tl |
| 1048 |
{ |
| 1049 |
\pdfdict_get:nnN {l__pdffield/field}{T}\l__pdffield_fieldID_tl |
| 1050 |
\tl_put_left:Nn \l__pdffield_fieldID_tl {__pdffield/checkbox/} |
| 1051 |
} |
| 1052 |
\__pdffield_checkbox_field:V\l__pdffield_fieldID_tl |
| 1053 |
\__pdffield_annot: |
| 1054 |
\group_end: |
| 1055 |
} |
| 1056 |
\keys_define:nn { pdffield } |
| 1057 |
{ |
| 1058 |
,checked .choice: |
| 1059 |
,checked / false .code:n = |
| 1060 |
{ |
| 1061 |
\pdfdict_put:nne { l__pdffield/field }{V} { /Off } |
| 1062 |
\pdfdict_put:nne { l__pdffield/field }{DV}{ /Off } |
| 1063 |
\pdfannot_dict_put:nnn {widget}{AS}{ /Off } |
| 1064 |
} |
| 1065 |
,checked / true .code:n = |
| 1066 |
{ |
| 1067 |
\pdfdict_put:nne { l__pdffield/field }{V} { /Yes } |
| 1068 |
\pdfdict_put:nne { l__pdffield/field }{DV}{ /Yes } |
| 1069 |
\pdfannot_dict_put:nnn {widget}{AS}{ /Yes } |
| 1070 |
} |
| 1071 |
,checked .default:n = {true} |
| 1072 |
,checked .groups:n = {checkbox} |
| 1073 |
} |
| 1074 |
\keys_define:nn { pdffield } |
| 1075 |
{ |
| 1076 |
,__value .choice: |
| 1077 |
,__value / Off .code:n = |
| 1078 |
{ |
| 1079 |
\pdfdict_put:nne { l__pdffield/field }{V} { /Off } |
| 1080 |
\pdfdict_put:nne { l__pdffield/field }{DV}{ /Off } |
| 1081 |
\pdfannot_dict_put:nnn {widget}{AS}{ /Off } |
| 1082 |
} |
| 1083 |
,__value / Yes .code:n = |
| 1084 |
{ |
| 1085 |
\pdfdict_put:nne { l__pdffield/field }{V} { /Yes } |
| 1086 |
\pdfdict_put:nne { l__pdffield/field }{DV}{ /Yes } |
| 1087 |
\pdfannot_dict_put:nnn {widget}{AS}{ /Yes } |
| 1088 |
} |
| 1089 |
} |
| 1090 |
\cs_new_protected:Npn \__pdffield_checkbox_value_handler:n #1 |
| 1091 |
{ |
| 1092 |
\keys_set:nn{pdffield}{__value={#1}} |
| 1093 |
} |
| 1094 |
\cs_new_protected:Npn \__pdffield_checkbox_default_handler:n #1 |
| 1095 |
{ |
| 1096 |
\keys_set:nn{pdffield}{__value={#1}} |
| 1097 |
} |
| 1098 |
\cs_new_protected:Npn \__pdffield_checkbox_appearance_handler:nnn #1 #2 #3 %name, type, text |
| 1099 |
{ |
| 1100 |
\pdfxform_if_exist:nTF { #1/Yes } |
| 1101 |
{ |
| 1102 |
\pdf_object_if_exist:nF {__pdffield/checkbox/AP/#1} |
| 1103 |
{ |
| 1104 |
\pdf_object_new:n {__pdffield/checkbox/AP/#1} |
| 1105 |
\pdf_object_write:nne |
| 1106 |
{__pdffield/checkbox/AP/#1} { dict } |
| 1107 |
{ |
| 1108 |
/Yes ~ \pdfxform_ref:n { #1/Yes} |
| 1109 |
/Off ~ \pdfxform_ref:n { #1/Off} |
| 1110 |
} |
| 1111 |
} |
| 1112 |
\pdfannot_dict_put:nne {widget/AP}{#2}{\pdf_object_ref:n{__pdffield/checkbox/AP/#1}} |
| 1113 |
} |
| 1114 |
{ |
| 1115 |
\msg_error:nnnn{pdffield}{appearance-missing}{#1}{#3} |
| 1116 |
} |
| 1117 |
} |
| 1118 |
|
| 1119 |
\cs_set_eq:NN \pdffield_checkbox:n \__pdffield_checkbox:n |
| 1120 |
|
| 1121 |
%% File: l3pdffield-radiobutton.dtx |
| 1122 |
\RequirePackage{l3draw} |
| 1123 |
\tl_new:N \l__pdffield_radio_value_tl |
| 1124 |
\bool_new:N \l__pdffield_radio_default_bool |
| 1125 |
\int_new:N \l__pdffield_radio_value_num_int |
| 1126 |
\tl_new:N \l__pdffield_radio_appearance_code_tl |
| 1127 |
\bool_new:N \l__pdffield_radio_unison_bool % if true use same name (e.g. /1) for same value |
| 1128 |
\bool_set_true:N \l__pdffield_radio_unison_bool |
| 1129 |
\cs_new_protected:Npn \__pdffield_radio_default_appearances: |
| 1130 |
{ |
| 1131 |
\pdffield_appearance:nn {pdffield/radio/default/Yes} |
| 1132 |
{ |
| 1133 |
\normalsize |
| 1134 |
\draw_begin: |
| 1135 |
\draw_path_circle:nn {0pt,0pt}{0.5\normalbaselineskip} |
| 1136 |
\draw_path_use_clear:n { stroke } |
| 1137 |
\draw_path_circle:nn {0pt,0pt}{0.2\normalbaselineskip} |
| 1138 |
\draw_path_use_clear:n { fill } |
| 1139 |
\draw_end: |
| 1140 |
} |
| 1141 |
\pdffield_appearance:nn {pdffield/radio/default/Off} |
| 1142 |
{ |
| 1143 |
\normalsize |
| 1144 |
\draw_begin: |
| 1145 |
\draw_path_circle:nn {0pt,0pt}{0.5\normalbaselineskip} |
| 1146 |
\draw_path_use_clear:n { stroke } |
| 1147 |
\draw_end: |
| 1148 |
} |
| 1149 |
|
| 1150 |
\pdffield_appearance:nn {pdffield/radio/defaultdown/Yes} |
| 1151 |
{ |
| 1152 |
\normalsize |
| 1153 |
\draw_begin: |
| 1154 |
\draw_path_circle:nn {0pt,0pt}{0.5\normalbaselineskip} |
| 1155 |
\draw_path_use_clear:n { stroke } |
| 1156 |
\draw_path_circle:nn {0pt,0pt}{0.25\normalbaselineskip} |
| 1157 |
\draw_path_use_clear:n { fill } |
| 1158 |
\draw_end: |
| 1159 |
} |
| 1160 |
\pdffield_appearance:nn {pdffield/radio/defaultdown/Off} |
| 1161 |
{ |
| 1162 |
\normalsize |
| 1163 |
\draw_begin: |
| 1164 |
\draw_path_circle:nn {0pt,0pt}{0.5\normalbaselineskip} |
| 1165 |
\draw_path_use_clear:n { stroke } |
| 1166 |
\draw_path_circle:nn {0pt,0pt}{0.25\normalbaselineskip} |
| 1167 |
\draw_path_use_clear:n { fill } |
| 1168 |
\draw_end: |
| 1169 |
} |
| 1170 |
\cs_gset_eq:NN \__pdffield_radio_default_appearances: \prg_do_nothing: |
| 1171 |
} |
| 1172 |
|
| 1173 |
\property_new:nnnn {pdfradioindex}{now} |
| 1174 |
{0} |
| 1175 |
{ |
| 1176 |
\int_use:N\l__pdffield_radio_value_num_int |
| 1177 |
} |
| 1178 |
|
| 1179 |
\cs_generate_variant:Nn \property_record:nn {V} |
| 1180 |
\cs_generate_variant:Nn \property_ref:nn {V} |
| 1181 |
|
| 1182 |
\cs_new_protected:Npn \__pdffield_radio_field:n #1 %name |
| 1183 |
{ |
| 1184 |
\pdf_object_if_exist:nF {__pdffield/field/__pdffield/radio/#1} |
| 1185 |
{ |
| 1186 |
\pdf_object_new:n {__pdffield/field/__pdffield/radio-Opt/#1} |
| 1187 |
\pdfdict_put:nne { l__pdffield/field }{Opt} { \pdf_object_ref:n {__pdffield/field/__pdffield/radio-Opt/#1} } |
| 1188 |
\seq_new:c { g__pdffield_radio_opt_#1_seq } |
| 1189 |
\hook_gput_code:nnn {shipout/lastpage}{pdffield/radio} |
| 1190 |
{ |
| 1191 |
\pdf_object_write:nne |
| 1192 |
{__pdffield/field/__pdffield/radio-Opt/#1} { array } |
| 1193 |
{\seq_use:cn {g__pdffield_radio_opt_#1_seq}{~}} |
| 1194 |
} |
| 1195 |
\pdfdict_put:nne { l__pdffield/field }{V} { /\property_ref:nn{#1}{pdfradioindex} } |
| 1196 |
\pdfdict_put:nne { l__pdffield/field }{DV} { /\property_ref:nn{#1}{pdfradioindex} } |
| 1197 |
\__pdffield_field:n { __pdffield/radio/#1 } |
| 1198 |
\bool_if:NF \l__pdffield_radio_unison_bool |
| 1199 |
{ |
| 1200 |
\cs_new:cpn {g__pdffield_radio_unison_state_#1_tl} |
| 1201 |
{ |
| 1202 |
\bool_set_false:N \l__pdffield_radio_unison_bool |
| 1203 |
} |
| 1204 |
} |
| 1205 |
} |
| 1206 |
\keys_set:nn {pdffield}{parent={__pdffield/radio/#1}} |
| 1207 |
} |
| 1208 |
\cs_generate_variant:Nn \__pdffield_radio_field:n {V} |
| 1209 |
\cs_new_protected:Npn \__pdffield_radio:n #1 |
| 1210 |
{ |
| 1211 |
\group_begin: |
| 1212 |
\cs_set_eq:NN\__pdffield_appearance_handler:nnn \__pdffield_radio_appearance_handler:nnn |
| 1213 |
\cs_set_eq:NN\__pdffield_value_handler:n \__pdffield_radio_value_handler:n |
| 1214 |
\cs_set_eq:NN\__pdffield_default_handler:n \__pdffield_radio_default_handler:n |
| 1215 |
\tl_set:Nn\l__pdffield_radio_appearance_code_tl{} |
| 1216 |
\bool_set_false:N\l__pdffield_radio_default_bool |
| 1217 |
\keys_set:nn {pdffield} |
| 1218 |
{ |
| 1219 |
fieldID= |
| 1220 |
,name=radio |
| 1221 |
,width = \normalbaselineskip |
| 1222 |
,height = \normalbaselineskip |
| 1223 |
,inunison |
| 1224 |
,__pdffield/preset/radiobutton |
| 1225 |
,#1 |
| 1226 |
,unsetFf={Pushbutton} |
| 1227 |
,setFf={Radio} |
| 1228 |
,FT= Btn |
| 1229 |
} |
| 1230 |
\tl_if_empty:NT\l__pdffield_fieldID_tl |
| 1231 |
{ |
| 1232 |
\pdfdict_get:nnN {l__pdffield/field}{T}\l__pdffield_fieldID_tl |
| 1233 |
\tl_put_left:Nn \l__pdffield_fieldID_tl {@pdffield/radio/} |
| 1234 |
} |
| 1235 |
\cs_if_exist_use:c {g__pdffield_radio_unison_state_ \l__pdffield_fieldID_tl _tl} |
| 1236 |
\__pdffield_radio_field:V\l__pdffield_fieldID_tl |
| 1237 |
\seq_gput_right:cV { g__pdffield_radio_opt_ \l__pdffield_fieldID_tl _seq }\l__pdffield_radio_value_tl |
| 1238 |
\bool_if:NTF \l__pdffield_radio_unison_bool |
| 1239 |
{ |
| 1240 |
\int_zero:N \l__pdffield_radio_value_num_int |
| 1241 |
\exp_args:Nc |
| 1242 |
\seq_map_inline:Nn { g__pdffield_radio_opt_ \l__pdffield_fieldID_tl _seq } |
| 1243 |
{ |
| 1244 |
\str_if_eq:nVTF { ##1 } \l__pdffield_radio_value_tl |
| 1245 |
{ |
| 1246 |
\seq_map_break: |
| 1247 |
} |
| 1248 |
{ |
| 1249 |
\int_incr:N \l__pdffield_radio_value_num_int |
| 1250 |
} |
| 1251 |
} |
| 1252 |
} |
| 1253 |
{ |
| 1254 |
\int_set:Nn \l__pdffield_radio_value_num_int |
| 1255 |
{\seq_count:c { g__pdffield_radio_opt_ \l__pdffield_fieldID_tl _seq } -1 } |
| 1256 |
} |
| 1257 |
\bool_if:NT\l__pdffield_radio_default_bool |
| 1258 |
{ |
| 1259 |
\mode_leave_vertical: |
| 1260 |
\property_record:Vn\l__pdffield_fieldID_tl{pdfradioindex} |
| 1261 |
} |
| 1262 |
|
| 1263 |
\int_compare:nNnTF { \l__pdffield_radio_value_num_int } = |
| 1264 |
{ |
| 1265 |
\property_ref:Vn\l__pdffield_fieldID_tl{pdfradioindex} |
| 1266 |
} |
| 1267 |
{ \pdfannot_dict_put:nne {widget}{AS}{/\property_ref:Vn\l__pdffield_fieldID_tl{pdfradioindex}} } |
| 1268 |
{ \pdfannot_dict_put:nne {widget}{AS}{/Off} } |
| 1269 |
\tl_if_empty:NT\l__pdffield_radio_appearance_code_tl |
| 1270 |
{ |
| 1271 |
\__pdffield_radio_default_appearances: |
| 1272 |
\keys_set:nn {pdffield} |
| 1273 |
{ |
| 1274 |
appearance = pdffield/radio/default, |
| 1275 |
down-appearance = pdffield/radio/defaultdown, |
| 1276 |
} |
| 1277 |
} |
| 1278 |
\l__pdffield_radio_appearance_code_tl |
| 1279 |
\__pdffield_annot: |
| 1280 |
\group_end: |
| 1281 |
} |
| 1282 |
\cs_new_protected:Npn \__pdffield_radio_value_handler:n #1 |
| 1283 |
{ |
| 1284 |
\pdf_string_from_unicode:nnN {utf16/string}{#1}\l__pdffield_radio_value_tl |
| 1285 |
} |
| 1286 |
\cs_new_protected:Npn \__pdffield_radio_default_handler:n #1 |
| 1287 |
{ |
| 1288 |
%\pdf_string_from_unicode:nnN {utf8/string}{#1}\l__pdffield_radio_default_tl |
| 1289 |
\bool_set_true:N \l__pdffield_radio_default_bool |
| 1290 |
} |
| 1291 |
\keys_define:nn { pdffield } |
| 1292 |
{ |
| 1293 |
group .meta:n = {T=#1} |
| 1294 |
} |
| 1295 |
\keys_define:nn { pdffield } |
| 1296 |
{ |
| 1297 |
inunison .choice: |
| 1298 |
,inunison / true .code:n = |
| 1299 |
{ |
| 1300 |
\bool_set_true:N \l__pdffield_radio_unison_bool |
| 1301 |
\bitset_set_true:Nn \l__pdffield_Ff_bitset {RadiosInUnison} |
| 1302 |
} |
| 1303 |
,inunison / false .code:n = |
| 1304 |
{ |
| 1305 |
\bool_set_false:N \l__pdffield_radio_unison_bool |
| 1306 |
\bitset_set_false:Nn \l__pdffield_Ff_bitset {RadiosInUnison} |
| 1307 |
} |
| 1308 |
,inunison .default:n = {true} |
| 1309 |
} |
| 1310 |
\cs_new_protected:Npn \__pdffield_radio_appearance_handler:nnn #1 #2 #3 %name, type, text |
| 1311 |
{ |
| 1312 |
\tl_put_right:Nn \l__pdffield_radio_appearance_code_tl |
| 1313 |
{ |
| 1314 |
\pdfxform_if_exist:nTF { #1 / Yes } |
| 1315 |
{ |
| 1316 |
\pdf_object_unnamed_write:ne |
| 1317 |
{dict} |
| 1318 |
{ |
| 1319 |
/\int_use:N \l__pdffield_radio_value_num_int |
| 1320 |
\c_space_tl \pdfxform_ref:n { #1/Yes} |
| 1321 |
/Off ~ \pdfxform_ref:n { #1/Off} |
| 1322 |
} |
| 1323 |
\pdfannot_dict_put:nne {widget/AP}{#2}{\pdf_object_ref_last:} |
| 1324 |
} |
| 1325 |
{ |
| 1326 |
\msg_error:nnnn{pdffield}{appearance-missing}{#1}{#3} |
| 1327 |
} |
| 1328 |
} |
| 1329 |
} |
| 1330 |
|
| 1331 |
\cs_set_eq:NN \pdffield_radio:n \__pdffield_radio:n |
| 1332 |
%% File: l3pdffield-textfield.dtx |
| 1333 |
|
| 1334 |
\tl_new:N \l__pdffield_DA_fontcolor_tl |
| 1335 |
\dim_new:N \l__pdffield_DA_fontsize_dim |
| 1336 |
\tl_new:N \l__pdffield_DA_fontname_tl |
| 1337 |
\cs_new_protected:Npn {\__pdffield_textfield_default_appearance:} |
| 1338 |
{ |
| 1339 |
\pdffield_appearance:nn {pdffield/textfield/default} |
| 1340 |
{ |
| 1341 |
{ \color_select:n{black!5!white}\rule{\paperwidth}{\paperheight} } |
| 1342 |
} |
| 1343 |
\cs_gset_eq:NN \__pdffield_textfield_default_appearance: \prg_do_nothing: |
| 1344 |
} |
| 1345 |
\cs_new_protected:Npn \__pdffield_textfield_field:n #1 %name |
| 1346 |
{ |
| 1347 |
\pdf_object_if_exist:nF {__pdffield/field/__pdffield/textfield/#1} |
| 1348 |
{ |
| 1349 |
\__pdffield_field:n { __pdffield/textfield/#1 } |
| 1350 |
} |
| 1351 |
\keys_set:nn {pdffield}{parent={__pdffield/textfield/#1}} |
| 1352 |
} |
| 1353 |
\cs_generate_variant:Nn \__pdffield_textfield_field:n {V} |
| 1354 |
\cs_new_protected:Npn \__pdffield_textfield:n #1 |
| 1355 |
{ |
| 1356 |
\group_begin: |
| 1357 |
\cs_set_eq:NN\__pdffield_V_handler:nN \__pdffield_textfield_V_handler:nN |
| 1358 |
\cs_set_eq:NN\__pdffield_value_handler:n \__pdffield_textfield_value_handler:n |
| 1359 |
\cs_set_eq:NN\__pdffield_default_handler:n \__pdffield_textfield_default_handler:n |
| 1360 |
\__pdffield_textfield_default_appearance: |
| 1361 |
\keys_set:nn {pdffield} |
| 1362 |
{ |
| 1363 |
,fieldID= |
| 1364 |
,name=textfield |
| 1365 |
,appearance = pdffield/textfield/default |
| 1366 |
,width = 3cm |
| 1367 |
,fontsize= \f@size pt |
| 1368 |
,height = \f@size pt, |
| 1369 |
depth = \fp_eval:n {0.3*\f@size} pt, |
| 1370 |
% font defaults!! |
| 1371 |
} |
| 1372 |
\keys_set:nn { pdffield }{__pdffield/preset/textfield,#1} |
| 1373 |
\int_compare:nNnT {\bitset_item:Nn \l__pdffield_Ff_bitset {Comb}}={1} |
| 1374 |
{ |
| 1375 |
% warning if set? |
| 1376 |
\keys_set:nn { pdffield } |
| 1377 |
{ |
| 1378 |
,unsetFf={FileSelect,Multiline,Password} |
| 1379 |
} |
| 1380 |
\pdfdict_get:nnN {l__pdffield/field}{MaxLen}\l__pdffield_tmpa_tl |
| 1381 |
\quark_if_no_value:NT \l__pdffield_tmpa_tl |
| 1382 |
{ |
| 1383 |
\keys_set:nn { pdffield} |
| 1384 |
{ |
| 1385 |
MaxLen = 10 %variable |
| 1386 |
} |
| 1387 |
% warning |
| 1388 |
} |
| 1389 |
} |
| 1390 |
\keys_set:nn { pdffield } |
| 1391 |
{ |
| 1392 |
,FT= Tx |
| 1393 |
,AS= |
| 1394 |
,DA= |
| 1395 |
{ |
| 1396 |
\pdf_name_from_unicode_e:n{\l__pdffield_DA_fontname_tl} |
| 1397 |
\c_space_tl |
| 1398 |
\dim_to_decimal_in_bp:n{\l__pdffield_DA_fontsize_dim} |
| 1399 |
\c_space_tl |
| 1400 |
Tf |
| 1401 |
\c_space_tl |
| 1402 |
\l__pdffield_DA_fontcolor_tl |
| 1403 |
\c_space_tl |
| 1404 |
%\l__pdffield_text_DAextra_tl |
| 1405 |
} |
| 1406 |
} |
| 1407 |
\tl_if_empty:NT\l__pdffield_fieldID_tl |
| 1408 |
{ |
| 1409 |
\pdfdict_get:nnN {l__pdffield/field}{T}\l__pdffield_fieldID_tl |
| 1410 |
\tl_put_left:Nn \l__pdffield_fieldID_tl {__pdffield/textfield/} |
| 1411 |
} |
| 1412 |
\__pdffield_textfield_field:V\l__pdffield_fieldID_tl |
| 1413 |
\__pdffield_annot: |
| 1414 |
\group_end: |
| 1415 |
} |
| 1416 |
\keys_define:nn {pdffield} |
| 1417 |
{ |
| 1418 |
,fontcolor .code:n = |
| 1419 |
{ |
| 1420 |
\__pdffield_color_set:nn {__pdffield/tmp}{#1} |
| 1421 |
\color_export:nnN{__pdffield/tmp}{space-sep-rgb}\l__pdffield_DA_fontcolor_tl |
| 1422 |
\tl_put_right:Nn \l__pdffield_DA_fontcolor_tl{~rg} |
| 1423 |
} |
| 1424 |
,fontcolor .initial:n = black, |
| 1425 |
,fontcolor .groups:n = {textfield} |
| 1426 |
,font .tl_set:N = \l__pdffield_DA_fontname_tl |
| 1427 |
,font .initial:n = {Helv} |
| 1428 |
,font .groups:n = {textfield} |
| 1429 |
,fontsize .dim_set:N = \l__pdffield_DA_fontsize_dim |
| 1430 |
,fontsize .initial:n = {10bp} |
| 1431 |
,fontsize .groups:n = {textfield} |
| 1432 |
} |
| 1433 |
\cs_new_protected:Npn \__pdffield_textfield_V_handler:nN #1#2 |
| 1434 |
{ |
| 1435 |
\pdf_string_from_unicode:nnN {utf16/hex}{#1}#2 |
| 1436 |
} |
| 1437 |
\cs_new_protected:Npn \__pdffield_textfield_value_handler:n #1 |
| 1438 |
{ |
| 1439 |
\keys_set:nn{pdffield}{V={#1}} |
| 1440 |
} |
| 1441 |
\cs_new_protected:Npn \__pdffield_textfield_default_handler:n #1 |
| 1442 |
{ |
| 1443 |
\keys_set:nn{pdffield}{DV={#1}} |
| 1444 |
} |
| 1445 |
\cs_set_eq:NN \pdffield_textfield:n \__pdffield_textfield:n |
| 1446 |
%% File: l3pdffield-pushbutton.dtx |
| 1447 |
\tl_new:N \l__pdffield_pushbutton_appearance_code_tl |
| 1448 |
\dim_new:N \l__pdffield_pushbutton_linewidth_dim |
| 1449 |
\dim_new:N \l__pdffield_pushbutton_totalht_dim |
| 1450 |
\int_new:N \g__pdffield_pushbutton_cnt_int |
| 1451 |
\dim_set:Nn \l__pdffield_pushbutton_linewidth_dim {0.4pt} |
| 1452 |
\color_set:nn {pdffield/push/text}{black} |
| 1453 |
\color_set:nn {pdffield/push/border}{black!95!white} |
| 1454 |
\color_set:nn {pdffield/push/bordertop}{yellow!5!white} |
| 1455 |
\color_set:nn {pdffield/push/borderbot}{black!50!white} |
| 1456 |
\color_set:nn {pdffield/push/fill}{black!20!white} |
| 1457 |
\cs_if_exist:NF \draw_set_linewidth:n |
| 1458 |
{ \cs_set_eq:NN\draw_set_linewidth:n \draw_linewidth:n } |
| 1459 |
\cs_new_protected:Npn \__pdffield_pushbutton_default_appearances: |
| 1460 |
{ |
| 1461 |
\int_gincr:N \g__pdffield_pushbutton_cnt_int |
| 1462 |
\exp_args:Ne |
| 1463 |
\pdffield_appearance:nn {pdffield/pushbutton/default-\int_use:N \g__pdffield_pushbutton_cnt_int} |
| 1464 |
{ |
| 1465 |
\draw_begin: |
| 1466 |
\color_set:nn {pdffield/push/text}{.} |
| 1467 |
\dim_set:Nn \l__pdffield_pushbutton_totalht_dim |
| 1468 |
{\l__pdffield_annot_ht_dim + \l__pdffield_annot_dp_dim} |
| 1469 |
\draw_set_linewidth:n {\l__pdffield_pushbutton_linewidth_dim} |
| 1470 |
\draw_path_rectangle_corners:nn |
| 1471 |
{0.5\l__pdffield_pushbutton_linewidth_dim,0.5\l__pdffield_pushbutton_linewidth_dim} |
| 1472 |
{ |
| 1473 |
\l__pdffield_annot_wd_dim-0.5\l__pdffield_pushbutton_linewidth_dim, |
| 1474 |
\l__pdffield_pushbutton_totalht_dim-0.5\l__pdffield_pushbutton_linewidth_dim |
| 1475 |
} |
| 1476 |
\color_fill:n {pdffield/push/border} |
| 1477 |
\draw_path_use_clear:n { fill } |
| 1478 |
\draw_path_rectangle_corners:nn |
| 1479 |
{2\l__pdffield_pushbutton_linewidth_dim,2\l__pdffield_pushbutton_linewidth_dim} |
| 1480 |
{ |
| 1481 |
\l__pdffield_annot_wd_dim-2\l__pdffield_pushbutton_linewidth_dim, |
| 1482 |
\l__pdffield_pushbutton_totalht_dim-2\l__pdffield_pushbutton_linewidth_dim |
| 1483 |
} |
| 1484 |
\color_fill:n {pdffield/push/bordertop} |
| 1485 |
\draw_path_use_clear:n { fill } |
| 1486 |
\draw_path_moveto:n |
| 1487 |
{ |
| 1488 |
2\l__pdffield_pushbutton_linewidth_dim, |
| 1489 |
2\l__pdffield_pushbutton_linewidth_dim |
| 1490 |
} |
| 1491 |
\draw_path_lineto:n |
| 1492 |
{5\l__pdffield_pushbutton_linewidth_dim,5\l__pdffield_pushbutton_linewidth_dim} |
| 1493 |
\draw_path_lineto:n |
| 1494 |
{ |
| 1495 |
\l__pdffield_annot_wd_dim-5\l__pdffield_pushbutton_linewidth_dim, |
| 1496 |
\l__pdffield_pushbutton_totalht_dim-5\l__pdffield_pushbutton_linewidth_dim |
| 1497 |
} |
| 1498 |
\draw_path_lineto:n |
| 1499 |
{ |
| 1500 |
\l__pdffield_annot_wd_dim-2\l__pdffield_pushbutton_linewidth_dim, |
| 1501 |
\l__pdffield_pushbutton_totalht_dim-2\l__pdffield_pushbutton_linewidth_dim |
| 1502 |
} |
| 1503 |
\draw_path_lineto:n |
| 1504 |
{ |
| 1505 |
\l__pdffield_annot_wd_dim-2\l__pdffield_pushbutton_linewidth_dim, |
| 1506 |
2\l__pdffield_pushbutton_linewidth_dim |
| 1507 |
} |
| 1508 |
\draw_path_close: |
| 1509 |
\color_fill:n {pdffield/push/borderbot} |
| 1510 |
\draw_path_use_clear:n { fill } |
| 1511 |
\draw_path_rectangle_corners:nn |
| 1512 |
{ |
| 1513 |
1.5\l__pdffield_pushbutton_linewidth_dim, |
| 1514 |
1.5\l__pdffield_pushbutton_linewidth_dim |
| 1515 |
} |
| 1516 |
{ |
| 1517 |
\l__pdffield_annot_wd_dim-1.5\l__pdffield_pushbutton_linewidth_dim, |
| 1518 |
\l__pdffield_pushbutton_totalht_dim-1.5\l__pdffield_pushbutton_linewidth_dim |
| 1519 |
} |
| 1520 |
\color_stroke:n {pdffield/push/border} |
| 1521 |
\draw_path_use_clear:n { stroke } |
| 1522 |
\draw_path_rectangle_corners:nn |
| 1523 |
{4\l__pdffield_pushbutton_linewidth_dim,4\l__pdffield_pushbutton_linewidth_dim} |
| 1524 |
{ |
| 1525 |
\l__pdffield_annot_wd_dim-4\l__pdffield_pushbutton_linewidth_dim, |
| 1526 |
\l__pdffield_pushbutton_totalht_dim-4\l__pdffield_pushbutton_linewidth_dim |
| 1527 |
} |
| 1528 |
\color_fill:n {pdffield/push/fill} |
| 1529 |
\draw_path_use_clear:n { fill } |
| 1530 |
\color_fill:n {pdffield/push/text} |
| 1531 |
\draw_transform_shift:n |
| 1532 |
{0.5 \l__pdffield_annot_wd_dim, \l__pdffield_annot_dp_dim } |
| 1533 |
\hbox_set:Nn \l_tmpa_box { \makebox[0pt]{\l__pdffield_caption_tl} } |
| 1534 |
\draw_box_use:N \l_tmpa_box |
| 1535 |
\draw_end: |
| 1536 |
} |
| 1537 |
\exp_args:Ne |
| 1538 |
\pdffield_appearance:nn {pdffield/pushbutton/defaultrollover-\int_use:N \g__pdffield_pushbutton_cnt_int} |
| 1539 |
{ |
| 1540 |
\draw_begin: |
| 1541 |
\dim_set:Nn \l__pdffield_pushbutton_totalht_dim |
| 1542 |
{\l__pdffield_annot_ht_dim + \l__pdffield_annot_dp_dim} |
| 1543 |
\draw_set_linewidth:n {\l__pdffield_pushbutton_linewidth_dim} |
| 1544 |
\draw_path_rectangle_corners:nn |
| 1545 |
{0.5\l__pdffield_pushbutton_linewidth_dim,0.5\l__pdffield_pushbutton_linewidth_dim} |
| 1546 |
{ |
| 1547 |
\l__pdffield_annot_wd_dim-0.5\l__pdffield_pushbutton_linewidth_dim, |
| 1548 |
\l__pdffield_pushbutton_totalht_dim-0.5\l__pdffield_pushbutton_linewidth_dim |
| 1549 |
} |
| 1550 |
\color_fill:n {pdffield/push/border} |
| 1551 |
\draw_path_use_clear:n { fill } |
| 1552 |
\draw_path_rectangle_corners:nn |
| 1553 |
{2\l__pdffield_pushbutton_linewidth_dim,2\l__pdffield_pushbutton_linewidth_dim} |
| 1554 |
{ |
| 1555 |
\l__pdffield_annot_wd_dim-2\l__pdffield_pushbutton_linewidth_dim, |
| 1556 |
\l__pdffield_pushbutton_totalht_dim-2\l__pdffield_pushbutton_linewidth_dim |
| 1557 |
} |
| 1558 |
\color_fill:n {pdffield/push/borderbot} |
| 1559 |
\draw_path_use_clear:n { fill } |
| 1560 |
\draw_path_moveto:n |
| 1561 |
{ |
| 1562 |
2\l__pdffield_pushbutton_linewidth_dim, |
| 1563 |
2\l__pdffield_pushbutton_linewidth_dim |
| 1564 |
} |
| 1565 |
\draw_path_lineto:n |
| 1566 |
{5\l__pdffield_pushbutton_linewidth_dim,5\l__pdffield_pushbutton_linewidth_dim} |
| 1567 |
\draw_path_lineto:n |
| 1568 |
{ |
| 1569 |
\l__pdffield_annot_wd_dim-5\l__pdffield_pushbutton_linewidth_dim, |
| 1570 |
\l__pdffield_pushbutton_totalht_dim-5\l__pdffield_pushbutton_linewidth_dim |
| 1571 |
} |
| 1572 |
\draw_path_lineto:n |
| 1573 |
{ |
| 1574 |
\l__pdffield_annot_wd_dim-2\l__pdffield_pushbutton_linewidth_dim, |
| 1575 |
\l__pdffield_pushbutton_totalht_dim-2\l__pdffield_pushbutton_linewidth_dim |
| 1576 |
} |
| 1577 |
\draw_path_lineto:n |
| 1578 |
{ |
| 1579 |
\l__pdffield_annot_wd_dim-2\l__pdffield_pushbutton_linewidth_dim, |
| 1580 |
2\l__pdffield_pushbutton_linewidth_dim |
| 1581 |
} |
| 1582 |
\draw_path_close: |
| 1583 |
\color_fill:n {pdffield/push/bordertop} |
| 1584 |
\draw_path_use_clear:n { fill } |
| 1585 |
\draw_path_rectangle_corners:nn |
| 1586 |
{ |
| 1587 |
1.5\l__pdffield_pushbutton_linewidth_dim, |
| 1588 |
1.5\l__pdffield_pushbutton_linewidth_dim |
| 1589 |
} |
| 1590 |
{ |
| 1591 |
\l__pdffield_annot_wd_dim-1.5\l__pdffield_pushbutton_linewidth_dim, |
| 1592 |
\l__pdffield_pushbutton_totalht_dim-1.5\l__pdffield_pushbutton_linewidth_dim |
| 1593 |
} |
| 1594 |
\color_stroke:n {pdffield/push/border} |
| 1595 |
\draw_path_use_clear:n { stroke } |
| 1596 |
\draw_path_rectangle_corners:nn |
| 1597 |
{4\l__pdffield_pushbutton_linewidth_dim,4\l__pdffield_pushbutton_linewidth_dim} |
| 1598 |
{ |
| 1599 |
\l__pdffield_annot_wd_dim-4\l__pdffield_pushbutton_linewidth_dim, |
| 1600 |
\l__pdffield_pushbutton_totalht_dim-4\l__pdffield_pushbutton_linewidth_dim |
| 1601 |
} |
| 1602 |
\color_fill:n {pdffield/push/fill} |
| 1603 |
\draw_path_use_clear:n { fill } |
| 1604 |
\color_fill:n {pdffield/push/text} |
| 1605 |
\draw_transform_shift:n |
| 1606 |
{0.5 \l__pdffield_annot_wd_dim, \l__pdffield_annot_dp_dim } |
| 1607 |
\hbox_set:Nn \l_tmpa_box { \makebox[0pt]{\l__pdffield_rollover_caption_tl} } |
| 1608 |
\draw_box_use:N \l_tmpa_box |
| 1609 |
\draw_end: |
| 1610 |
} |
| 1611 |
\exp_args:Ne |
| 1612 |
\pdffield_appearance:nn {pdffield/pushbutton/defaultdown-\int_use:N \g__pdffield_pushbutton_cnt_int} |
| 1613 |
{ |
| 1614 |
\draw_begin: |
| 1615 |
\dim_set:Nn \l__pdffield_pushbutton_totalht_dim |
| 1616 |
{\l__pdffield_annot_ht_dim + \l__pdffield_annot_dp_dim} |
| 1617 |
\draw_set_linewidth:n {\l__pdffield_pushbutton_linewidth_dim} |
| 1618 |
\draw_path_rectangle_corners:nn |
| 1619 |
{0.5\l__pdffield_pushbutton_linewidth_dim,0.5\l__pdffield_pushbutton_linewidth_dim} |
| 1620 |
{ |
| 1621 |
\l__pdffield_annot_wd_dim-0.5\l__pdffield_pushbutton_linewidth_dim, |
| 1622 |
\l__pdffield_pushbutton_totalht_dim-0.5\l__pdffield_pushbutton_linewidth_dim |
| 1623 |
} |
| 1624 |
\color_fill:n {pdffield/push/border} |
| 1625 |
\draw_path_use_clear:n { fill } |
| 1626 |
\draw_path_rectangle_corners:nn |
| 1627 |
{2\l__pdffield_pushbutton_linewidth_dim,2\l__pdffield_pushbutton_linewidth_dim} |
| 1628 |
{ |
| 1629 |
\l__pdffield_annot_wd_dim-2\l__pdffield_pushbutton_linewidth_dim, |
| 1630 |
\l__pdffield_pushbutton_totalht_dim-2\l__pdffield_pushbutton_linewidth_dim |
| 1631 |
} |
| 1632 |
\color_fill:n {pdffield/push/borderbot} |
| 1633 |
\draw_path_use_clear:n { fill } |
| 1634 |
\draw_path_moveto:n |
| 1635 |
{ |
| 1636 |
2\l__pdffield_pushbutton_linewidth_dim, |
| 1637 |
2\l__pdffield_pushbutton_linewidth_dim |
| 1638 |
} |
| 1639 |
\draw_path_lineto:n |
| 1640 |
{5\l__pdffield_pushbutton_linewidth_dim,5\l__pdffield_pushbutton_linewidth_dim} |
| 1641 |
\draw_path_lineto:n |
| 1642 |
{ |
| 1643 |
\l__pdffield_annot_wd_dim-5\l__pdffield_pushbutton_linewidth_dim, |
| 1644 |
\l__pdffield_pushbutton_totalht_dim-5\l__pdffield_pushbutton_linewidth_dim |
| 1645 |
} |
| 1646 |
\draw_path_lineto:n |
| 1647 |
{ |
| 1648 |
\l__pdffield_annot_wd_dim-2\l__pdffield_pushbutton_linewidth_dim, |
| 1649 |
\l__pdffield_pushbutton_totalht_dim-2\l__pdffield_pushbutton_linewidth_dim |
| 1650 |
} |
| 1651 |
\draw_path_lineto:n |
| 1652 |
{ |
| 1653 |
\l__pdffield_annot_wd_dim-2\l__pdffield_pushbutton_linewidth_dim, |
| 1654 |
2\l__pdffield_pushbutton_linewidth_dim |
| 1655 |
} |
| 1656 |
\draw_path_close: |
| 1657 |
\color_fill:n {pdffield/push/bordertop} |
| 1658 |
\draw_path_use_clear:n { fill } |
| 1659 |
\draw_path_rectangle_corners:nn |
| 1660 |
{ |
| 1661 |
1.5\l__pdffield_pushbutton_linewidth_dim, |
| 1662 |
1.5\l__pdffield_pushbutton_linewidth_dim |
| 1663 |
} |
| 1664 |
{ |
| 1665 |
\l__pdffield_annot_wd_dim-1.5\l__pdffield_pushbutton_linewidth_dim, |
| 1666 |
\l__pdffield_pushbutton_totalht_dim-1.5\l__pdffield_pushbutton_linewidth_dim |
| 1667 |
} |
| 1668 |
\color_stroke:n {pdffield/push/border} |
| 1669 |
\draw_path_use_clear:n { stroke } |
| 1670 |
\draw_path_rectangle_corners:nn |
| 1671 |
{4\l__pdffield_pushbutton_linewidth_dim,4\l__pdffield_pushbutton_linewidth_dim} |
| 1672 |
{ |
| 1673 |
\l__pdffield_annot_wd_dim-4\l__pdffield_pushbutton_linewidth_dim, |
| 1674 |
\l__pdffield_pushbutton_totalht_dim-4\l__pdffield_pushbutton_linewidth_dim |
| 1675 |
} |
| 1676 |
\color_fill:n {pdffield/push/fill} |
| 1677 |
\draw_path_use_clear:n { fill } |
| 1678 |
\color_fill:n {pdffield/push/text} |
| 1679 |
\draw_transform_shift:n |
| 1680 |
{0.5 \l__pdffield_annot_wd_dim, \l__pdffield_annot_dp_dim } |
| 1681 |
\hbox_set:Nn \l_tmpa_box { \makebox[0pt]{\l__pdffield_down_caption_tl} } |
| 1682 |
\draw_box_use:N \l_tmpa_box |
| 1683 |
\draw_end: |
| 1684 |
} |
| 1685 |
} |
| 1686 |
\cs_new_protected:Npn \__pdffield_pushbutton_field:n #1 %name |
| 1687 |
{ |
| 1688 |
\pdf_object_if_exist:nF {__pdffield/field/__pdffield/pushbutton/#1} |
| 1689 |
{ |
| 1690 |
\__pdffield_field:n { __pdffield/pushbutton/#1 } |
| 1691 |
} |
| 1692 |
\keys_set:nn {pdffield}{parent={__pdffield/pushbutton/#1}} |
| 1693 |
} |
| 1694 |
\cs_generate_variant:Nn \__pdffield_pushbutton_field:n {V} |
| 1695 |
\cs_new_protected:Npn \__pdffield_pushbutton:n #1 |
| 1696 |
{ |
| 1697 |
\group_begin: |
| 1698 |
\tl_set:Nn\l__pdffield_pushbutton_appearance_code_tl{} |
| 1699 |
\cs_set_eq:NN\__pdffield_appearance_handler:nnn \__pdffield_pushbutton_appearance_handler:nnn |
| 1700 |
\keys_set:nn {pdffield} |
| 1701 |
{ |
| 1702 |
fieldID=, |
| 1703 |
name=pushbutton, |
| 1704 |
width = 3cm, |
| 1705 |
height = 1.05\normalbaselineskip, |
| 1706 |
depth = 0.45\normalbaselineskip, |
| 1707 |
} |
| 1708 |
\keys_set:nn { pdffield }{__pdffield/preset/pushbutton,#1} |
| 1709 |
\keys_set:nn { pdffield } |
| 1710 |
{ |
| 1711 |
,V= |
| 1712 |
,DV= |
| 1713 |
,setFf={Pushbutton} |
| 1714 |
,FT= Btn |
| 1715 |
} |
| 1716 |
\tl_if_empty:NT\l__pdffield_fieldID_tl |
| 1717 |
{ |
| 1718 |
\pdfdict_get:nnN {l__pdffield/field}{T}\l__pdffield_fieldID_tl |
| 1719 |
\tl_put_left:Nn \l__pdffield_fieldID_tl {__pdffield/pushbutton/} |
| 1720 |
} |
| 1721 |
\tl_if_empty:NT\l__pdffield_pushbutton_appearance_code_tl |
| 1722 |
{ |
| 1723 |
\__pdffield_pushbutton_default_appearances: |
| 1724 |
\exp_args:Nne |
| 1725 |
\keys_set:nn {pdffield} |
| 1726 |
{ |
| 1727 |
appearance = pdffield/pushbutton/default-\int_eval:n{ \g__pdffield_pushbutton_cnt_int}, |
| 1728 |
down-appearance = pdffield/pushbutton/defaultdown-\int_eval:n{ \g__pdffield_pushbutton_cnt_int}, |
| 1729 |
rollover-appearance = pdffield/pushbutton/defaultrollover-\int_eval:n{ \g__pdffield_pushbutton_cnt_int}, |
| 1730 |
} |
| 1731 |
} |
| 1732 |
\l__pdffield_pushbutton_appearance_code_tl |
| 1733 |
\__pdffield_pushbutton_field:V\l__pdffield_fieldID_tl |
| 1734 |
\__pdffield_annot: |
| 1735 |
\group_end: |
| 1736 |
} |
| 1737 |
\cs_new_protected:Npn \__pdffield_pushbutton_appearance_handler:nnn #1 #2 #3 %name, type, text |
| 1738 |
{ |
| 1739 |
\tl_put_right:Nn \l__pdffield_pushbutton_appearance_code_tl |
| 1740 |
{ |
| 1741 |
\pdfxform_if_exist:nTF { #1 } |
| 1742 |
{ |
| 1743 |
\pdfannot_dict_put:nne {widget/AP}{#2}{\pdfxform_ref:n{#1}} |
| 1744 |
} |
| 1745 |
{ |
| 1746 |
\msg_error:nnnn{pdffield}{appearance-missing}{#1}{#3} |
| 1747 |
} |
| 1748 |
} |
| 1749 |
} |
| 1750 |
\cs_set_eq:NN \pdffield_pushbutton:n \__pdffield_pushbutton:n |
| 1751 |
|
| 1752 |
%% File: l3pdffield-choice.dtx |
| 1753 |
|
| 1754 |
|
| 1755 |
|
| 1756 |
|
| 1757 |
\RequirePackage{l3draw} |
| 1758 |
\seq_new:N \l__pdffield_choice_values_seq |
| 1759 |
\seq_new:N \l__pdffield_choice_defaultvalues_seq |
| 1760 |
\seq_new:N \l__pdffield_choice_displayvalues_seq |
| 1761 |
\seq_new:N \l__pdffield_choice_opt_seq |
| 1762 |
\cs_new_protected:Npn \__pdffield_choice_field:n #1 %name |
| 1763 |
{ |
| 1764 |
\pdf_object_if_exist:nF {__pdffield/field/__pdffield/choice/#1} |
| 1765 |
{ |
| 1766 |
\seq_clear:N \l__pdffield_choice_opt_seq |
| 1767 |
\seq_map_indexed_inline:Nn \l__pdffield_choice_values_seq |
| 1768 |
{ |
| 1769 |
\pdf_string_from_unicode:nnN{utf16/hex}{##2}\l__pdffield_tmpa_str |
| 1770 |
\tl_set:Ne \l__pdffield_tmpa_tl {\seq_item:Nn \l__pdffield_choice_displayvalues_seq {##1} } |
| 1771 |
\tl_if_empty:NTF \l__pdffield_tmpa_tl |
| 1772 |
{ |
| 1773 |
\seq_put_right:NV \l__pdffield_choice_opt_seq \l__pdffield_tmpa_str |
| 1774 |
} |
| 1775 |
{ |
| 1776 |
\exp_args:NnV |
| 1777 |
\pdf_string_from_unicode:nnN{utf16/hex}\l__pdffield_tmpa_tl\l__pdffield_tmpb_str |
| 1778 |
\seq_put_right:Ne \l__pdffield_choice_opt_seq |
| 1779 |
{ [ \l__pdffield_tmpa_str\c_space_tl\l__pdffield_tmpb_str] } |
| 1780 |
} |
| 1781 |
} |
| 1782 |
\pdf_object_unnamed_write:ne {array}{\seq_use:Nn\l__pdffield_choice_opt_seq {~}} |
| 1783 |
\pdfdict_put:nne { l__pdffield/field }{Opt} { \pdf_object_ref_last: } |
| 1784 |
\int_compare:nNnTF {\bitset_item:Nn \l__pdffield_Ff_bitset {MultiSelect}} = {1} |
| 1785 |
{ |
| 1786 |
\tl_clear:N \l__pdffield_tmpa_tl |
| 1787 |
\seq_map_inline:Nn \l__pdffield_choice_defaultvalues_seq |
| 1788 |
{ |
| 1789 |
\pdf_string_from_unicode:nnN{utf16/hex}{##1}\l__pdffield_tmpa_str |
| 1790 |
\tl_put_right:NV \l__pdffield_tmpa_tl \l__pdffield_tmpa_str |
| 1791 |
\pdfdict_put:nne { l__pdffield/field }{V} { [ \l__pdffield_tmpa_tl ] } |
| 1792 |
} |
| 1793 |
} |
| 1794 |
{ |
| 1795 |
\tl_set:Ne \l__pdffield_tmpa_tl {\seq_item:Nn \l__pdffield_choice_defaultvalues_seq {1} } |
| 1796 |
\exp_args:NnV |
| 1797 |
\pdf_string_from_unicode:nnN{utf16/hex}\l__pdffield_tmpa_tl\l__pdffield_tmpb_str |
| 1798 |
\pdfdict_put:nne { l__pdffield/field }{V} { \l__pdffield_tmpb_str } |
| 1799 |
} |
| 1800 |
\__pdffield_field:n { __pdffield/choice/#1 } |
| 1801 |
} |
| 1802 |
\keys_set:nn {pdffield}{parent={__pdffield/choice/#1}} |
| 1803 |
} |
| 1804 |
\cs_generate_variant:Nn \__pdffield_choice_field:n {V} |
| 1805 |
\cs_new_protected:Npn \__pdffield_choice:n #1 |
| 1806 |
{ |
| 1807 |
\group_begin: |
| 1808 |
\cs_set_eq:NN\__pdffield_value_handler:n \__pdffield_choice_value_handler:n |
| 1809 |
\cs_set_eq:NN\__pdffield_default_handler:n \__pdffield_choice_default_handler:n |
| 1810 |
\__pdffield_textfield_default_appearance: |
| 1811 |
\keys_set:nn {pdffield} |
| 1812 |
{ |
| 1813 |
fieldID= |
| 1814 |
,name=choice |
| 1815 |
,appearance = pdffield/textfield/default |
| 1816 |
,width = 3cm |
| 1817 |
,height = \normalbaselineskip |
| 1818 |
,type=combo-edit |
| 1819 |
,__pdffield/preset/choice |
| 1820 |
,#1 |
| 1821 |
,FT= Ch |
| 1822 |
} |
| 1823 |
\__pdffield_choice_set_type: |
| 1824 |
\keys_set:nn {pdffield} |
| 1825 |
{ |
| 1826 |
,DA= |
| 1827 |
{ |
| 1828 |
\pdf_name_from_unicode_e:n{\l__pdffield_DA_fontname_tl} |
| 1829 |
\c_space_tl |
| 1830 |
\dim_to_decimal_in_bp:n{\l__pdffield_DA_fontsize_dim} |
| 1831 |
\c_space_tl |
| 1832 |
Tf |
| 1833 |
\c_space_tl |
| 1834 |
\l__pdffield_DA_fontcolor_tl |
| 1835 |
\c_space_tl |
| 1836 |
%\l__pdffield_text_DAextra_tl |
| 1837 |
} |
| 1838 |
} |
| 1839 |
\tl_if_empty:NT\l__pdffield_fieldID_tl |
| 1840 |
{ |
| 1841 |
\pdfdict_get:nnN {l__pdffield/field}{T}\l__pdffield_fieldID_tl |
| 1842 |
\tl_put_left:Nn \l__pdffield_fieldID_tl {__pdffield/choice/} |
| 1843 |
} |
| 1844 |
\__pdffield_choice_field:V\l__pdffield_fieldID_tl |
| 1845 |
\__pdffield_annot: |
| 1846 |
\group_end: |
| 1847 |
} |
| 1848 |
\cs_new_protected:Npn \__pdffield_choice_value_handler:n #1 |
| 1849 |
{ |
| 1850 |
\seq_set_from_clist:Nn \l__pdffield_choice_values_seq {#1} |
| 1851 |
} |
| 1852 |
\cs_new_protected:Npn \__pdffield_choice_default_handler:n #1 |
| 1853 |
{ |
| 1854 |
\seq_set_from_clist:Nn \l__pdffield_choice_defaultvalues_seq {#1} |
| 1855 |
} |
| 1856 |
\keys_define:nn{pdffield} |
| 1857 |
{ |
| 1858 |
values .meta:n = {value={#1}} |
| 1859 |
,default-values .meta:n = {default={#1}} |
| 1860 |
,display-values .code:n = |
| 1861 |
{ |
| 1862 |
\seq_set_from_clist:Nn \l__pdffield_choice_displayvalues_seq {#1} |
| 1863 |
} |
| 1864 |
,top-index .code:n = |
| 1865 |
{ |
| 1866 |
\pdfdict_put:nne {l__pdffield/field}{TI}{\int_eval:n{#1-1}} |
| 1867 |
} |
| 1868 |
} |
| 1869 |
\cs_new_protected:Npn \__pdffield_choice_set_type: {} |
| 1870 |
|
| 1871 |
\keys_define:nn { pdffield } |
| 1872 |
{ |
| 1873 |
type .choice: |
| 1874 |
,type / combo .code:n = |
| 1875 |
{ |
| 1876 |
\cs_set_protected:Npn\__pdffield_choice_set_type: |
| 1877 |
{ |
| 1878 |
\keys_set:nn{pdffield}{setFf={Combo},unsetFf={Edit,DoNotSpellCheck}} |
| 1879 |
} |
| 1880 |
} |
| 1881 |
,type / combo-edit .code:n = |
| 1882 |
{ |
| 1883 |
\cs_set_protected:Npn\__pdffield_choice_set_type: |
| 1884 |
{ |
| 1885 |
\keys_set:nn{pdffield}{setFf={Combo,Edit}} |
| 1886 |
} |
| 1887 |
} |
| 1888 |
,type / list .code:n = |
| 1889 |
{ |
| 1890 |
\cs_set_protected:Npn\__pdffield_choice_set_type: |
| 1891 |
{ |
| 1892 |
\keys_set:nn{pdffield}{unsetFf={Combo,Edit,},unsetFf={Edit,DoNotSpellCheck}} |
| 1893 |
} |
| 1894 |
} |
| 1895 |
} |
| 1896 |
\cs_new_protected:Npn \__pdffield_choice_appearance_handler:nnn #1 #2 #3 %name, type, text |
| 1897 |
{ |
| 1898 |
} |
| 1899 |
|
| 1900 |
\cs_set_eq:NN \pdffield_choice:n \__pdffield_choice:n |
| 1901 |
%% File: l3pdffield-action.dtx |
| 1902 |
|
| 1903 |
\msg_new:nnn {pdffield}{action-name-undefined} |
| 1904 |
{ |
| 1905 |
The~'#1'~action~name~'#2'~is~not~defined~and~ |
| 1906 |
will~be~ignored. |
| 1907 |
} |
| 1908 |
|
| 1909 |
\tl_new:N \l__pdffield_action_export_tl |
| 1910 |
\seq_new:N \l__pdffield_action_Fields_seq |
| 1911 |
\tl_new:N \l__pdffield_action_next_tl |
| 1912 |
\pdfdict_new:n {l__pdffield/ResetForm} |
| 1913 |
\pdfdict_put:nnn {l__pdffield/ResetForm}{Type}{/Action} |
| 1914 |
\pdfdict_put:nnn {l__pdffield/ResetForm}{S}{/ResetForm} |
| 1915 |
\pdfdict_new:n {l__pdffield/SubmitForm} |
| 1916 |
\pdfdict_put:nnn {l__pdffield/SubmitForm}{Type}{/Action} |
| 1917 |
\pdfdict_put:nnn {l__pdffield/SubmitForm}{S}{/SubmitForm} |
| 1918 |
\bitset_new:Nn \l__pdffield_Flags_bitset |
| 1919 |
{ |
| 1920 |
Include/Exclude = 1 |
| 1921 |
,IncludeNoValueFields = 2 |
| 1922 |
,ExportFormat = 3 |
| 1923 |
,GetMethod = 4 |
| 1924 |
,SubmitCoordinates = 5 |
| 1925 |
,XFDF = 6 |
| 1926 |
,IncludeAppendSaves = 7 |
| 1927 |
,IncludeAnnotations = 8 |
| 1928 |
,SubmitPDF = 9 |
| 1929 |
,CanonicalFormat = 10 |
| 1930 |
,ExclNonUserAnnots = 11 |
| 1931 |
,ExclFKey = 12 |
| 1932 |
,EmbedForm = 14 |
| 1933 |
,include/exclude = 1 |
| 1934 |
,includenovaluefields = 2 |
| 1935 |
,exportformat = 3 |
| 1936 |
,getmethod = 4 |
| 1937 |
,submitcoordinates = 5 |
| 1938 |
,xfdf = 6 |
| 1939 |
,includeappendsaves = 7 |
| 1940 |
,includeannotations = 8 |
| 1941 |
,submitpdf = 9 |
| 1942 |
,canonicalformat = 10 |
| 1943 |
,exclnonuserannots = 11 |
| 1944 |
,exclfkey = 12 |
| 1945 |
,embedform = 14 |
| 1946 |
} |
| 1947 |
\cs_new_protected:Npn \__pdffield_action_flags_pdf: |
| 1948 |
{ |
| 1949 |
\bitset_clear:N \l__pdffield_Flags_bitset |
| 1950 |
\bitset_set_true:Nn \l__pdffield_Flags_bitset { SubmitPDF } |
| 1951 |
} |
| 1952 |
|
| 1953 |
\cs_new_protected:Npn \__pdffield_action_flags_html: |
| 1954 |
{ |
| 1955 |
\bitset_set_true:Nn \l__pdffield_Flags_bitset { ExportFormat } |
| 1956 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { XFDF } |
| 1957 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { IncludeAppendSaves } |
| 1958 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { IncludeAnnotations } |
| 1959 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { SubmitPDF } |
| 1960 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { ExclNonUserAnnots } |
| 1961 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { ExclFKey } |
| 1962 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { EmbedForm } |
| 1963 |
} |
| 1964 |
|
| 1965 |
\cs_new_protected:Npn \__pdffield_action_flags_fdf: |
| 1966 |
{ |
| 1967 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { ExportFormat } |
| 1968 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { GetMethod } |
| 1969 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { SubmitCoordinates } |
| 1970 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { XFDF } |
| 1971 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { SubmitPDF } |
| 1972 |
} |
| 1973 |
|
| 1974 |
\cs_new_protected:Npn \__pdffield_action_flags_xfdf: |
| 1975 |
{ |
| 1976 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { ExportFormat } |
| 1977 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { GetMethod } |
| 1978 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { SubmitCoordinates } |
| 1979 |
\bitset_set_true:Nn \l__pdffield_Flags_bitset { XFDF } |
| 1980 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { IncludeAppendSaves } |
| 1981 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { IncludeAnnotations } |
| 1982 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { SubmitPDF } |
| 1983 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { ExclNonUserAnnots } |
| 1984 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { ExclFKey } |
| 1985 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset { EmbedForm } |
| 1986 |
} |
| 1987 |
\keys_define:nn { pdffield } |
| 1988 |
{ |
| 1989 |
reset .code:n = |
| 1990 |
{ |
| 1991 |
\cs_if_exist:cTF { __pdffield_action_reset_#1: } |
| 1992 |
{ |
| 1993 |
\use:c { __pdffield_action_reset_#1: } |
| 1994 |
\pdfannot_dict_put:nne{widget} |
| 1995 |
{A} |
| 1996 |
{\tl_use:c { c__pdffield_action_reset_#1_tl } } |
| 1997 |
} |
| 1998 |
{ |
| 1999 |
\msg_warning:nnnn{pdffield}{action-name-undefined}{reset}{#1} |
| 2000 |
} |
| 2001 |
} |
| 2002 |
,reset .default:n = all |
| 2003 |
} |
| 2004 |
|
| 2005 |
\keys_define:nn { pdffield } |
| 2006 |
{ |
| 2007 |
submit .code:n = |
| 2008 |
{ |
| 2009 |
\cs_if_exist:cTF { __pdffield_action_submit_#1: } |
| 2010 |
{ |
| 2011 |
\use:c { __pdffield_action_submit_#1: } |
| 2012 |
\pdfannot_dict_put:nne{widget} |
| 2013 |
{A} |
| 2014 |
{\tl_use:c { c__pdffield_action_submit_#1_tl } } |
| 2015 |
} |
| 2016 |
{ |
| 2017 |
\msg_warning:nnnn{pdffield}{action-name-undefined}{submit}{#1} |
| 2018 |
} |
| 2019 |
} |
| 2020 |
} |
| 2021 |
|
| 2022 |
\keys_define:nn { pdffield } |
| 2023 |
{ |
| 2024 |
import .code:n = |
| 2025 |
{ |
| 2026 |
\pdf_string_from_unicode:nnN {utf8/string}{#1}\l__pdffield_tmpa_str |
| 2027 |
\pdf_object_unnamed_write:ne {dict}{/Type/Action/S/ImportData/F\l__pdffield_tmpa_str} |
| 2028 |
\pdfannot_dict_put:nne{widget} |
| 2029 |
{A} |
| 2030 |
{\pdf_object_ref_last: } |
| 2031 |
} |
| 2032 |
} |
| 2033 |
|
| 2034 |
\keys_define:nn { pdffield / action } |
| 2035 |
{ |
| 2036 |
fields .code:n = |
| 2037 |
{ |
| 2038 |
\clist_map_inline:nn {#1} |
| 2039 |
{ |
| 2040 |
\pdf_string_from_unicode:nnN {utf8/string}{##1}\l__pdffield_tmpa_str |
| 2041 |
\seq_put_right:NV\l__pdffield_action_Fields_seq \l__pdffield_tmpa_str |
| 2042 |
} |
| 2043 |
} |
| 2044 |
,exclude .code:n = { \bitset_set_true:Nn \l__pdffield_Flags_bitset {Include/Exclude }} |
| 2045 |
,include .code:n = { \bitset_set_false:Nn \l__pdffield_Flags_bitset {Include/Exclude }} |
| 2046 |
,export .choices:nn = {pdf,fdf,html,xfdf} |
| 2047 |
{ |
| 2048 |
\tl_set:Nn \l__pdffield_action_export_tl {#1} |
| 2049 |
} |
| 2050 |
,export .initial:n = {html} |
| 2051 |
,charset .choices:nn = |
| 2052 |
{utf-8, utf-16, Shift-JIS, BigFive, GBK, UHC} |
| 2053 |
{ \pdfdict_put:nnn { l__pdffield/SubmitForm }{#1} } |
| 2054 |
,urlencode .bool_set:N = \l__pdffield_url_encode_bool |
| 2055 |
,next .tl_set:N = \l__pdffield_action_next_tl |
| 2056 |
} |
| 2057 |
\keys_define:nn { pdffield / action } |
| 2058 |
{ |
| 2059 |
,setFlags .code:n = |
| 2060 |
{ |
| 2061 |
\clist_map_inline:nn {#1} |
| 2062 |
{ |
| 2063 |
\bitset_set_true:Nn \l__pdffield_Flags_bitset {##1} |
| 2064 |
} |
| 2065 |
} |
| 2066 |
,setsubmitflags .meta:n = {setFlags={#1}} |
| 2067 |
,unsetFlags .multichoice: |
| 2068 |
,unsetFlags / all .code:n = { \bitset_clear:N \l__pdffield_Flags_bitset} |
| 2069 |
,unsetFlags / unknown .code:n = |
| 2070 |
{ |
| 2071 |
\bitset_set_false:Nn \l__pdffield_Flags_bitset {#1} |
| 2072 |
} |
| 2073 |
,unsetsubmitflags .meta:n = {unsetFlags={#1}} |
| 2074 |
} |
| 2075 |
\cs_new_protected:Npn \__pdffield_action_reset_new:nn #1 #2 %#1 name, #2 keyval |
| 2076 |
{ |
| 2077 |
\cs_new_protected:cpn {__pdffield_action_reset_#1:} |
| 2078 |
{ |
| 2079 |
\group_begin: |
| 2080 |
\seq_clear:N \l__pdffield_action_Fields_seq |
| 2081 |
\keys_set:nn { pdffield / action }{ #2 } |
| 2082 |
\pdf_object_unnamed_write:ne |
| 2083 |
{ array } |
| 2084 |
{ \seq_use:Nn \l__pdffield_action_Fields_seq {~} } |
| 2085 |
\tl_if_empty:NF \l__pdffield_action_next_tl |
| 2086 |
{ |
| 2087 |
\pdfdict_put:nne {l__pdffield/ResetForm}{Next}{\l__pdffield_action_next_tl} |
| 2088 |
} |
| 2089 |
\pdfdict_put:nne |
| 2090 |
{ l__pdffield/ResetForm } |
| 2091 |
{ Fields } |
| 2092 |
{ \pdf_object_ref_last: } |
| 2093 |
\pdfdict_put:nne |
| 2094 |
{ l__pdffield/ResetForm } |
| 2095 |
{ Flags } |
| 2096 |
{ \bitset_item:Nn\l__pdffield_Flags_bitset{Include/Exclude} } |
| 2097 |
\pdf_object_unnamed_write:ne |
| 2098 |
{ dict } |
| 2099 |
{ \pdfdict_use:n{l__pdffield/ResetForm} } |
| 2100 |
\tl_const:ce { c__pdffield_action_reset_#1_tl } { \pdf_object_ref_last: } |
| 2101 |
\cs_gset_eq:cN {__pdffield_action_reset_#1:} \prg_do_nothing: |
| 2102 |
\group_end: |
| 2103 |
} |
| 2104 |
} |
| 2105 |
|
| 2106 |
\__pdffield_action_reset_new:nn {all}{fields={},exclude} |
| 2107 |
\cs_new_protected:Npn \__pdffield_action_submit_new:nn #1 #2 %#1 name, #2 keyval |
| 2108 |
{ |
| 2109 |
\group_begin: |
| 2110 |
\char_set_catcode_other:N \% |
| 2111 |
\char_set_catcode_other:N \# |
| 2112 |
\__pdffield_action_submit_new:nnn {#1}{#2} |
| 2113 |
} |
| 2114 |
\cs_new_protected:Npn \__pdffield_action_submit_new:nnn #1 #2 #3 %#1 name, #2 keyval, #3 url |
| 2115 |
{ |
| 2116 |
\group_end: |
| 2117 |
\cs_new_protected:cpn {__pdffield_action_submit_#1:} |
| 2118 |
{ |
| 2119 |
\group_begin: |
| 2120 |
\seq_clear:N \l__pdffield_action_Fields_seq |
| 2121 |
\bitset_clear:N \l__pdffield_Flags_bitset |
| 2122 |
\keys_set:nn {pdffield/action}{#2} |
| 2123 |
\use:c{ __pdffield_action_flags_\l__pdffield_action_export_tl :} |
| 2124 |
\pdfdict_put:nne |
| 2125 |
{ l__pdffield/SubmitForm } |
| 2126 |
{ Flags } |
| 2127 |
{ \bitset_to_arabic:N \l__pdffield_Flags_bitset } |
| 2128 |
\tl_if_empty:NF \l__pdffield_action_next_tl |
| 2129 |
{ |
| 2130 |
\pdfdict_put:nne {l__pdffield/SubmitForm}{Next}{\l__pdffield_action_next_tl} |
| 2131 |
} |
| 2132 |
\bool_if:NTF \l__pdffield_url_encode_bool |
| 2133 |
{ \pdf_string_from_unicode:nnN { utf8/URI } {#3}\l__pdffield_tmpa_str } |
| 2134 |
{ \pdf_string_from_unicode:nnN { utf8/string }{#3}\l__pdffield_tmpa_str } |
| 2135 |
\pdf_object_unnamed_write:ne {dict} |
| 2136 |
{ |
| 2137 |
/FS/URL |
| 2138 |
/F \l__pdffield_tmpa_str |
| 2139 |
} |
| 2140 |
\pdfdict_put:nne |
| 2141 |
{ l__pdffield/SubmitForm } |
| 2142 |
{ F } |
| 2143 |
{ \pdf_object_ref_last: } |
| 2144 |
\pdf_object_unnamed_write:ne |
| 2145 |
{ dict } |
| 2146 |
{ \pdfdict_use:n{ l__pdffield/SubmitForm } } |
| 2147 |
\tl_const:ce { c__pdffield_action_submit_#1_tl } { \pdf_object_ref_last: } |
| 2148 |
\cs_gset_eq:cN { __pdffield_action_submit_#1: } \prg_do_nothing: |
| 2149 |
\group_end: |
| 2150 |
} |
| 2151 |
} |
| 2152 |
|
| 2153 |
\cs_set_eq:NN \pdffield_reset_new:nn \__pdffield_action_reset_new:nn |
| 2154 |
\cs_set_eq:NN \pdffield_submit_new:nnn \__pdffield_action_submit_new:nn |
| 2155 |
|
| 2156 |
%% |
| 2157 |
%% |
| 2158 |
%% End of file `l3pdffield.sty'. |