diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty | 255 |
1 files changed, 131 insertions, 124 deletions
diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty index a1081f88ac5..84d14323952 100644 --- a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty +++ b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty @@ -43,11 +43,11 @@ % % The Current Maintainer of this work is A. Grahn. - \def\g@ocgxii@date@tl{2024/03/18} - \def\g@ocgxii@version@tl{0.57} + \def\g@ocgxii@date@tl{2024/09/16} + \def\g@ocgxii@version@tl{0.60} \ProvidesExplPackage{ocgx2}{\g@ocgxii@date@tl}{\g@ocgxii@version@tl} - {ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx} + {ports~`ocgx'~functionality~to~dvips+ps2pdf,~xelatex~and~dvipdfmx} %creating global definitions \cs_new_protected:Npn\ocgxii@newkey#1#2{\tl_gset:cx{#1}{#2}} @@ -1579,8 +1579,8 @@ % % The Current Maintainer of this work is A. Grahn. -\def\g@ocgxii@date@tl{2024/03/18} -\def\g@ocgxii@version@tl{0.57} +\def\g@ocgxii@date@tl{2024/09/16} +\def\g@ocgxii@version@tl{0.60} \ProvidesExplPackage{ocgx2}{\g@ocgxii@date@tl}{\g@ocgxii@version@tl} {ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx} @@ -1810,8 +1810,8 @@ \cs_set_eq:NN\And \ocgxii_protected_dummy_cs:n \cs_set_eq:NN\Or \ocgxii_protected_dummy_cs:n \ocgxii_ocmd_read_visbility:xN{#2}\l_ocgxii_ocmd_visibility_tl - \pdf_object_new:xn{g_object_\int_use:N\g_ocgbase_int _pdf}{dict} - \pdf_object_write:xx{g_object_\int_use:N\g_ocgbase_int _pdf}{ + \exp_args:Ne\pdf_object_new:n{g_object_\int_use:N\g_ocgbase_int _pdf} + \exp_args:Neee\pdf_object_write:nnn{g_object_\int_use:N\g_ocgbase_int _pdf}{dict}{ /Type/OCMD\l_ocgxii_ocmd_visibility_tl } \tl_gset:cx{g_pbs_objname_\pdf_object_ref_last: _tl}{ @@ -2385,104 +2385,132 @@ % \bool_if:nTF{\l_ocgxii_nobreak_bool || \l_ocgxii_mouse_triggers_bool}{ \hbox_set:Nn\l_tmpa_box{#6} - \bool_if:NTF\l_ocgxii_mouse_triggers_bool{ - % e,d,x mouse triggers require (non-breakable) /Widget annot - \pdfannot_dict_put:nnn{link/GoTo}{Subtype}{/Widget} - \pdfannot_dict_remove:nn{link/GoTo}{Border} - }{ - \pdfannot_dict_put:nnn{link/GoTo}{Border}{[0~0~0]} - } - \pdfannot_dict_remove:nn{link/GoTo}{C} - \pbs_pdfannot:nnnn{ - \dim_use:N\box_wd:N\l_tmpa_box}{ - \dim_use:N\box_ht:N\l_tmpa_box}{ - \dim_use:N\box_dp:N\l_tmpa_box - }{ - \pdfannot_dict_use:n{link/GoTo} + % suppress annots with SetOCGState Action Subtype for pdf/a compliance + \pdfmeta_standard_verify:nT{annot_action_A}{ \bool_if:NTF\l_ocgxii_mouse_triggers_bool{ - /Ff~65536/FT/Btn/BS<</W~0>> - /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int) - %treat mouse-up as mouse-click --> handle through /A dictionary - \str_if_eq:eeF{}{ - \l_ocgxii_toswitch_u_tl\l_ocgxii_toshow_u_tl\l_ocgxii_tohide_u_tl - }{ - /A <</S/SetOCGState/State [ - \str_if_eq:VnF\l_ocgxii_toswitch_u_tl{}{ - /Toggle~\l_ocgxii_toswitch_u_tl - } - \str_if_eq:VnF\l_ocgxii_toshow_u_tl{}{ - /ON~\l_ocgxii_toshow_u_tl - } - \str_if_eq:VnF\l_ocgxii_tohide_u_tl{}{ - /OFF~\l_ocgxii_tohide_u_tl - } - ]>> - } - % other mouse triggers need add. actions dict - /AA << - %\str_if_eq:eeF{}{ % mouse-up - % \l_ocgxii_toswitch_u_tl\l_ocgxii_toshow_u_tl\l_ocgxii_tohide_u_tl - %}{ - % /U <</S/SetOCGState/State [ - % \str_if_eq:VnF\l_ocgxii_toswitch_u_tl{}{ - % /Toggle~\l_ocgxii_toswitch_u_tl - % } - % \str_if_eq:VnF\l_ocgxii_toshow_u_tl{}{ - % /ON~\l_ocgxii_toshow_u_tl - % } - % \str_if_eq:VnF\l_ocgxii_tohide_u_tl{}{ - % /OFF~\l_ocgxii_tohide_u_tl - % } - % ]>> - %} - \str_if_eq:eeF{}{ % mouse-down - \l_ocgxii_toswitch_d_tl\l_ocgxii_toshow_d_tl\l_ocgxii_tohide_d_tl - }{ - /D <</S/SetOCGState/State [ - \str_if_eq:VnF\l_ocgxii_toswitch_d_tl{}{ - /Toggle~\l_ocgxii_toswitch_d_tl - } - \str_if_eq:VnF\l_ocgxii_toshow_d_tl{}{ - /ON~\l_ocgxii_toshow_d_tl - } - \str_if_eq:VnF\l_ocgxii_tohide_d_tl{}{ - /OFF~\l_ocgxii_tohide_d_tl - } - ]>> - } - \str_if_eq:eeF{}{ % mouse-enter - \l_ocgxii_toswitch_e_tl\l_ocgxii_toshow_e_tl\l_ocgxii_tohide_e_tl - }{ - /E <</S/SetOCGState/State [ - \str_if_eq:VnF\l_ocgxii_toswitch_e_tl{}{ - /Toggle~\l_ocgxii_toswitch_e_tl - } - \str_if_eq:VnF\l_ocgxii_toshow_e_tl{}{ - /ON~\l_ocgxii_toshow_e_tl - } - \str_if_eq:VnF\l_ocgxii_tohide_e_tl{}{ - /OFF~\l_ocgxii_tohide_e_tl - } - ]>> - } - \str_if_eq:eeF{}{ % mouse-exit - \l_ocgxii_toswitch_x_tl\l_ocgxii_toshow_x_tl\l_ocgxii_tohide_x_tl + % e,d,x mouse triggers require (non-breakable) /Widget annot + \pdfannot_dict_put:nnn{link/GoTo}{Subtype}{/Widget} + \pdfannot_dict_remove:nn{link/GoTo}{Border} + }{ + \pdfannot_dict_put:nnn{link/GoTo}{Border}{[0~0~0]} + } + \pdfannot_dict_remove:nn{link/GoTo}{C} + \pbs_pdfannot:nnnn{ + \dim_use:N\box_wd:N\l_tmpa_box}{ + \dim_use:N\box_ht:N\l_tmpa_box}{ + \dim_use:N\box_dp:N\l_tmpa_box + }{ + \pdfannot_dict_use:n{link/GoTo} + \bool_if:NTF\l_ocgxii_mouse_triggers_bool{ + /Ff~65536/FT/Btn/BS<</W~0>> + /T~(ocgx2@\int_use:N\g_ocgxii_widcount_int) + %treat mouse-up as mouse-click --> handle through /A dictionary + \str_if_eq:eeF{}{ + \l_ocgxii_toswitch_u_tl\l_ocgxii_toshow_u_tl\l_ocgxii_tohide_u_tl }{ - /X <</S/SetOCGState/State [ - \str_if_eq:VnF\l_ocgxii_toswitch_x_tl{}{ - /Toggle~\l_ocgxii_toswitch_x_tl + /A <</S/SetOCGState/State [ + \str_if_eq:VnF\l_ocgxii_toswitch_u_tl{}{ + /Toggle~\l_ocgxii_toswitch_u_tl } - \str_if_eq:VnF\l_ocgxii_toshow_x_tl{}{ - /ON~\l_ocgxii_toshow_x_tl + \str_if_eq:VnF\l_ocgxii_toshow_u_tl{}{ + /ON~\l_ocgxii_toshow_u_tl } - \str_if_eq:VnF\l_ocgxii_tohide_x_tl{}{ - /OFF~\l_ocgxii_tohide_x_tl + \str_if_eq:VnF\l_ocgxii_tohide_u_tl{}{ + /OFF~\l_ocgxii_tohide_u_tl } ]>> } - >> - }{ - %mouse-up alone + % other mouse triggers need add. actions dict + /AA << + %\str_if_eq:eeF{}{ % mouse-up + % \l_ocgxii_toswitch_u_tl\l_ocgxii_toshow_u_tl\l_ocgxii_tohide_u_tl + %}{ + % /U <</S/SetOCGState/State [ + % \str_if_eq:VnF\l_ocgxii_toswitch_u_tl{}{ + % /Toggle~\l_ocgxii_toswitch_u_tl + % } + % \str_if_eq:VnF\l_ocgxii_toshow_u_tl{}{ + % /ON~\l_ocgxii_toshow_u_tl + % } + % \str_if_eq:VnF\l_ocgxii_tohide_u_tl{}{ + % /OFF~\l_ocgxii_tohide_u_tl + % } + % ]>> + %} + \str_if_eq:eeF{}{ % mouse-down + \l_ocgxii_toswitch_d_tl\l_ocgxii_toshow_d_tl\l_ocgxii_tohide_d_tl + }{ + /D <</S/SetOCGState/State [ + \str_if_eq:VnF\l_ocgxii_toswitch_d_tl{}{ + /Toggle~\l_ocgxii_toswitch_d_tl + } + \str_if_eq:VnF\l_ocgxii_toshow_d_tl{}{ + /ON~\l_ocgxii_toshow_d_tl + } + \str_if_eq:VnF\l_ocgxii_tohide_d_tl{}{ + /OFF~\l_ocgxii_tohide_d_tl + } + ]>> + } + \str_if_eq:eeF{}{ % mouse-enter + \l_ocgxii_toswitch_e_tl\l_ocgxii_toshow_e_tl\l_ocgxii_tohide_e_tl + }{ + /E <</S/SetOCGState/State [ + \str_if_eq:VnF\l_ocgxii_toswitch_e_tl{}{ + /Toggle~\l_ocgxii_toswitch_e_tl + } + \str_if_eq:VnF\l_ocgxii_toshow_e_tl{}{ + /ON~\l_ocgxii_toshow_e_tl + } + \str_if_eq:VnF\l_ocgxii_tohide_e_tl{}{ + /OFF~\l_ocgxii_tohide_e_tl + } + ]>> + } + \str_if_eq:eeF{}{ % mouse-exit + \l_ocgxii_toswitch_x_tl\l_ocgxii_toshow_x_tl\l_ocgxii_tohide_x_tl + }{ + /X <</S/SetOCGState/State [ + \str_if_eq:VnF\l_ocgxii_toswitch_x_tl{}{ + /Toggle~\l_ocgxii_toswitch_x_tl + } + \str_if_eq:VnF\l_ocgxii_toshow_x_tl{}{ + /ON~\l_ocgxii_toshow_x_tl + } + \str_if_eq:VnF\l_ocgxii_tohide_x_tl{}{ + /OFF~\l_ocgxii_tohide_x_tl + } + ]>> + } + >> + }{ + %mouse-up alone + /A <</S/SetOCGState + /State [ + \str_if_eq:VnF{\l_ocgxii_toswitch_u_tl}{}{ + /Toggle~\l_ocgxii_toswitch_u_tl}~ + \str_if_eq:VnF{\l_ocgxii_toshow_u_tl}{}{/ON~\l_ocgxii_toshow_u_tl}~ + \str_if_eq:VnF{\l_ocgxii_tohide_u_tl}{}{/OFF~\l_ocgxii_tohide_u_tl} + ] + >> + } + } + \bool_if:NT\l_ocgxii_mouse_triggers_bool{ + \pbs_appendtofields:n{\pbs_pdflastann:} + \int_gincr:N\g_ocgxii_widcount_int + } + } + \box_use_drop:N\l_tmpa_box + }{ + % suppress annots with SetOCGState Action Subtype for pdf/a compliance + \pdfmeta_standard_verify:nTF{annot_action_A}{ + \bool_if:NF\g_ocgxii_hyperref_loaded_bool{ + \pdfannot_dict_put:nnn{link/GoTo}{Border}{[0~0~0]} + } + %line-breakable annotation + \pbs_pdflink:nn{ + %look and feel of hyperref internal links + \pdfannot_dict_use:n{link/GoTo} /A <</S/SetOCGState /State [ \str_if_eq:VnF{\l_ocgxii_toswitch_u_tl}{}{ @@ -2491,33 +2519,12 @@ \str_if_eq:VnF{\l_ocgxii_tohide_u_tl}{}{/OFF~\l_ocgxii_tohide_u_tl} ] >> + }{ + \hook_use:n{pdfannot/link/GoTo/begin} + #6 + \hook_use:n{pdfannot/link/GoTo/end} } - }\box_use_drop:N\l_tmpa_box - \bool_if:NT\l_ocgxii_mouse_triggers_bool{ - \pbs_appendtofields:n{\pbs_pdflastann:} - \int_gincr:N\g_ocgxii_widcount_int - } - }{ - \bool_if:NF\g_ocgxii_hyperref_loaded_bool{ - \pdfannot_dict_put:nnn{link/GoTo}{Border}{[0~0~0]} - } - %line-breakable annotation - \pbs_pdflink:nn{ - %look and feel of hyperref internal links - \pdfannot_dict_use:n{link/GoTo} - /A <</S/SetOCGState - /State [ - \str_if_eq:VnF{\l_ocgxii_toswitch_u_tl}{}{ - /Toggle~\l_ocgxii_toswitch_u_tl}~ - \str_if_eq:VnF{\l_ocgxii_toshow_u_tl}{}{/ON~\l_ocgxii_toshow_u_tl}~ - \str_if_eq:VnF{\l_ocgxii_tohide_u_tl}{}{/OFF~\l_ocgxii_tohide_u_tl} - ] - >> - }{ - \hook_use:n{pdfannot/link/GoTo/begin} - #6 - \hook_use:n{pdfannot/link/GoTo/end} - } + }{#6} } \group_end: } |