From 03114a8e8ce56c546d59cd0851c12bd735a53096 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Fri, 8 Jun 2018 22:04:17 +0000
Subject: ocgx2 (9jun18)

git-svn-id: svn://tug.org/texlive/trunk@47961 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty | 66 ++++++++++++++++-------------
 1 file changed, 37 insertions(+), 29 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty')

diff --git a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
index 75a8a023804..4ba86c3b76b 100644
--- a/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
+++ b/Master/texmf-dist/tex/latex/ocgx2/ocgx2.sty
@@ -35,14 +35,14 @@
 \RequirePackage{xparse}
 \RequirePackage{l3keys2e}
 
-\def\g@ocgxii@date@tl{2018/04/06}
-\def\g@ocgxii@version@tl{0.33}
+\def\g@ocgxii@date@tl{2018/06/07}
+\def\g@ocgxii@version@tl{0.34}
 
 \ProvidesExplPackage{ocgx2}{\g@ocgxii@date@tl}{\g@ocgxii@version@tl}
 {ports `ocgx' functionality to dvips+ps2pdf, xelatex and dvipdfmx}
 
 %creating global definitions
-\cs_new:Npn\ocgxii@newkey#1#2{\tl_gset:cx{#1}{#2}}
+\cs_new_protected:Npn\ocgxii@newkey#1#2{\tl_gset:cx{#1}{#2}}
 
 \AtBeginDocument{
   \iow_now:Nx\@mainaux{
@@ -164,7 +164,7 @@
   \ocgxii_endocg:
 }
 
-\cs_new_nopar:Nn\ocgxii_beginocg:nnnn{
+\cs_new_protected_nopar:Nn\ocgxii_beginocg:nnnn{
   \group_begin:
     \ocgxii_reset_cmd_opts:  % ... to the user-set package options
     \tl_if_exist:cTF{ocgxii@#3}{ %re-open existing layer
@@ -219,7 +219,7 @@
   \ignorespaces
 }
 
-\cs_new_nopar:Nn\ocgxii_endocg:{
+\cs_new_protected_nopar:Nn\ocgxii_endocg:{
   \unskip
   \ocgbase_oc_emc:
   \ocgbase_tree_node_end:
@@ -227,7 +227,7 @@
   \ocgxii_stack_shipout:NN\ocgxii@ocg@stack@on@page\g_ocgbase_open_stack_seq
 }
 
-\cs_new_nopar:Nn\ocgxii_stack_shipout:NN{
+\cs_new_protected_nopar:Nn\ocgxii_stack_shipout:NN{
   \iow_shipout_x:Nx\@mainaux{
     \token_to_str:N#1{
       \exp_not:N\int_use:N\g_ocgxii_page_int
@@ -235,7 +235,7 @@
   }
 }
 
-\cs_new_nopar:Npn\ocgxii@ocg@stack@on@page#1#2{
+\cs_new_protected_nopar:Npn\ocgxii@ocg@stack@on@page#1#2{
   \seq_gset_from_clist:cn{g_pending_ocgs_on_#1_seq}{#2}
   %re-add braces around items for dvips
   \bool_if:nT{\sys_if_output_dvi_p: && !\g_ocgxii_dvipdfmx_bool}{
@@ -247,7 +247,7 @@
 }
 \ocgxii@ocg@stack@on@page{0}{} %initialize
 
-\cs_new_nopar:Npn\ocgxii@lnkcol@stack@on@page#1#2{
+\cs_new_protected_nopar:Npn\ocgxii@lnkcol@stack@on@page#1#2{
   \seq_gset_from_clist:cn{g_pending_lnkcols_on_#1_seq}{#2}
   %re-add braces around items
   \seq_map_inline:cn{g_pending_lnkcols_on_#1_seq}{
@@ -352,14 +352,14 @@
 }
 \int_new:N\g_ocgxii_page_int %abs. page counter
 
-\cs_new_nopar:Nn\ocgxii_ocglist_reset:{
+\cs_new_protected_nopar:Nn\ocgxii_ocglist_reset:{
   \tl_clear_new:N\l_ocgxii_u_list_tl
   \tl_clear_new:N\l_ocgxii_d_list_tl
   \tl_clear_new:N\l_ocgxii_e_list_tl
   \tl_clear_new:N\l_ocgxii_x_list_tl
 }
 
-\cs_new_nopar:Nn\ocgxii_ocglist_build:Nn{
+\cs_new_protected_nopar:Nn\ocgxii_ocglist_build:Nn{
   \tl_set:Nx\l_ocglistarg_tl{#2}\tl_trim_spaces:N\l_ocglistarg_tl
   \seq_set_split:NnV\l_ocgxii_ocglistarg_seq{~}\l_ocglistarg_tl
   \seq_map_variable:NNn\l_ocgxii_ocglistarg_seq\l_tempa_tl{
@@ -367,7 +367,7 @@
   }
 }
 
-\cs_new:Nn\ocgxii_commalist_process:n{
+\cs_new_protected:Nn\ocgxii_commalist_process:n{
   \seq_set_split:Nnn\l_tmpa_seq{,}{#1}
   \ocgxii_ocglist_build:Nn\l_ocgxii_e_list_tl{\seq_item:Nn\l_tmpa_seq{1}}
   \ocgxii_ocglist_build:Nn\l_ocgxii_x_list_tl{\seq_item:Nn\l_tmpa_seq{2}}
@@ -375,7 +375,7 @@
   \ocgxii_ocglist_build:Nn\l_ocgxii_u_list_tl{\seq_item:Nn\l_tmpa_seq{4}}
 }
 
-\cs_new_nopar:Nn\ocgxii_ocglist_process_idlist:nn{
+\cs_new_protected_nopar:Nn\ocgxii_ocglist_process_idlist:nn{
   \ocgxii_ocglist_reset:
   \tl_set:Nx\l_ocgxii_opt_tl{#1}\tl_remove_all:Nn\l_ocgxii_opt_tl{~}
   \str_case_x:nnF{\l_ocgxii_opt_tl}{
@@ -426,7 +426,7 @@
 
 \bool_new:N\l_ocgxii_mouse_triggers_bool
 \bool_new:N\l_ocgxii_nobreak_bool
-\cs_new:Nn\ocgxii_actionsocg:nnnnnn{
+\cs_new_protected:Nn\ocgxii_actionsocg:nnnnnn{
   \leavevmode
   \bool_set_false:N\l_ocgxii_mouse_triggers_bool
   \bool_set_false:N\l_ocgxii_nobreak_bool
@@ -600,13 +600,13 @@
 }
 
 %mimic commands from ocg-p
-\cs_new:Npn\toggleocgs{\switchocg*}
-\cs_new:Npn\showocgs{\showocg*}
-\cs_new:Npn\hideocgs{\hideocg*}
-\cs_new:Npn\setocgs{\actionsocg*}
+\cs_new_protected:Npn\toggleocgs{\switchocg*}
+\cs_new_protected:Npn\showocgs{\showocg*}
+\cs_new_protected:Npn\hideocgs{\hideocg*}
+\cs_new_protected:Npn\setocgs{\actionsocg*}
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-\cs_new:Nn\ocgxii_process_ocgref:NN{
+\cs_new_protected:Nn\ocgxii_process_ocgref:NN{
   \str_if_eq_x:nnF{#2}{}{
     \tl_if_exist:cTF{ocgx2.ocg.#2}{
       \tl_put_right:Nx#1{~\tl_use:c{ocgx2.ocg.#2}}
@@ -671,7 +671,7 @@
   radiobtngrp .value_required:n = {true}
 }
 
-\cs_new:Nn\ocgxii_reset_cmd_opts:{
+\cs_new_protected:Nn\ocgxii_reset_cmd_opts:{
   \tl_set_eq:NN\l_ocgxii_view_tl\g_ocgxii_view_tl
   \tl_set_eq:NN\l_ocgxii_print_tl\g_ocgxii_print_tl
   \tl_set_eq:NN\l_ocgxii_export_tl\g_ocgxii_export_tl
@@ -707,13 +707,13 @@
 % with some improvements
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
-\cs_new_nopar:Nn\ocgxii_colourlink_begin:{}
-\cs_new_nopar:Nn\ocgxii_colourlink_end:{}
-\cs_new_nopar:Nn\ocgxii_colourlink_nobreak_begin:{
+\cs_new_protected_nopar:Nn\ocgxii_colourlink_begin:{}
+\cs_new_protected_nopar:Nn\ocgxii_colourlink_end:{}
+\cs_new_protected_nopar:Nn\ocgxii_colourlink_nobreak_begin:{
   \hbox_set:Nw\l_tmpa_box\color@begingroup
     \tl_set_eq:NN\color@setgroup\group_begin:
 }
-\cs_new_nopar:Nn\ocgxii_colourlink_nobreak_end:{
+\cs_new_protected_nopar:Nn\ocgxii_colourlink_nobreak_end:{
   \color@endgroup\hbox_set_end:
   \mbox{
     \ocgbase_oc_bdc:n{\ocgxii@OCPrint}
@@ -733,7 +733,7 @@
 
 \bool_if:nTF{\sys_if_output_dvi_p: && !\g_ocgxii_dvipdfmx_bool}{
   % non-breakable links in dvips
-  \cs_new_nopar:Nn\ocgxii_enable_ocglinks:{
+  \cs_new_protected_nopar:Nn\ocgxii_enable_ocglinks:{
     \def\Hy@colorlink##1{
       \group_begin:
       \tl_set:Nn\l_ocgxii_lnkcol_tl{##1}
@@ -748,7 +748,7 @@
 }{
   % pdftex,luatex,xetex,dvipdfmx:
   % ocgcolorlinks that extend over line and page breaks
-  \cs_new_nopar:Nn\ocgxii_enable_ocglinks:{
+  \cs_new_protected_nopar:Nn\ocgxii_enable_ocglinks:{
     \def\Hy@colorlink##1{
       \ifx\Hy@setbreaklinks\@gobble\else
         \Hy@breaklinkstrue
@@ -861,12 +861,20 @@
   \@ifpackageloaded{hyperref}{
     \Hy@colorlinkstrue
     \AtBeginDocument{
-      \ocgbase_new_ocg:nnn{OCView}{/Print<</PrintState/OFF>>}{on}
+      \ocgbase_new_ocg:nnn{OCView}{
+        /Print<</PrintState/OFF>>
+        /Export<</ExportState/OFF>>
+      }{on}
       \tl_gset:Nx\ocgxii@OCView{\ocgbase_last_ocg:}
-      \tl_gset:cx{ocgxii@OCView.opts}{showingui=never,printocg=never}
-      \ocgbase_new_ocg:nnn{OCPrint}{/Print<</PrintState/ON>>}{off}
+      \tl_gset:cx{ocgxii@OCView.opts}{
+        showingui=never,printocg=never,exportocg=never}
+      \ocgbase_new_ocg:nnn{OCPrint}{
+        /Print<</PrintState/ON>>
+        /Export<</ExportState/ON>>
+      }{off}
       \tl_gset:Nx\ocgxii@OCPrint{\ocgbase_last_ocg:}
-      \tl_gset:cx{ocgxii@OCPrint.opts}{showingui=never,printocg=always}
+      \tl_gset:cx{ocgxii@OCPrint.opts}{
+        showingui=never,printocg=always,exportocg=always}
       \ocgxii_enable_ocglinks:
       \iow_now:Nx\@mainaux{
         \token_to_str:N\ocgxii@newkey{ocgx2.ocg.OCView}{\ocgxii@OCView}
-- 
cgit v1.2.3

