• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef XFA_FXFA_FXFA_BASIC_H_
8 #define XFA_FXFA_FXFA_BASIC_H_
9 
10 #include "fxjs/fxjse.h"
11 
12 class CJX_Object;
13 class CXFA_Measurement;
14 enum class XFA_ObjectType;
15 
16 enum XFA_HashCode : uint32_t {
17   XFA_HASHCODE_None = 0,
18 
19   XFA_HASHCODE_Config = 0x4e1e39b6,
20   XFA_HASHCODE_ConnectionSet = 0xe14c801c,
21   XFA_HASHCODE_Data = 0xbde9abda,
22   XFA_HASHCODE_DataDescription = 0x2b5df51e,
23   XFA_HASHCODE_Datasets = 0x99b95079,
24   XFA_HASHCODE_DataWindow = 0x83a550d2,
25   XFA_HASHCODE_Event = 0x185e41e2,
26   XFA_HASHCODE_Form = 0xcd309ff4,
27   XFA_HASHCODE_Group = 0xf7f75fcd,
28   XFA_HASHCODE_Host = 0xdb075bde,
29   XFA_HASHCODE_Layout = 0x7e7e845e,
30   XFA_HASHCODE_LocaleSet = 0x5473b6dc,
31   XFA_HASHCODE_Log = 0x0b1b3d22,
32   XFA_HASHCODE_Name = 0x31b19c1,
33   XFA_HASHCODE_Occur = 0xf7eebe1c,
34   XFA_HASHCODE_Pdf = 0xb843dba,
35   XFA_HASHCODE_Record = 0x5779d65f,
36   XFA_HASHCODE_Signature = 0x8b036f32,
37   XFA_HASHCODE_SourceSet = 0x811929d,
38   XFA_HASHCODE_Stylesheet = 0x6038580a,
39   XFA_HASHCODE_Template = 0x803550fc,
40   XFA_HASHCODE_This = 0x2d574d58,
41   XFA_HASHCODE_Xdc = 0xc56afbf,
42   XFA_HASHCODE_XDP = 0xc56afcc,
43   XFA_HASHCODE_Xfa = 0xc56b9ff,
44   XFA_HASHCODE_Xfdf = 0x48d004a8,
45   XFA_HASHCODE_Xmpmeta = 0x132a8fbc
46 };
47 
48 enum class XFA_PacketType : uint8_t {
49   User,
50   SourceSet,
51   Pdf,
52   Xdc,
53   Xdp,
54   Xmpmeta,
55   Xfdf,
56   Config,
57   LocaleSet,
58   Stylesheet,
59   Template,
60   Signature,
61   Datasets,
62   Form,
63   ConnectionSet,
64 };
65 
66 enum XFA_XDPPACKET {
67   XFA_XDPPACKET_UNKNOWN = 0,
68   XFA_XDPPACKET_Config = 1 << static_cast<uint8_t>(XFA_PacketType::Config),
69   XFA_XDPPACKET_Template = 1 << static_cast<uint8_t>(XFA_PacketType::Template),
70   XFA_XDPPACKET_Datasets = 1 << static_cast<uint8_t>(XFA_PacketType::Datasets),
71   XFA_XDPPACKET_Form = 1 << static_cast<uint8_t>(XFA_PacketType::Form),
72   XFA_XDPPACKET_LocaleSet = 1
73                             << static_cast<uint8_t>(XFA_PacketType::LocaleSet),
74   XFA_XDPPACKET_ConnectionSet =
75       1 << static_cast<uint8_t>(XFA_PacketType::ConnectionSet),
76   XFA_XDPPACKET_SourceSet = 1
77                             << static_cast<uint8_t>(XFA_PacketType::SourceSet),
78   XFA_XDPPACKET_Xdc = 1 << static_cast<uint8_t>(XFA_PacketType::Xdc),
79   XFA_XDPPACKET_Pdf = 1 << static_cast<uint8_t>(XFA_PacketType::Pdf),
80   XFA_XDPPACKET_Xfdf = 1 << static_cast<uint8_t>(XFA_PacketType::Xfdf),
81   XFA_XDPPACKET_Xmpmeta = 1 << static_cast<uint8_t>(XFA_PacketType::Xmpmeta),
82   XFA_XDPPACKET_Signature = 1
83                             << static_cast<uint8_t>(XFA_PacketType::Signature),
84   XFA_XDPPACKET_Stylesheet =
85       1 << static_cast<uint8_t>(XFA_PacketType::Stylesheet),
86   XFA_XDPPACKET_USER = 1 << static_cast<uint8_t>(XFA_PacketType::User),
87   XFA_XDPPACKET_XDP = 1 << static_cast<uint8_t>(XFA_PacketType::Xdp)
88 };
89 
90 enum XFA_XDPPACKET_FLAGS {
91   XFA_XDPPACKET_FLAGS_COMPLETEMATCH = 1,
92   XFA_XDPPACKET_FLAGS_PREFIXMATCH = 2,
93   XFA_XDPPACKET_FLAGS_NOMATCH = 4,
94   XFA_XDPPACKET_FLAGS_SUPPORTONE = 8,
95   XFA_XDPPACKET_FLAGS_SUPPORTMANY = 16,
96 };
97 
98 enum class XFA_AttributeEnum : uint32_t {
99   Asterisk,
100   Slash,
101   Backslash,
102   On,
103   Tb,
104   Up,
105   MetaData,
106   Delegate,
107   PostSubmit,
108   Name,
109   Cross,
110   Next,
111   None,
112   ShortEdge,
113   Checksum_1mod10_1mod11,
114   Height,
115   CrossDiagonal,
116   All,
117   Any,
118   ToRight,
119   MatchTemplate,
120   Dpl,
121   Invisible,
122   Fit,
123   Width,
124   PreSubmit,
125   Ipl,
126   FlateCompress,
127   Med,
128   Odd,
129   Off,
130   Pdf,
131   Row,
132   Top,
133   Xdp,
134   Xfd,
135   Xml,
136   Zip,
137   Zpl,
138   Visible,
139   Exclude,
140   MouseEnter,
141   Pair,
142   Filter,
143   MoveLast,
144   ExportAndImport,
145   Push,
146   Portrait,
147   Default,
148   StoredProc,
149   StayBOF,
150   StayEOF,
151   PostPrint,
152   UsCarrier,
153   Right,
154   PreOpen,
155   Actual,
156   Rest,
157   TopCenter,
158   StandardSymbol,
159   Initialize,
160   JustifyAll,
161   Normal,
162   Landscape,
163   NonInteractive,
164   MouseExit,
165   Minus,
166   DiagonalLeft,
167   SimplexPaginated,
168   Document,
169   Warning,
170   Auto,
171   Below,
172   BottomLeft,
173   BottomCenter,
174   Tcpl,
175   Text,
176   Grouping,
177   SecureSymbol,
178   PreExecute,
179   DocClose,
180   Keyset,
181   Vertical,
182   PreSave,
183   PreSign,
184   Bottom,
185   ToTop,
186   Verify,
187   First,
188   ContentArea,
189   Solid,
190   Pessimistic,
191   DuplexPaginated,
192   Round,
193   Remerge,
194   Ordered,
195   Percent,
196   Even,
197   Exit,
198   ToolTip,
199   OrderedOccurrence,
200   ReadOnly,
201   Currency,
202   Concat,
203   Thai,
204   Embossed,
205   Formdata,
206   Greek,
207   Decimal,
208   Select,
209   LongEdge,
210   Protected,
211   BottomRight,
212   Zero,
213   ForwardOnly,
214   DocReady,
215   Hidden,
216   Include,
217   Dashed,
218   MultiSelect,
219   Inactive,
220   Embed,
221   Static,
222   OnEntry,
223   Cyrillic,
224   NonBlank,
225   TopRight,
226   Hebrew,
227   TopLeft,
228   Center,
229   MoveFirst,
230   Diamond,
231   PageOdd,
232   Checksum_1mod10,
233   Korean,
234   AboveEmbedded,
235   ZipCompress,
236   Numeric,
237   Circle,
238   ToBottom,
239   Inverted,
240   Update,
241   Isoname,
242   Server,
243   Position,
244   MiddleCenter,
245   Optional,
246   UsePrinterSetting,
247   Outline,
248   IndexChange,
249   Change,
250   PageArea,
251   Once,
252   Only,
253   Open,
254   Caption,
255   Raised,
256   Justify,
257   RefAndDescendants,
258   Short,
259   PageFront,
260   Monospace,
261   Middle,
262   PrePrint,
263   Always,
264   Unknown,
265   ToLeft,
266   Above,
267   DashDot,
268   Gregorian,
269   Roman,
270   MouseDown,
271   Symbol,
272   PageEven,
273   Sign,
274   AddNew,
275   Star,
276   Optimistic,
277   Rl_tb,
278   MiddleRight,
279   Maintain,
280   Package,
281   SimplifiedChinese,
282   ToCenter,
283   Back,
284   Unspecified,
285   BatchOptimistic,
286   Bold,
287   Both,
288   Butt,
289   Client,
290   Checksum_2mod10,
291   ImageOnly,
292   Horizontal,
293   Dotted,
294   UserControl,
295   DiagonalRight,
296   ConsumeData,
297   Check,
298   Data,
299   Down,
300   SansSerif,
301   Inline,
302   TraditionalChinese,
303   Warn,
304   RefOnly,
305   InteractiveForms,
306   Word,
307   Unordered,
308   Required,
309   ImportOnly,
310   BelowEmbedded,
311   Japanese,
312   Full,
313   Rl_row,
314   Vietnamese,
315   EastEuropeanRoman,
316   MouseUp,
317   ExportOnly,
318   Clear,
319   Click,
320   Base64,
321   Close,
322   Host,
323   Global,
324   Blank,
325   Table,
326   Import,
327   Custom,
328   MiddleLeft,
329   PostExecute,
330   Radix,
331   PostOpen,
332   Enter,
333   Ignore,
334   Lr_tb,
335   Fantasy,
336   Italic,
337   Author,
338   ToEdge,
339   Choice,
340   Disabled,
341   CrossHatch,
342   DataRef,
343   DashDotDot,
344   Square,
345   Dynamic,
346   Manual,
347   Etched,
348   ValidationState,
349   Cursive,
350   Last,
351   Left,
352   Link,
353   Long,
354   InternationalCarrier,
355   PDF1_3,
356   PDF1_6,
357   Serif,
358   PostSave,
359   Ready,
360   PostSign,
361   Arabic,
362   Error,
363   Urlencoded,
364   Lowered
365 };
366 
367 enum class XFA_Attribute : uint8_t {
368   H = 0,
369   W,
370   X,
371   Y,
372   Id,
373   To,
374   LineThrough,
375   HAlign,
376   Typeface,
377   BeforeTarget,
378   Name,
379   Next,
380   DataRowCount,
381   Break,
382   VScrollPolicy,
383   FontHorizontalScale,
384   TextIndent,
385   Context,
386   TrayOut,
387   Cap,
388   Max,
389   Min,
390   Ref,
391   Rid,
392   Url,
393   Use,
394   LeftInset,
395   Widows,
396   Level,
397   BottomInset,
398   OverflowTarget,
399   AllowMacro,
400   PagePosition,
401   ColumnWidths,
402   OverflowLeader,
403   Action,
404   NonRepudiation,
405   Rate,
406   AllowRichText,
407   Role,
408   OverflowTrailer,
409   Operation,
410   Timeout,
411   TopInset,
412   Access,
413   CommandType,
414   Format,
415   DataPrep,
416   WidgetData,
417   Abbr,
418   MarginRight,
419   DataDescription,
420   EncipherOnly,
421   KerningMode,
422   Rotate,
423   WordCharacterCount,
424   Type,
425   Reserve,
426   TextLocation,
427   Priority,
428   Underline,
429   ModuleWidth,
430   Hyphenate,
431   Listen,
432   Delimiter,
433   ContentType,
434   StartNew,
435   EofAction,
436   AllowNeutral,
437   Connection,
438   BaselineShift,
439   OverlinePeriod,
440   FracDigits,
441   Orientation,
442   TimeStamp,
443   PrintCheckDigit,
444   MarginLeft,
445   Stroke,
446   ModuleHeight,
447   TransferEncoding,
448   Usage,
449   Presence,
450   RadixOffset,
451   Preserve,
452   AliasNode,
453   MultiLine,
454   Version,
455   StartChar,
456   ScriptTest,
457   StartAngle,
458   CursorType,
459   DigitalSignature,
460   CodeType,
461   Output,
462   BookendTrailer,
463   ImagingBBox,
464   ExcludeInitialCap,
465   Force,
466   CrlSign,
467   Previous,
468   PushCharacterCount,
469   NullTest,
470   RunAt,
471   SpaceBelow,
472   SweepAngle,
473   NumberOfCells,
474   LetterSpacing,
475   LockType,
476   PasswordChar,
477   VAlign,
478   SourceBelow,
479   Inverted,
480   Mark,
481   MaxH,
482   MaxW,
483   Truncate,
484   MinH,
485   MinW,
486   Initial,
487   Mode,
488   Layout,
489   Server,
490   EmbedPDF,
491   OddOrEven,
492   TabDefault,
493   Contains,
494   RightInset,
495   MaxChars,
496   Open,
497   Relation,
498   WideNarrowRatio,
499   Relevant,
500   SignatureType,
501   LineThroughPeriod,
502   Shape,
503   TabStops,
504   OutputBelow,
505   Short,
506   FontVerticalScale,
507   Thickness,
508   CommitOn,
509   RemainCharacterCount,
510   KeyAgreement,
511   ErrorCorrectionLevel,
512   UpsMode,
513   MergeMode,
514   Circular,
515   PsName,
516   Trailer,
517   UnicodeRange,
518   ExecuteType,
519   DuplexImposition,
520   TrayIn,
521   BindingNode,
522   BofAction,
523   Save,
524   TargetType,
525   KeyEncipherment,
526   CredentialServerPolicy,
527   Size,
528   InitialNumber,
529   Slope,
530   CSpace,
531   ColSpan,
532   Binding,
533   Checksum,
534   CharEncoding,
535   Bind,
536   TextEntry,
537   Archive,
538   Uuid,
539   Posture,
540   After,
541   Orphans,
542   QualifiedName,
543   Usehref,
544   Locale,
545   Weight,
546   UnderlinePeriod,
547   Data,
548   Desc,
549   Numbered,
550   DataColumnCount,
551   Overline,
552   UrlPolicy,
553   AnchorType,
554   LabelRef,
555   BookendLeader,
556   MaxLength,
557   AccessKey,
558   CursorLocation,
559   DelayedOpen,
560   Target,
561   DataEncipherment,
562   AfterTarget,
563   Leader,
564   Picker,
565   From,
566   BaseProfile,
567   Aspect,
568   RowColumnRatio,
569   LineHeight,
570   Highlight,
571   ValueRef,
572   MaxEntries,
573   DataLength,
574   Activity,
575   Input,
576   Value,
577   BlankOrNotBlank,
578   AddRevocationInfo,
579   GenericFamily,
580   Hand,
581   Href,
582   TextEncoding,
583   LeadDigits,
584   Permissions,
585   SpaceAbove,
586   CodeBase,
587   Stock,
588   IsNull,
589   RestoreState,
590   ExcludeAllCaps,
591   FormatTest,
592   HScrollPolicy,
593   Join,
594   KeyCertSign,
595   Radius,
596   SourceAbove,
597   Override,
598   ClassId,
599   Disable,
600   Scope,
601   Match,
602   Placement,
603   Before,
604   WritingScript,
605   EndChar,
606   Lock,
607   Long,
608   Intact,
609   XdpContent,
610   DecipherOnly,
611   Unknown = 255,
612 };
613 
614 enum class XFA_Element : int32_t {
615   Unknown = -1,
616 
617   Ps,
618   To,
619   Ui,
620   RecordSet,
621   SubsetBelow,
622   SubformSet,
623   AdobeExtensionLevel,
624   Typeface,
625   Break,
626   FontInfo,
627   NumberPattern,
628   DynamicRender,
629   PrintScaling,
630   CheckButton,
631   DatePatterns,
632   SourceSet,
633   Amd,
634   Arc,
635   Day,
636   Era,
637   Jog,
638   Log,
639   Map,
640   Mdp,
641   BreakBefore,
642   Oid,
643   Pcl,
644   Pdf,
645   Ref,
646   Uri,
647   Xdc,
648   Xdp,
649   Xfa,
650   Xsl,
651   Zpl,
652   Cache,
653   Margin,
654   KeyUsage,
655   Exclude,
656   ChoiceList,
657   Level,
658   LabelPrinter,
659   CalendarSymbols,
660   Para,
661   Part,
662   Pdfa,
663   Filter,
664   Present,
665   Pagination,
666   Encoding,
667   Event,
668   Whitespace,
669   DefaultUi,
670   DataModel,
671   Barcode,
672   TimePattern,
673   BatchOutput,
674   Enforce,
675   CurrencySymbols,
676   AddSilentPrint,
677   Rename,
678   Operation,
679   Typefaces,
680   SubjectDNs,
681   Issuers,
682   SignaturePseudoModel,
683   WsdlConnection,
684   Debug,
685   Delta,
686   EraNames,
687   ModifyAnnots,
688   StartNode,
689   Button,
690   Format,
691   Border,
692   Area,
693   Hyphenation,
694   Text,
695   Time,
696   Type,
697   Overprint,
698   Certificates,
699   EncryptionMethods,
700   SetProperty,
701   PrinterName,
702   StartPage,
703   PageOffset,
704   DateTime,
705   Comb,
706   Pattern,
707   IfEmpty,
708   SuppressBanner,
709   OutputBin,
710   Field,
711   Agent,
712   OutputXSL,
713   AdjustData,
714   AutoSave,
715   ContentArea,
716   EventPseudoModel,
717   WsdlAddress,
718   Solid,
719   DateTimeSymbols,
720   EncryptionLevel,
721   Edge,
722   Stipple,
723   Attributes,
724   VersionControl,
725   Meridiem,
726   ExclGroup,
727   ToolTip,
728   Compress,
729   Reason,
730   Execute,
731   ContentCopy,
732   DateTimeEdit,
733   Config,
734   Image,
735   SharpxHTML,
736   NumberOfCopies,
737   BehaviorOverride,
738   TimeStamp,
739   Month,
740   ViewerPreferences,
741   ScriptModel,
742   Decimal,
743   Subform,
744   Select,
745   Window,
746   LocaleSet,
747   Handler,
748   HostPseudoModel,
749   Presence,
750   Record,
751   Embed,
752   Version,
753   Command,
754   Copies,
755   Staple,
756   SubmitFormat,
757   Boolean,
758   Message,
759   Output,
760   PsMap,
761   ExcludeNS,
762   Assist,
763   Picture,
764   Traversal,
765   SilentPrint,
766   WebClient,
767   LayoutPseudoModel,
768   Producer,
769   Corner,
770   MsgId,
771   Color,
772   Keep,
773   Query,
774   Insert,
775   ImageEdit,
776   Validate,
777   DigestMethods,
778   NumberPatterns,
779   PageSet,
780   Integer,
781   SoapAddress,
782   Equate,
783   FormFieldFilling,
784   PageRange,
785   Update,
786   ConnectString,
787   Mode,
788   Layout,
789   Sharpxml,
790   XsdConnection,
791   Traverse,
792   Encodings,
793   Template,
794   Acrobat,
795   ValidationMessaging,
796   Signing,
797   DataWindow,
798   Script,
799   AddViewerPreferences,
800   AlwaysEmbed,
801   PasswordEdit,
802   NumericEdit,
803   EncryptionMethod,
804   Change,
805   PageArea,
806   SubmitUrl,
807   Oids,
808   Signature,
809   ADBE_JSConsole,
810   Caption,
811   Relevant,
812   FlipLabel,
813   ExData,
814   DayNames,
815   SoapAction,
816   DefaultTypeface,
817   Manifest,
818   Overflow,
819   Linear,
820   CurrencySymbol,
821   Delete,
822   Deltas,
823   DigestMethod,
824   InstanceManager,
825   EquateRange,
826   Medium,
827   TextEdit,
828   TemplateCache,
829   CompressObjectStream,
830   DataValue,
831   AccessibleContent,
832   TreeList,
833   IncludeXDPContent,
834   XmlConnection,
835   ValidateApprovalSignatures,
836   SignData,
837   Packets,
838   DatePattern,
839   DuplexOption,
840   Base,
841   Bind,
842   Compression,
843   User,
844   Rectangle,
845   EffectiveOutputPolicy,
846   ADBE_JSDebugger,
847   Acrobat7,
848   Interactive,
849   Locale,
850   CurrentPage,
851   Data,
852   Date,
853   Desc,
854   Encrypt,
855   Draw,
856   Encryption,
857   MeridiemNames,
858   Messaging,
859   Speak,
860   DataGroup,
861   Common,
862   Sharptext,
863   PaginationOverride,
864   Reasons,
865   SignatureProperties,
866   Threshold,
867   AppearanceFilter,
868   Fill,
869   Font,
870   Form,
871   MediumInfo,
872   Certificate,
873   Password,
874   RunScripts,
875   Trace,
876   Float,
877   RenderPolicy,
878   LogPseudoModel,
879   Destination,
880   Value,
881   Bookend,
882   ExObject,
883   OpenAction,
884   NeverEmbed,
885   BindItems,
886   Calculate,
887   Print,
888   Extras,
889   Proto,
890   DSigData,
891   Creator,
892   Connect,
893   Permissions,
894   ConnectionSet,
895   Submit,
896   Range,
897   Linearized,
898   Packet,
899   RootElement,
900   PlaintextMetadata,
901   NumberSymbols,
902   PrintHighQuality,
903   Driver,
904   IncrementalLoad,
905   SubjectDN,
906   CompressLogicalStructure,
907   IncrementalMerge,
908   Radial,
909   Variables,
910   TimePatterns,
911   EffectiveInputPolicy,
912   NameAttr,
913   Conformance,
914   Transform,
915   LockDocument,
916   BreakAfter,
917   Line,
918   List,
919   Source,
920   Occur,
921   PickTrayByPDFSize,
922   MonthNames,
923   Severity,
924   GroupParent,
925   DocumentAssembly,
926   NumberSymbol,
927   Tagged,
928   Items
929 };
930 
931 enum class XFA_AttributeType : uint8_t {
932   Enum,
933   CData,
934   Boolean,
935   Integer,
936   Measure,
937 };
938 
939 struct XFA_SCRIPTHIERARCHY {
940   uint16_t wAttributeStart;
941   uint16_t wAttributeCount;
942   int16_t wParentIndex;
943 };
944 
945 #define XFA_PROPERTYFLAG_OneOf 0x01
946 #define XFA_PROPERTYFLAG_DefaultOneOf 0x02
947 
948 struct XFA_AttributeEnumInfo {
949   uint32_t uHash;
950   const wchar_t* pName;
951   XFA_AttributeEnum eName;
952 };
953 
954 enum class XFA_Unit : uint8_t {
955   Percent = 0,
956   Em,
957   Pt,
958   In,
959   Pc,
960   Cm,
961   Mm,
962   Mp,
963 
964   Unknown = 255,
965 };
966 
967 typedef void (CJX_Object::*XFA_ATTRIBUTE_CALLBACK)(CFXJSE_Value* pValue,
968                                                    bool bSetting,
969                                                    XFA_Attribute eAttribute);
970 enum class XFA_ScriptType : uint8_t {
971   Basic,
972   Object,
973 };
974 
975 struct XFA_SCRIPTATTRIBUTEINFO {
976   uint32_t uHash;
977   const wchar_t* pName;
978   XFA_ATTRIBUTE_CALLBACK callback;
979   XFA_Attribute attribute;
980   XFA_ScriptType eValueType;
981 };
982 
983 #endif  // XFA_FXFA_FXFA_BASIC_H_
984