[latex3-commits] [git/LaTeX3-latex3-pdfresources] test-new-hooks: field flags (9112c8d)

Ulrike Fischer fischer at troubleshooting-tex.de
Tue May 19 23:29:42 CEST 2020


Repository : https://github.com/latex3/pdfresources
On branch  : test-new-hooks
Link       : https://github.com/latex3/pdfresources/commit/9112c8df90e0f8cbf02464a7b2bf6fc94784ad9a

>---------------------------------------------------------------

commit 9112c8df90e0f8cbf02464a7b2bf6fc94784ad9a
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date:   Tue May 19 23:29:42 2020 +0200

    field flags


>---------------------------------------------------------------

9112c8df90e0f8cbf02464a7b2bf6fc94784ad9a
 experiments/checkbox-test.tex  | 24 ++++++++++++++++++++++++
 newpackages/new-attachfile.sty |  8 ++++----
 pdfresources.dtx               | 34 ++++++++++++++++++++++++++++++----
 3 files changed, 58 insertions(+), 8 deletions(-)

diff --git a/experiments/checkbox-test.tex b/experiments/checkbox-test.tex
index 41aec86..ab539e9 100644
--- a/experiments/checkbox-test.tex
+++ b/experiments/checkbox-test.tex
@@ -1,3 +1,5 @@
+% !Mode:: "TeX:DE:UTF-8:Main"
+
 \RequirePackage{pdfresources}
 %adapted from https://chat.stackexchange.com/transcript/message/54421537#54421537
 \documentclass{article}
@@ -191,3 +193,25 @@ normal yes = {\tikz[baseline, inner sep=1pt]
 ]{checkbox3}
 
 \end{document} 
+
+Field dict
+Ft     : /Btn /Tx /Ch /Sig
+Parent : OR
+Kids: array, other fields or annot/widget
+T: partial fieldname (test string)
+TU: alternate description (test string)
+TM: mapping name 
+Ff: flags ->annot/Field
+V: value            % not pushbutton 
+DV: default value   % not pushbutton
+AA: Action dict ...
+Opt: array of strings, connected to kids
+
+/DA ( 0 0 1 rg /Ti 12 Tf ) %text field
+/MaxLen                    %text field
+
+Connected widget:
+/AS ??
+% Appearance
+%checkbox
+/AP <</N <</Yes 2 0 R /Off 3 0 R>>>>
diff --git a/newpackages/new-attachfile.sty b/newpackages/new-attachfile.sty
index 3fa8296..fc92d9c 100644
--- a/newpackages/new-attachfile.sty
+++ b/newpackages/new-attachfile.sty
@@ -284,13 +284,13 @@
     ,print / false .code:n =
       {
         \bool_set_false:N \__atfi_annot_print_bool
-        \bitsetClear { __atfi_annotFlags }{\prop_item:Nn\c_pdfannot_flags_prop {Print}}
+        \bitsetClear { __atfi_annotFlags }{\prop_item:Nn\c_pdfannot_annot_flags_prop {Print}}
         \pdfdict_put:nnx {annot/FileAttachment}{F}{\bitsetGetDec { __atfi_annotFlags }}
       }
     ,print / true .code:n =
       {
         \bool_set_true:N \__atfi_annot_print_bool
-        \bitsetSet { __atfi_annotFlags }{\prop_item:Nn\c_pdfannot_flags_prop {Print}}
+        \bitsetSet { __atfi_annotFlags }{\prop_item:Nn\c_pdfannot_annot_flags_prop {Print}}
         \pdfdict_put:nnx {annot/FileAttachment}{F}{\bitsetGetDec { __atfi_annotFlags }}
       }
     ,print    .default:n = true
@@ -306,13 +306,13 @@
     ,zoom / false .code:n =
       {
         \bool_set_false:N \__atfi_annot_zoom_bool
-        \bitsetSet { __atfi_annotFlags }{\prop_item:Nn\c_pdfannot_flags_prop {NoZoom}}
+        \bitsetSet { __atfi_annotFlags }{\prop_item:Nn\c_pdfannot_annot_flags_prop {NoZoom}}
         \pdfdict_put:nnx {annot/FileAttachment}{F}{\bitsetGetDec { __atfi_annotFlags }}
       }
     ,zoom / true .code:n =
       {
         \bool_set_true:N \__atfi_annot_zoom_bool
-        \bitsetClear { __atfi_annotFlags }{\prop_item:Nn\c_pdfannot_flags_prop {NoZoom}}
+        \bitsetClear { __atfi_annotFlags }{\prop_item:Nn\c_pdfannot_annot_flags_prop {NoZoom}}
         \pdfdict_put:nnx {annot/FileAttachment}{F}{\bitsetGetDec { __atfi_annotFlags }}
       }
     ,zoom / unknown .code:n =
diff --git a/pdfresources.dtx b/pdfresources.dtx
index a63b70e..7210dae 100644
--- a/pdfresources.dtx
+++ b/pdfresources.dtx
@@ -3228,14 +3228,14 @@
 
 %    \end{macrocode}
 % \subsection{Annotations, Flags}
-% \begin{variable}{ \c_pdfannot_flags_prop }
+% \begin{variable}{ \c_pdfannot_annot_flags_prop }
 % This property list maps keys like \enquote{Invisible} to the
 % bit positions for the /F-flag. It can be used
 % e.g. with bitsets.
 % \end{variable}
 %
 %    \begin{macrocode}
-\prop_const_from_keyval:Nn \c_pdfannot_flags_prop
+\prop_const_from_keyval:Nn \c_pdfannot_annot_flags_prop
   {
     Invisible = 0,
     Hidden    = 1,
@@ -3249,6 +3249,29 @@
     LockedContents = 9
   }
 
+\prop_const_from_keyval:Nn \c_pdfannot_field_flags_prop
+  {
+    ReadOnly  = 0,
+    Required  = 1,
+    NoExport  = 2,
+    Multiline = 12,     %Tx
+    Password  = 13,
+    NoToggleToOff = 14, %Btn, radio button
+    Radio     = 15,     %Btn: Radio:    15=1, 16=0
+    Pushbutton = 16,    %Btn: Checkbox: 15=0, 16=0
+                        %Btn: Pushbutton: 16=1
+    Combo      = 17,    %Ch: Combo=1 List=0
+    Edit       = 18,    %Ch, Combo=1 -> + edit field
+    Sort       = 19,    %Ch, not relevant for view...
+    FileSelect = 20,    %Tx
+    MultiSelect =21,    %Ch
+    DoNotSpellCheck = 22,%Tx, Ch (if Combo + Edit set)
+    DoNotScroll     = 23,%Tx
+    Comb            = 24,%Tx, requires MaxLen in dict
+    RadiosInUnison  = 25, %Btn Radio
+    RichText        = 25,  %Tx
+    CommitOnSelChange = 26
+  }
 %Link annotations will always use flags, as we need for the standards.
 %If flags should be different for the subtypes, the hooks should be used.
 %Other flags should perhaps follow. For now we use the bitset package,
@@ -3260,17 +3283,20 @@
   }
 
 \pdfannot_flag_new:n {annot/Link}
+\pdfannot_flag_new:n {annot/field} %it is not really an annot, but we will put
+                                   % form field in this module.
+
 
 % #1: type, e.g. annot/Link
 % #2: name of flag, e.g. Print
 \cs_new_protected:Npn \pdfannot_flag_set:nn #1 #2
   {
-    \bitsetSet  { @@_#1_flag }{\prop_item:Nn\c_pdfannot_flags_prop {#2}}
+    \bitsetSet  { @@_#1_flag }{\prop_item:Nn\c_pdfannot_annot_flags_prop {#2}}
   }
 
 \cs_new_protected:Npn \pdfannot_flag_clear:nn #1 #2
   {
-    \bitsetClear{ @@_#1_flag }{\prop_item:Nn\c_pdfannot_flags_prop {#2}}
+    \bitsetClear{ @@_#1_flag }{\prop_item:Nn\c_pdfannot_annot_flags_prop {#2}}
   }
 
 %flags are output as decimals.





More information about the latex3-commits mailing list.