01: /*
02: * Copyright (c) 2007, intarsys consulting GmbH
03: *
04: * Redistribution and use in source and binary forms, with or without
05: * modification, are permitted provided that the following conditions are met:
06: *
07: * - Redistributions of source code must retain the above copyright notice,
08: * this list of conditions and the following disclaimer.
09: *
10: * - Redistributions in binary form must reproduce the above copyright notice,
11: * this list of conditions and the following disclaimer in the documentation
12: * and/or other materials provided with the distribution.
13: *
14: * - Neither the name of intarsys nor the names of its contributors may be used
15: * to endorse or promote products derived from this software without specific
16: * prior written permission.
17: *
18: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28: * POSSIBILITY OF SUCH DAMAGE.
29: */
30: package de.intarsys.pdf.crypt;
31:
32: import de.intarsys.pdf.pd.AbstractBitFlags;
33:
34: /**
35: * A set of flags describing the access permissions for the document.
36: * <p>
37: * These flags are defined for the standard security handlers, you can not rely
38: * on other handlers implementing the same logic.
39: * <p>
40: * todo 2 refactor, make independent od StandardSecurityHandler
41: */
42: public abstract class AbstractAccessPermissions extends
43: AbstractBitFlags implements IAccessPermissions {
44: // Bit position 1-2 are reserved, must be zero
45: public static int Bit_Print = 1 << 2;
46:
47: public static int Bit_Modify = 1 << 3;
48:
49: public static int Bit_Copy = 1 << 4;
50:
51: public static int Bit_ModifyAnnotation = 1 << 5;
52:
53: // Bit position 7-8 are reserved, must be one
54: public static int Bit_FillForm = 1 << 8;
55:
56: public static int Bit_Extract = 1 << 9;
57:
58: public static int Bit_Assemble = 1 << 10;
59:
60: public static int Bit_PrintHighQuality = 1 << 11;
61:
62: // Bit position 13-32 are reserved, must be one
63:
64: /**
65: * The handler for the encryption dictionary.
66: */
67: protected StandardSecurityHandler handler;
68:
69: public AbstractAccessPermissions(StandardSecurityHandler handler) {
70: this .handler = handler;
71: }
72:
73: protected void setValue(int newValue) {
74: getHandler().setAccessPermissionValue(newValue);
75: }
76:
77: protected int getValue() {
78: return getHandler().getAccessPermissionValue();
79: }
80:
81: /**
82: * @return handler for the encryption dictionary.
83: */
84: public StandardSecurityHandler getHandler() {
85: return handler;
86: }
87: }
|