pdfbox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From til...@apache.org
Subject svn commit: r1825163 - /pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDActionEmbeddedGoTo.java
Date Fri, 23 Feb 2018 19:36:58 GMT
Author: tilman
Date: Fri Feb 23 19:36:58 2018
New Revision: 1825163

URL: http://svn.apache.org/viewvc?rev=1825163&view=rev
Log:
PDFBOX-4117: used (boxed) Boolean because missing parameter has a special meaning

Modified:
    pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDActionEmbeddedGoTo.java

Modified: pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDActionEmbeddedGoTo.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDActionEmbeddedGoTo.java?rev=1825163&r1=1825162&r2=1825163&view=diff
==============================================================================
--- pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDActionEmbeddedGoTo.java
(original)
+++ pdfbox/trunk/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/PDActionEmbeddedGoTo.java
Fri Feb 23 19:36:58 2018
@@ -20,6 +20,7 @@ import java.io.IOException;
 
 import org.apache.pdfbox.cos.COSArray;
 import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSBoolean;
 import org.apache.pdfbox.cos.COSDictionary;
 import org.apache.pdfbox.cos.COSName;
 import org.apache.pdfbox.pdmodel.common.filespecification.PDFileSpecification;
@@ -124,21 +125,36 @@ public class PDActionEmbeddedGoTo extend
      * entry is absent, the viewer application should behave in accordance with the current
user
      * preference.
      *
-     * @return A flag specifying whether to open the destination document in a new window.
+     * @return A flag specifying whether to open the destination document in a new window,
or null
+     * if the entry is absent.
      */
-    public boolean shouldOpenInNewWindow()
+    public Boolean shouldOpenInNewWindow()
     {
-        return getCOSObject().getBoolean("NewWindow", true);
+        if (getCOSObject().getDictionaryObject(COSName.NEW_WINDOW) instanceof COSBoolean)
+        {
+            return getCOSObject().getBoolean(COSName.NEW_WINDOW, true);
+        }
+        return null;
     }
 
     /**
-     * This will specify the destination document to open in a new window.
+     * This will specify whether to open the destination document in a new window. If this
flag is
+     * false, the destination document will replace the current document in the same window.
If this
+     * entry is absent, the viewer application should behave in accordance with the current
user
+     * preference.
      *
-     * @param value The flag value.
+     * @param value The flag value or null if the entry should be removed.
      */
-    public void setOpenInNewWindow(boolean value)
+    public void setOpenInNewWindow(Boolean value)
     {
-        getCOSObject().setBoolean("NewWindow", value);
+        if (value == null)
+        {
+            getCOSObject().removeItem(COSName.NEW_WINDOW);
+        }
+        else
+        {
+            getCOSObject().setBoolean(COSName.NEW_WINDOW, value);
+        }
     }
 
     /**



Mime
View raw message