[latex3-commits] [git/LaTeX3-latex3-pdfresources] test-checkbox: added flags (e4f362d)
Ulrike Fischer
fischer at troubleshooting-tex.de
Thu Mar 4 22:25:45 CET 2021
Repository : https://github.com/latex3/pdfresources
On branch : test-checkbox
Link : https://github.com/latex3/pdfresources/commit/e4f362ddc944a4d81fd42abfdd3291a59b7eb055
>---------------------------------------------------------------
commit e4f362ddc944a4d81fd42abfdd3291a59b7eb055
Author: Ulrike Fischer <fischer at troubleshooting-tex.de>
Date: Thu Mar 4 22:25:45 2021 +0100
added flags
>---------------------------------------------------------------
e4f362ddc944a4d81fd42abfdd3291a59b7eb055
newpackages/l3pdffield-checkbox.dtx | 68 ++++++++++++++++++++++++++++++++++---
1 file changed, 64 insertions(+), 4 deletions(-)
diff --git a/newpackages/l3pdffield-checkbox.dtx b/newpackages/l3pdffield-checkbox.dtx
index 9856cc0..349673f 100644
--- a/newpackages/l3pdffield-checkbox.dtx
+++ b/newpackages/l3pdffield-checkbox.dtx
@@ -235,8 +235,9 @@
% \section{bitsets}
% A bitset for the field flag Ff:
% Not yet decided if this should public or not ...
+% and an internal copy of the annot bitset.
% \begin{macrocode}
-\bitset_new:Nn \l_pdffield_Ff_bitset
+\bitset_new:Nn \l_@@_Ff_bitset
{
ReadOnly = 0,
Required = 1,
@@ -259,6 +260,20 @@
RichText = 25,%Tx
CommitOnSelChange = 26
}
+
+\bitset_new:Nn \l_@@_F_bitset
+ {
+ Invisible = 1,
+ Hidden = 2,
+ Print = 3,
+ NoZoom = 4,
+ NoRotate = 5,
+ NoView = 6,
+ ReadOnly = 7,
+ Locked = 8,
+ ToggleNoView = 9,
+ LockedContents = 10
+ }
% \end{macrocode}
% \section{The field dictionary}
% The field dictionary is the main object. It references the
@@ -305,11 +320,11 @@
{
\pdf_object_ref:n {@@_checkbox/field/#1/Kids}
}
- \bitset_set_false:Nn \l_pdffield_Ff_bitset {Radio}
- \bitset_set_false:Nn \l_pdffield_Ff_bitset {Pushbutton}
+ \bitset_set_false:Nn \l_@@_Ff_bitset {Radio}
+ \bitset_set_false:Nn \l_@@_Ff_bitset {Pushbutton}
\pdfdict_put:nnx {l_@@/checkbox/field}
{Ff}
- {\bitset_to_arabic:N \l_pdffield_Ff_bitset }
+ {\bitset_to_arabic:N \l_@@_Ff_bitset }
\pdf_object_write:nx {@@_checkbox/field/#1} { \pdfdict_use:n {l_@@/checkbox/field} }
\pdfmanagement_add:nnx
{ Catalog / AcroForm }
@@ -341,6 +356,15 @@
% as it actually uses an internal name of another module.
% \begin{macrocode}
\pdfdict_put:nnx {l_@@/checkbox/annot}{AP}{<<\pdfdict_use:n{l_@@/checkbox/annot/AP}>>}
+ \pdfmeta_standard_verify:nF
+ {annot_flags}
+ {
+ \bitset_set_true:Nn \l_@@_F_bitset {Print}
+ \bitset_set_false:Nn \l_@@_F_bitset {Hidden}
+ \bitset_set_false:Nn \l_@@_F_bitset {Invisible}
+ \bitset_set_false:Nn \l_@@_F_bitset {NoView}
+ }
+ \pdfdict_put:nnx {l_@@/checkbox/annot}{F}{ \bitset_to_arabic:N \l_@@_F_bitset }
\pdfdict_set_eq:nn {l__pdfannot/widget}{l_@@/checkbox/annot}
\pdfannot_dict_put:nnx {widget}{Parent}{\pdf_object_ref:n{@@_checkbox/field/#1}}
\mode_leave_vertical:
@@ -491,6 +515,42 @@
,checked .default:n = {true}
,checked .initial:n = {false}
}
+% \end{macrocode}
+% Flags. We don't add lots of individual keys but mapped the key names directly
+% \begin{macrocode}
+\keys_define:nn { pdffield / checkbox }
+ {
+ ,setfieldflags .code:n =
+ {
+ \clist_map_inline:nn {#1}
+ {
+ \bitset_set_true:Nn \l_@@_Ff_bitset {##1}
+ }
+ }
+ ,setfieldflags .groups:n = {field}
+ ,unsetfieldflags .code:n =
+ {
+ \clist_map_inline:nn {#1}
+ {
+ \bitset_set_false:Nn \l_@@_Ff_bitset {##1}
+ }
+ }
+ ,unsetfieldflags .groups:n = {field}
+ ,setannotflags .code:n =
+ {
+ \clist_map_inline:nn {#1}
+ {
+ \bitset_set_true:Nn \l_@@_F_bitset {##1}
+ }
+ }
+ ,unsetannotflags .code:n =
+ {
+ \clist_map_inline:nn {#1}
+ {
+ \bitset_set_false:Nn \l_@@_F_bitset {##1}
+ }
+ }
+ }
\keys_define:nn { pdffield / checkbox }
{
More information about the latex3-commits
mailing list.