001: /*
002: * Copyright (c) 2007, intarsys consulting GmbH
003: *
004: * Redistribution and use in source and binary forms, with or without
005: * modification, are permitted provided that the following conditions are met:
006: *
007: * - Redistributions of source code must retain the above copyright notice,
008: * this list of conditions and the following disclaimer.
009: *
010: * - Redistributions in binary form must reproduce the above copyright notice,
011: * this list of conditions and the following disclaimer in the documentation
012: * and/or other materials provided with the distribution.
013: *
014: * - Neither the name of intarsys nor the names of its contributors may be used
015: * to endorse or promote products derived from this software without specific
016: * prior written permission.
017: *
018: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
019: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
020: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
021: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
022: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
023: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
024: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
025: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
026: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
027: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
028: * POSSIBILITY OF SUCH DAMAGE.
029: */
030: package de.intarsys.pdf.pd;
031:
032: /**
033: * The flags for subimtting a form
034: * <p>
035: * The flags are bits of an integer.<br>
036: * The following bits are defined (more may exist).
037: * </p>
038: * <ul>
039: * <li>0: include
040: * <li>1: include no value fields
041: * <li>2: export format
042: * <li>3: get method
043: * <li>4: submit coordinates
044: * <li>5: XFDF
045: * <li>6: include append saves
046: * <li>7: include annotations
047: * <li>8: submit PDF
048: * <li>9: canonical format
049: * <li>10: exclude non user annotations
050: * <li>11: exclude F key
051: * <li>12: not defined
052: * <li>13: embed form
053: * </ul>
054: */
055: public class SubmitFormFlags extends AbstractBitFlags {
056: static public final int Bit_Include = 1; // Bit position 1
057:
058: static public final int Bit_IncludeNoValueFields = 1 << 1; // Bit pos 2
059:
060: static public final int Bit_ExportFormat = 1 << 2; // Bit pos 3
061:
062: static public final int Bit_GetMethod = 1 << 3;
063:
064: static public final int Bit_SubmitCoordinates = 1 << 4;
065:
066: static public final int Bit_XFDF = 1 << 5;
067:
068: static public final int Bit_IncludeAppendSaves = 1 << 6;
069:
070: static public final int Bit_IncludeAnnotations = 1 << 7;
071:
072: static public final int Bit_SubmitPDF = 1 << 8;
073:
074: static public final int Bit_CanonicalFormat = 1 << 9;
075:
076: static public final int Bit_ExclNonUserAnnots = 1 << 10;
077:
078: static public final int Bit_ExclFKey = 1 << 11;
079:
080: static public final int Bit_NotDEFINED = 1 << 12;
081:
082: static public final int Bit_EmbedForm = 1 << 13;
083:
084: private PDActionSubmitForm submitForm;
085:
086: public SubmitFormFlags(PDActionSubmitForm submitForm) {
087: this .submitForm = submitForm;
088: }
089:
090: public void setCanonicalFormat(boolean flag) {
091: set(Bit_CanonicalFormat, flag);
092: }
093:
094: public boolean isCanonicalFormat() {
095: return isSetAnd(Bit_CanonicalFormat);
096: }
097:
098: public void setEmbedForm(boolean flag) {
099: set(Bit_EmbedForm, flag);
100: }
101:
102: public boolean isEmbedForm() {
103: return isSetAnd(Bit_EmbedForm);
104: }
105:
106: public void setExclFKey(boolean flag) {
107: set(Bit_ExclFKey, flag);
108: }
109:
110: public boolean isExclFKey() {
111: return isSetAnd(Bit_ExclFKey);
112: }
113:
114: public void setExclNonUserAnnots(boolean flag) {
115: set(Bit_ExclNonUserAnnots, flag);
116: }
117:
118: public boolean isExclNonUserAnnots() {
119: return isSetAnd(Bit_ExclNonUserAnnots);
120: }
121:
122: public void setExportFormat(boolean flag) {
123: set(Bit_ExportFormat, flag);
124: }
125:
126: public boolean isExportFormat() {
127: return isSetAnd(Bit_ExportFormat);
128: }
129:
130: public void setGetMethod(boolean flag) {
131: set(Bit_GetMethod, flag);
132: }
133:
134: public boolean isGetMethod() {
135: return isSetAnd(Bit_GetMethod);
136: }
137:
138: public void setInclude(boolean flag) {
139: set(Bit_Include, flag);
140: }
141:
142: public boolean isInclude() {
143: return isSetAnd(Bit_Include);
144: }
145:
146: public void setIncludeAnnotations(boolean flag) {
147: set(Bit_IncludeAnnotations, flag);
148: }
149:
150: public boolean isIncludeAnnotations() {
151: return isSetAnd(Bit_IncludeAnnotations);
152: }
153:
154: public void setIncludeAppendSaves(boolean flag) {
155: set(Bit_IncludeAppendSaves, flag);
156: }
157:
158: public boolean isIncludeAppendSaves() {
159: return isSetAnd(Bit_IncludeAppendSaves);
160: }
161:
162: public void setIncludeNoValueFields(boolean flag) {
163: set(Bit_IncludeNoValueFields, flag);
164: }
165:
166: public boolean isIncludeNoValueFields() {
167: return isSetAnd(Bit_IncludeNoValueFields);
168: }
169:
170: public void setNotDEFINED(boolean flag) {
171: set(Bit_NotDEFINED, flag);
172: }
173:
174: public boolean isNotDEFINED() {
175: return isSetAnd(Bit_NotDEFINED);
176: }
177:
178: public void setSubmitCoordinates(boolean flag) {
179: set(Bit_SubmitCoordinates, flag);
180: }
181:
182: public boolean isSubmitCoordinates() {
183: return isSetAnd(Bit_SubmitCoordinates);
184: }
185:
186: public void setSubmitPDF(boolean flag) {
187: set(Bit_SubmitPDF, flag);
188: }
189:
190: public boolean isSubmitPDF() {
191: return isSetAnd(Bit_SubmitPDF);
192: }
193:
194: public void setXFDF(boolean flag) {
195: set(Bit_XFDF, flag);
196: }
197:
198: public boolean isXFDF() {
199: return isSetAnd(Bit_XFDF);
200: }
201:
202: protected PDActionSubmitForm getSubmitForm() {
203: return submitForm;
204: }
205:
206: /*
207: * (non-Javadoc)
208: *
209: * @see de.intarsys.pdf.pd.AbstractBitFlags#setValue(int)
210: */
211: protected void setValue(int newValue) {
212: getSubmitForm().basicSetFlags(newValue);
213: }
214:
215: protected int getValue() {
216: return getSubmitForm().basicGetFlags();
217: }
218: }
|