You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by le...@apache.org on 2010/01/28 21:28:37 UTC

svn commit: r904255 - in /pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel: PDDocumentCatalog.java interactive/action/type/PDActionURI.java interactive/action/type/PDURIDictionary.java

Author: lehmi
Date: Thu Jan 28 20:28:37 2010
New Revision: 904255

URL: http://svn.apache.org/viewvc?rev=904255&view=rev
Log:
PDFBOX-596: moved PDActionURI.getBase() to the new class PDURIDictionary. Thanks to to Johannes Koch (johannes dot koch at fit dot fraunhofer dot de) for his contribution

Added:
    pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDURIDictionary.java   (with props)
Modified:
    pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java
    pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDActionURI.java

Modified: pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java?rev=904255&r1=904254&r2=904255&view=diff
==============================================================================
--- pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java (original)
+++ pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/PDDocumentCatalog.java Thu Jan 28 20:28:37 2010
@@ -33,7 +33,7 @@
 import org.apache.pdfbox.pdmodel.common.PDMetadata;
 import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDMarkInfo;
 import org.apache.pdfbox.pdmodel.documentinterchange.logicalstructure.PDStructureTreeRoot;
-import org.apache.pdfbox.pdmodel.interactive.action.type.PDActionURI;
+import org.apache.pdfbox.pdmodel.interactive.action.type.PDURIDictionary;
 import org.apache.pdfbox.pdmodel.interactive.action.PDActionFactory;
 import org.apache.pdfbox.pdmodel.interactive.action.PDDocumentCatalogAdditionalActions;
 import org.apache.pdfbox.pdmodel.interactive.documentnavigation.destination.PDDestination;
@@ -484,13 +484,13 @@
      * Document level information in the URI.
      * @return Document level URI.
      */
-    public PDActionURI getURI()
+    public PDURIDictionary getURI()
     {
-        PDActionURI retval = null;
+        PDURIDictionary retval = null;
         COSDictionary uri = (COSDictionary)root.getDictionaryObject( "URI" );
         if( uri != null )
         {
-            retval = new PDActionURI( uri );
+            retval = new PDURIDictionary( uri );
         }
         return retval;
     }
@@ -499,7 +499,7 @@
      * Set the document level uri.
      * @param uri The new document level uri.
      */
-    public void setURI( PDActionURI uri )
+    public void setURI( PDURIDictionary uri )
     {
         root.setItem( "URI", uri );
     }

Modified: pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDActionURI.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDActionURI.java?rev=904255&r1=904254&r2=904255&view=diff
==============================================================================
--- pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDActionURI.java (original)
+++ pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDActionURI.java Thu Jan 28 20:28:37 2010
@@ -124,7 +124,7 @@
      */
     public boolean shouldTrackMousePosition()
     {
-        return action.getBoolean( "MousePosition", true );
+        return this.action.getBoolean("IsMap", false);
     }
 
     /**
@@ -134,9 +134,10 @@
      */
     public void setTrackMousePosition( boolean value )
     {
-        action.setBoolean( "MousePosition", value );
+        this.action.setBoolean("IsMap", value);
     }
 
+    // TODO this must go into PDURIDictionary
     /**
      * This will get the base URI to be used in resolving relative URI references.
      * URI actions within the document may specify URIs in partial form, to be interpreted
@@ -146,12 +147,14 @@
      * in the HTML 4.01 Specification.
      *
      * @return The URI entry of the specific URI dictionary.
+     * @deprecated use {@link PDURIDictionary#getBase()} instead
      */
     public String getBase()
     {
         return action.getString( "Base" );
     }
 
+    // TODO this must go into PDURIDictionary
     /**
      * This will set the base URI to be used in resolving relative URI references.
      * URI actions within the document may specify URIs in partial form, to be interpreted
@@ -161,6 +164,7 @@
      * in the HTML 4.01 Specification.
      *
      * @param base The the base URI to be used.
+     * @deprecated use {@link PDURIDictionary#setBase(String)} instead
      */
     public void setBase( String base )
     {

Added: pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDURIDictionary.java
URL: http://svn.apache.org/viewvc/pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDURIDictionary.java?rev=904255&view=auto
==============================================================================
--- pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDURIDictionary.java (added)
+++ pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDURIDictionary.java Thu Jan 28 20:28:37 2010
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pdfbox.pdmodel.interactive.action.type;
+
+import org.apache.pdfbox.cos.COSBase;
+import org.apache.pdfbox.cos.COSDictionary;
+import org.apache.pdfbox.pdmodel.common.COSObjectable;
+
+/**
+ * This is the implementation of an URI dictionary.
+ *
+ * @version $Revision: 1.0 $
+ *
+ */
+public class PDURIDictionary implements COSObjectable
+{
+
+    private COSDictionary uriDictionary;
+
+    /**
+     * Constructor.
+     * 
+     */
+    public PDURIDictionary()
+    {
+        this.uriDictionary = new COSDictionary();
+    }
+
+    /**
+     * Constructor.
+     * 
+     * @param dictionary the corresponding dictionary
+     */
+    public PDURIDictionary(COSDictionary dictionary)
+    {
+        this.uriDictionary = dictionary;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public COSBase getCOSObject()
+    {
+        return this.uriDictionary;
+    }
+
+    /**
+     * Returns the corresponding dictionary.
+     * @return the dictionary
+     */
+    public COSDictionary getDictionary()
+    {
+        return this.uriDictionary;
+    }
+
+    /**
+     * This will get the base URI to be used in resolving relative URI references.
+     * URI actions within the document may specify URIs in partial form, to be interpreted
+     * relative to this base address. If no base URI is specified, such partial URIs
+     * will be interpreted relative to the location of the document itself.
+     * The use of this entry is parallel to that of the body element <BASE>, as described
+     * in the HTML 4.01 Specification.
+     *
+     * @return The URI entry of the specific URI dictionary.
+     */
+    public String getBase()
+    {
+        return this.getDictionary().getString("Base");
+    }
+
+    /**
+     * This will set the base URI to be used in resolving relative URI references.
+     * URI actions within the document may specify URIs in partial form, to be interpreted
+     * relative to this base address. If no base URI is specified, such partial URIs
+     * will be interpreted relative to the location of the document itself.
+     * The use of this entry is parallel to that of the body element <BASE>, as described
+     * in the HTML 4.01 Specification.
+     *
+     * @param base The the base URI to be used.
+     */
+    public void setBase(String base)
+    {
+        this.getDictionary().setString("Base", base);
+    }
+
+}

Propchange: pdfbox/trunk/src/main/java/org/apache/pdfbox/pdmodel/interactive/action/type/PDURIDictionary.java
------------------------------------------------------------------------------
    svn:eol-style = native