2 * Licensed to the Apache Software Foundation (ASF) under one or more
\r
3 * contributor license agreements. See the NOTICE file distributed with
\r
4 * this work for additional information regarding copyright ownership.
\r
5 * The ASF licenses this file to You under the Apache License, Version 2.0
\r
6 * (the "License"); you may not use this file except in compliance with
\r
7 * the License. You may obtain a copy of the License at
\r
9 * http://www.apache.org/licenses/LICENSE-2.0
\r
11 * Unless required by applicable law or agreed to in writing, software
\r
12 * distributed under the License is distributed on an "AS IS" BASIS,
\r
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 * See the License for the specific language governing permissions and
\r
15 * limitations under the License.
\r
17 package org.apache.pdfbox.pdmodel.interactive.action;
\r
19 import org.apache.pdfbox.cos.COSBase;
\r
20 import org.apache.pdfbox.cos.COSDictionary;
\r
22 import org.apache.pdfbox.pdmodel.common.COSObjectable;
\r
23 import org.apache.pdfbox.pdmodel.interactive.action.type.PDAction;
\r
26 * This class represents a document catalog's dictionary of actions
\r
27 * that occur due to events.
\r
29 * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
\r
30 * @author Panagiotis Toumasis (ptoumasis@mail.gr)
\r
31 * @version $Revision: 1.2 $
\r
33 public class PDDocumentCatalogAdditionalActions implements COSObjectable
\r
35 private COSDictionary actions;
\r
38 * Default constructor.
\r
40 public PDDocumentCatalogAdditionalActions()
\r
42 actions = new COSDictionary();
\r
48 * @param a The action dictionary.
\r
50 public PDDocumentCatalogAdditionalActions( COSDictionary a )
\r
56 * Convert this standard java object to a COS object.
\r
58 * @return The cos object that matches this Java object.
\r
60 public COSBase getCOSObject()
\r
66 * Convert this standard java object to a COS object.
\r
68 * @return The cos object that matches this Java object.
\r
70 public COSDictionary getCOSDictionary()
\r
76 * This will get a JavaScript action to be performed
\r
77 * before closing a document.
\r
78 * The name WC stands for "will close".
\r
80 * @return The WC entry of document catalog's additional actions dictionary.
\r
82 public PDAction getWC()
\r
84 COSDictionary wc = (COSDictionary)actions.getDictionaryObject( "WC" );
\r
85 PDAction retval = null;
\r
88 retval = PDActionFactory.createAction( wc );
\r
94 * This will set a JavaScript action to be performed
\r
95 * before closing a document.
\r
96 * The name WC stands for "will close".
\r
98 * @param wc The action to be performed.
\r
100 public void setWC( PDAction wc )
\r
102 actions.setItem( "WC", wc );
\r
106 * This will get a JavaScript action to be performed
\r
107 * before saving a document.
\r
108 * The name WS stands for "will save".
\r
110 * @return The WS entry of document catalog's additional actions dictionary.
\r
112 public PDAction getWS()
\r
114 COSDictionary ws = (COSDictionary)actions.getDictionaryObject( "WS" );
\r
115 PDAction retval = null;
\r
118 retval = PDActionFactory.createAction( ws );
\r
124 * This will set a JavaScript action to be performed
\r
125 * before saving a document.
\r
126 * The name WS stands for "will save".
\r
128 * @param ws The action to be performed.
\r
130 public void setWS( PDAction ws )
\r
132 actions.setItem( "WS", ws );
\r
136 * This will get a JavaScript action to be performed
\r
137 * after saving a document.
\r
138 * The name DS stands for "did save".
\r
140 * @return The DS entry of document catalog's additional actions dictionary.
\r
142 public PDAction getDS()
\r
144 COSDictionary ds = (COSDictionary)actions.getDictionaryObject( "DS" );
\r
145 PDAction retval = null;
\r
148 retval = PDActionFactory.createAction( ds );
\r
154 * This will set a JavaScript action to be performed
\r
155 * after saving a document.
\r
156 * The name DS stands for "did save".
\r
158 * @param ds The action to be performed.
\r
160 public void setDS( PDAction ds )
\r
162 actions.setItem( "DS", ds );
\r
166 * This will get a JavaScript action to be performed
\r
167 * before printing a document.
\r
168 * The name WP stands for "will print".
\r
170 * @return The WP entry of document catalog's additional actions dictionary.
\r
172 public PDAction getWP()
\r
174 COSDictionary wp = (COSDictionary)actions.getDictionaryObject( "WP" );
\r
175 PDAction retval = null;
\r
178 retval = PDActionFactory.createAction( wp );
\r
184 * This will set a JavaScript action to be performed
\r
185 * before printing a document.
\r
186 * The name WP stands for "will print".
\r
188 * @param wp The action to be performed.
\r
190 public void setWP( PDAction wp )
\r
192 actions.setItem( "WP", wp );
\r
196 * This will get a JavaScript action to be performed
\r
197 * after printing a document.
\r
198 * The name DP stands for "did print".
\r
200 * @return The DP entry of document catalog's additional actions dictionary.
\r
202 public PDAction getDP()
\r
204 COSDictionary dp = (COSDictionary)actions.getDictionaryObject( "DP" );
\r
205 PDAction retval = null;
\r
208 retval = PDActionFactory.createAction( dp );
\r
214 * This will set a JavaScript action to be performed
\r
215 * after printing a document.
\r
216 * The name DP stands for "did print".
\r
218 * @param dp The action to be performed.
\r
220 public void setDP( PDAction dp )
\r
222 actions.setItem( "DP", dp );
\r