From f9847227d435563b8d1d02a802e446654f51fd70 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Sun, 14 Oct 2012 17:59:50 +0000
Subject: hyperref (14oct12)

git-svn-id: svn://tug.org/texlive/trunk@27965 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/hyperref/pdfmark.def | 96 ++++++++++++++++++++----
 1 file changed, 83 insertions(+), 13 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/hyperref/pdfmark.def')

diff --git a/Master/texmf-dist/tex/latex/hyperref/pdfmark.def b/Master/texmf-dist/tex/latex/hyperref/pdfmark.def
index d5fb37914d7..3ba3a695a3a 100644
--- a/Master/texmf-dist/tex/latex/hyperref/pdfmark.def
+++ b/Master/texmf-dist/tex/latex/hyperref/pdfmark.def
@@ -29,7 +29,7 @@
 %% given in the file `manifest.txt'.
 %%
 \ProvidesFile{pdfmark.def}
-  [2012/09/27 v6.83g %
+  [2012/10/13 v6.83j %
   Hyperref definitions for pdfmark specials]
 \Hy@VersionCheck{pdfmark.def}
 \begingroup
@@ -483,6 +483,7 @@
   \edef\@processme{\noexpand\pdf@toks={\the\pdf@defaulttoks}}%
   \@processme
   \let\pdf@type\relax
+  \let\pdf@objdef\ltx@empty
   \kvsetkeys{PDF}{#2}%
   \ifHy@pdfmarkerror
   \else
@@ -495,7 +496,12 @@
     \else
        \ifx\\#1\\%
          \literalps@out{%
-           [\the\pdf@toks\space\pdf@type\space pdfmark%
+           [%
+           \ifx\pdf@objdef\ltx@empty
+           \else
+             /_objdef\string{\pdf@objdef\string}%
+           \fi
+           \the\pdf@toks\space\pdf@type\space pdfmark%
          }%
        \else
          \ltx@IfUndefined{@\pdf@linktype color}{%
@@ -506,7 +512,12 @@
          }%
          \pdf@rect{#1}%
          \literalps@out{%
-           [\the\pdf@toks\space\pdf@type\space pdfmark%
+           [%
+           \ifx\pdf@objdef\ltx@empty
+           \else
+             /_objdef\string{\pdf@objdef\string}%
+           \fi
+           \the\pdf@toks\space\pdf@type\space pdfmark%
          }%
          \Hy@endcolorlink
        \fi
@@ -605,6 +616,8 @@
 \define@key{PDF}{pdfmark}{\def\pdf@type{#1}}
 \define@key{PDF}{linktype}{\def\pdf@linktype{#1}}
 \def\pdf@linktype{link}
+\define@key{PDF}{objdef}{\edef\pdf@objdef{#1}}
+\let\pdf@objdef\ltx@empty
 \define@key{PDF}{Raw}{\pdf@addtoksx{#1}}
 \define@key{PDF}{Action}{\pdf@addtoks{#1}{Action}}
 \define@key{PDF}{Border}{%
@@ -911,6 +924,10 @@
   /_objdef{afields}%
   /type/array%
 /OBJ pdfmark%
+[%
+  /_objdef{corder}%
+  /type/array%
+/OBJ pdfmark%
 {%
   [%
     /BBox[0 0 100 100]%
@@ -1011,10 +1028,6 @@
     /AcroForm{aform}%
   >>%
 /PUT pdfmark%
-[%
-  /_objdef{corder}%
-  /type/array%
-/OBJ pdfmark% dps
 }}%
   \kvsetkeys{Form}{#1}%
 }
@@ -1022,7 +1035,34 @@
 \def\@Gauge[#1]#2#3#4{% parameters, label, minimum, maximum
   \Hy@Message{Sorry, pdfmark drivers do not support FORM gauges}%
 }
+\newcount\HyField@AnnotCount
+\HyField@AnnotCount=\z@
+\def\HyField@AdvanceAnnotCount{%
+  \global\advance\HyField@AnnotCount\@ne
+}
+\def\HyField@TheAnnotCount{%
+  \the\HyField@AnnotCount
+}
 \edef\Fld@pageobjref{/P\string{ThisPage\string}}
+\def\HyField@AddToFields#1{%
+  \pdfmark{%
+    pdfmark=/APPEND,%
+    Raw={%
+      \string{afields\string}%
+      \string{#1\HyField@TheAnnotCount\string}%
+    }%
+  }%
+  \ifx\Fld@calculate@code\ltx@empty
+  \else
+    \pdfmark{%
+      pdfmark=/APPEND,%
+      Raw={%
+        \string{corder\string}%
+        \string{#1\HyField@TheAnnotCount\string}%
+      }%
+    }%
+  \fi
+}
 \def\@TextField[#1]#2{% parameters, label
   \def\Fld@name{#2}%
   \let\Fld@default\ltx@empty
@@ -1042,13 +1082,17 @@
     \HyField@FlagsText
     \ifFld@hidden\def\Fld@width{1sp}\fi
     \ifx\Fld@value\@empty\def\Fld@value{\Fld@default}\fi
+    \HyField@AdvanceAnnotCount
     \LayoutTextField{#2}{%
       \leavevmode
       \Hy@escapeform\PDFForm@Text
       \pdfmark[\MakeTextField{\Fld@width}{\Fld@height}]{%
-        pdfmark=/ANN,Raw={\PDFForm@Text}%
+        pdfmark=/ANN,%
+        objdef=text\HyField@TheAnnotCount,%
+        Raw={\PDFForm@Text}%
       }%
     }%
+    \HyField@AddToFields{text}%
   \endgroup
 }
 \def\@ChoiceMenu[#1]#2#3{% parameters, label, choices
@@ -1128,21 +1172,32 @@
     \Hy@StepCount\Fld@listcount
     \@currDisplay\space
     \Hy@escapeform\PDFForm@Radio
+    \ifnum\Fld@listcount=1 %
+      \HyField@AdvanceAnnotCount
+    \fi
     \pdfmark[\MakeRadioField{\Fld@width}{\Fld@height}]{%
       pdfmark=/ANN,%
+      objdef=\ifnum\Fld@listcount=1 radio\HyField@TheAnnotCount\fi,%
       Raw={%
         \PDFForm@Radio /AP <</N <</\@currValue\space {Check}>> >>%
       }%
     } % deliberate space between radio buttons
+    \ifnum\Fld@listcount=1 %
+      \HyField@AddToFields{radio}%
+    \fi
   }%
 }
 \newcount\Fld@listcount
 \def\@@Listbox#1{%
   \HyField@PDFChoices{#1}%
   \Hy@escapeform\PDFForm@List
+  \HyField@AdvanceAnnotCount
   \pdfmark[\MakeChoiceField{\Fld@width}{\Fld@height}]{%
-    pdfmark=/ANN,Raw={\PDFForm@List}%
+    pdfmark=/ANN,%
+    objdef=list\HyField@TheAnnotCount,%
+    Raw={\PDFForm@List}%
   }%
+  \HyField@AddToFields{list}%
 }
 \def\@PushButton[#1]#2{% parameters, label
   \def\Fld@name{#2}%
@@ -1161,13 +1216,17 @@
     \else
       \HyField@FlagsPushButton
       \ifFld@hidden\def\Fld@width{1sp}\fi
+      \HyField@AdvanceAnnotCount
       \LayoutPushButtonField{%
         \leavevmode
         \Hy@escapeform\PDFForm@Push
         \pdfmark[\MakeButtonField{#2}]{%
-          pdfmark=/ANN,Raw={\PDFForm@Push}%
+          pdfmark=/ANN,%
+          objdef=push\HyField@TheAnnotCount,%
+          Raw={\PDFForm@Push}%
         }%
       }%
+      \HyField@AddToFields{push}%
     \fi
   \endgroup
 }
@@ -1182,10 +1241,13 @@
     \HyField@FlagsSubmit
     \ifFld@hidden\def\Fld@width{1sp}\fi
     \Hy@escapeform\PDFForm@Submit
+    \HyField@AdvanceAnnotCount
     \pdfmark[\MakeButtonField{#2}]{%
       pdfmark=/ANN,%
-      Raw={\PDFForm@Submit /AP << /N {Submit} /D {SubmitP} >>}%
+      objdef=submit\HyField@TheAnnotCount,%
+      Raw={\PDFForm@Submit /AP<</N{Submit}/D{SubmitP}>>}%
     }%
+    \HyField@AddToFields{submit}%
   \endgroup
 }
 \def\@Reset[#1]#2{%
@@ -1205,9 +1267,13 @@
       \HyField@FlagsPushButton
       \ifFld@hidden\def\Fld@width{1sp}\fi
       \Hy@escapeform\PDFForm@Reset
+      \HyField@AdvanceAnnotCount
       \pdfmark[\MakeButtonField{#2}]{%
-        pdfmark=/ANN,Raw={\PDFForm@Reset}%
+        pdfmark=/ANN,%
+        objdef=reset\HyField@TheAnnotCount,%
+        Raw={\PDFForm@Reset}%
       }%
+      \HyField@AddToFields{reset}%
     \fi
   \endgroup
 }%
@@ -1222,13 +1288,17 @@
     }%
     \HyField@FlagsCheckBox
     \ifFld@hidden\def\Fld@width{1sp}\fi
+    \HyField@AdvanceAnnotCount
     \LayoutCheckField{#2}{%
       \leavevmode
       \Hy@escapeform\PDFForm@Check
       \pdfmark[\MakeCheckField{\Fld@width}{\Fld@height}]{%
-        pdfmark=/ANN,Raw={\PDFForm@Check}%
+        pdfmark=/ANN,%
+        objdef=check\HyField@TheAnnotCount,%
+        Raw={\PDFForm@Check}%
       }%
     }%
+    \HyField@AddToFields{check}%
   \endgroup
 }
 \providecommand*{\Fld@pageobjref}{}
-- 
cgit v1.2.3

