OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FXFA_INCLUDE_FXFA_BASIC_H_ | 7 #ifndef XFA_FXFA_INCLUDE_FXFA_BASIC_H_ |
8 #define XFA_FXFA_INCLUDE_FXFA_BASIC_H_ | 8 #define XFA_FXFA_INCLUDE_FXFA_BASIC_H_ |
9 | 9 |
10 #include "fxjs/include/cfxjse_arguments.h" | 10 #include "fxjs/include/cfxjse_arguments.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 XFA_XDPPACKET_FLAGS_SUPPORTMANY = 16, | 89 XFA_XDPPACKET_FLAGS_SUPPORTMANY = 16, |
90 }; | 90 }; |
91 struct XFA_PACKETINFO { | 91 struct XFA_PACKETINFO { |
92 uint32_t uHash; | 92 uint32_t uHash; |
93 const FX_WCHAR* pName; | 93 const FX_WCHAR* pName; |
94 XFA_XDPPACKET eName; | 94 XFA_XDPPACKET eName; |
95 const FX_WCHAR* pURI; | 95 const FX_WCHAR* pURI; |
96 uint32_t eFlags; | 96 uint32_t eFlags; |
97 }; | 97 }; |
98 | 98 |
99 const XFA_PACKETINFO* XFA_GetPacketByName(const CFX_WideStringC& wsName); | |
100 const XFA_PACKETINFO* XFA_GetPacketByID(uint32_t dwPacket); | |
101 const XFA_PACKETINFO* XFA_GetPacketByIndex(XFA_PACKET ePacket); | |
102 | |
103 enum XFA_ATTRIBUTEENUM { | 99 enum XFA_ATTRIBUTEENUM { |
104 XFA_ATTRIBUTEENUM_Asterisk, | 100 XFA_ATTRIBUTEENUM_Asterisk, |
105 XFA_ATTRIBUTEENUM_Slash, | 101 XFA_ATTRIBUTEENUM_Slash, |
106 XFA_ATTRIBUTEENUM_Backslash, | 102 XFA_ATTRIBUTEENUM_Backslash, |
107 XFA_ATTRIBUTEENUM_On, | 103 XFA_ATTRIBUTEENUM_On, |
108 XFA_ATTRIBUTEENUM_Tb, | 104 XFA_ATTRIBUTEENUM_Tb, |
109 XFA_ATTRIBUTEENUM_Up, | 105 XFA_ATTRIBUTEENUM_Up, |
110 XFA_ATTRIBUTEENUM_MetaData, | 106 XFA_ATTRIBUTEENUM_MetaData, |
111 XFA_ATTRIBUTEENUM_Delegate, | 107 XFA_ATTRIBUTEENUM_Delegate, |
112 XFA_ATTRIBUTEENUM_PostSubmit, | 108 XFA_ATTRIBUTEENUM_PostSubmit, |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 Items | 927 Items |
932 }; | 928 }; |
933 struct XFA_ELEMENTINFO { | 929 struct XFA_ELEMENTINFO { |
934 uint32_t uHash; | 930 uint32_t uHash; |
935 const FX_WCHAR* pName; | 931 const FX_WCHAR* pName; |
936 XFA_Element eName; | 932 XFA_Element eName; |
937 uint32_t dwPackets; | 933 uint32_t dwPackets; |
938 XFA_ObjectType eObjectType; | 934 XFA_ObjectType eObjectType; |
939 }; | 935 }; |
940 | 936 |
941 XFA_Element XFA_GetElementTypeForName(const CFX_WideStringC& wsName); | |
942 const XFA_ELEMENTINFO* XFA_GetElementByID(XFA_Element eName); | |
943 | |
944 enum XFA_ATTRIBUTETYPE { | 937 enum XFA_ATTRIBUTETYPE { |
945 XFA_ATTRIBUTETYPE_NOTSURE, | 938 XFA_ATTRIBUTETYPE_NOTSURE, |
946 XFA_ATTRIBUTETYPE_Enum, | 939 XFA_ATTRIBUTETYPE_Enum, |
947 XFA_ATTRIBUTETYPE_Cdata, | 940 XFA_ATTRIBUTETYPE_Cdata, |
948 XFA_ATTRIBUTETYPE_Boolean, | 941 XFA_ATTRIBUTETYPE_Boolean, |
949 XFA_ATTRIBUTETYPE_Integer, | 942 XFA_ATTRIBUTETYPE_Integer, |
950 XFA_ATTRIBUTETYPE_Measure, | 943 XFA_ATTRIBUTETYPE_Measure, |
951 }; | 944 }; |
952 struct XFA_ATTRIBUTEINFO { | 945 struct XFA_ATTRIBUTEINFO { |
953 uint32_t uHash; | 946 uint32_t uHash; |
954 const FX_WCHAR* pName; | 947 const FX_WCHAR* pName; |
955 XFA_ATTRIBUTE eName; | 948 XFA_ATTRIBUTE eName; |
956 XFA_ATTRIBUTETYPE eType; | 949 XFA_ATTRIBUTETYPE eType; |
957 uint32_t dwPackets; | 950 uint32_t dwPackets; |
958 void* pDefValue; | 951 void* pDefValue; |
959 }; | 952 }; |
960 | 953 |
961 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByName(const CFX_WideStringC& wsName); | |
962 const XFA_ATTRIBUTEINFO* XFA_GetAttributeByID(XFA_ATTRIBUTE eName); | |
963 FX_BOOL XFA_GetAttributeDefaultValue(void*& pValue, | |
964 XFA_Element eElement, | |
965 XFA_ATTRIBUTE eAttribute, | |
966 XFA_ATTRIBUTETYPE eType, | |
967 uint32_t dwPacket); | |
968 XFA_ATTRIBUTEENUM XFA_GetAttributeDefaultValue_Enum(XFA_Element eElement, | |
969 XFA_ATTRIBUTE eAttribute, | |
970 uint32_t dwPacket); | |
971 CFX_WideStringC XFA_GetAttributeDefaultValue_Cdata(XFA_Element eElement, | |
972 XFA_ATTRIBUTE eAttribute, | |
973 uint32_t dwPacket); | |
974 FX_BOOL XFA_GetAttributeDefaultValue_Boolean(XFA_Element eElement, | |
975 XFA_ATTRIBUTE eAttribute, | |
976 uint32_t dwPacket); | |
977 CXFA_Measurement XFA_GetAttributeDefaultValue_Measure(XFA_Element eElement, | |
978 XFA_ATTRIBUTE eAttribute, | |
979 uint32_t dwPacket); | |
980 struct XFA_ELEMENTHIERARCHY { | 954 struct XFA_ELEMENTHIERARCHY { |
981 uint16_t wStart; | 955 uint16_t wStart; |
982 uint16_t wCount; | 956 uint16_t wCount; |
983 }; | 957 }; |
984 | 958 |
985 struct XFA_SCRIPTHIERARCHY { | 959 struct XFA_SCRIPTHIERARCHY { |
986 uint16_t wMethodStart; | 960 uint16_t wMethodStart; |
987 uint16_t wMethodCount; | 961 uint16_t wMethodCount; |
988 uint16_t wAttributeStart; | 962 uint16_t wAttributeStart; |
989 uint16_t wAttributeCount; | 963 uint16_t wAttributeCount; |
990 int16_t wParentIndex; | 964 int16_t wParentIndex; |
991 }; | 965 }; |
992 | 966 |
993 const uint8_t* XFA_GetElementAttributes(XFA_Element eElement, int32_t& iCount); | |
994 | |
995 const XFA_ATTRIBUTEINFO* XFA_GetAttributeOfElement(XFA_Element eElement, | |
996 XFA_ATTRIBUTE eAttribute, | |
997 uint32_t dwPacket); | |
998 #define XFA_PROPERTYFLAG_OneOf 0x01 | 967 #define XFA_PROPERTYFLAG_OneOf 0x01 |
999 #define XFA_PROPERTYFLAG_DefaultOneOf 0x02 | 968 #define XFA_PROPERTYFLAG_DefaultOneOf 0x02 |
1000 struct XFA_PROPERTY { | 969 struct XFA_PROPERTY { |
1001 XFA_Element eName; | 970 XFA_Element eName; |
1002 uint8_t uOccur; | 971 uint8_t uOccur; |
1003 uint8_t uFlags; | 972 uint8_t uFlags; |
1004 }; | 973 }; |
1005 const XFA_PROPERTY* XFA_GetElementProperties(XFA_Element eElement, | 974 |
1006 int32_t& iCount); | |
1007 const XFA_PROPERTY* XFA_GetPropertyOfElement(XFA_Element eElement, | |
1008 XFA_Element eProperty, | |
1009 uint32_t dwPacket); | |
1010 struct XFA_ATTRIBUTEENUMINFO { | 975 struct XFA_ATTRIBUTEENUMINFO { |
1011 uint32_t uHash; | 976 uint32_t uHash; |
1012 const FX_WCHAR* pName; | 977 const FX_WCHAR* pName; |
1013 XFA_ATTRIBUTEENUM eName; | 978 XFA_ATTRIBUTEENUM eName; |
1014 }; | 979 }; |
1015 const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByName( | 980 |
1016 const CFX_WideStringC& wsName); | |
1017 const XFA_ATTRIBUTEENUMINFO* XFA_GetAttributeEnumByID(XFA_ATTRIBUTEENUM eName); | |
1018 enum XFA_UNIT { | 981 enum XFA_UNIT { |
1019 XFA_UNIT_Unknown, | 982 XFA_UNIT_Unknown, |
1020 XFA_UNIT_Percent, | 983 XFA_UNIT_Percent, |
1021 XFA_UNIT_Angle, | 984 XFA_UNIT_Angle, |
1022 XFA_UNIT_Em, | 985 XFA_UNIT_Em, |
1023 XFA_UNIT_Pt, | 986 XFA_UNIT_Pt, |
1024 XFA_UNIT_In, | 987 XFA_UNIT_In, |
1025 XFA_UNIT_Pc, | 988 XFA_UNIT_Pc, |
1026 XFA_UNIT_Cm, | 989 XFA_UNIT_Cm, |
1027 XFA_UNIT_Mm, | 990 XFA_UNIT_Mm, |
1028 XFA_UNIT_Mp, | 991 XFA_UNIT_Mp, |
1029 }; | 992 }; |
1030 class CXFA_Measurement { | |
1031 public: | |
1032 void Set(const CFX_WideStringC& wsMeasure); | |
1033 void Set(FX_FLOAT fValue, XFA_UNIT eUnit) { | |
1034 m_fValue = fValue; | |
1035 m_eUnit = eUnit; | |
1036 } | |
1037 | 993 |
1038 XFA_UNIT GetUnit() const { return m_eUnit; } | 994 struct XFA_NOTSUREATTRIBUTE { |
1039 FX_FLOAT GetValue() const { return m_fValue; } | 995 XFA_Element eElement; |
1040 FX_BOOL ToString(CFX_WideString& wsMeasure) const; | 996 XFA_ATTRIBUTE eAttribute; |
1041 FX_BOOL ToUnit(XFA_UNIT eUnit, FX_FLOAT& fValue) const; | 997 XFA_ATTRIBUTETYPE eType; |
1042 FX_FLOAT ToUnit(XFA_UNIT eUnit) const { | 998 void* pValue; |
1043 FX_FLOAT f; | |
1044 return ToUnit(eUnit, f) ? f : 0; | |
1045 } | |
1046 CXFA_Measurement() { Set(-1, XFA_UNIT_Unknown); } | |
1047 CXFA_Measurement(const CFX_WideStringC& wsMeasure) { Set(wsMeasure); } | |
1048 CXFA_Measurement(FX_FLOAT fValue, XFA_UNIT eUnit) { Set(fValue, eUnit); } | |
1049 static XFA_UNIT GetUnit(const CFX_WideStringC& wsUnit); | |
1050 | |
1051 protected: | |
1052 FX_FLOAT m_fValue; | |
1053 XFA_UNIT m_eUnit; | |
1054 }; | 999 }; |
1055 | 1000 |
1056 class CFXJSE_Arguments; | 1001 class CFXJSE_Arguments; |
1057 class CXFA_Object; | 1002 class CXFA_Object; |
1058 | 1003 |
1059 typedef void (CXFA_Object::*XFA_METHOD_CALLBACK)(CFXJSE_Arguments* pArguments); | 1004 typedef void (CXFA_Object::*XFA_METHOD_CALLBACK)(CFXJSE_Arguments* pArguments); |
1060 struct XFA_METHODINFO { | 1005 struct XFA_METHODINFO { |
1061 uint32_t uHash; | 1006 uint32_t uHash; |
1062 const FX_WCHAR* pName; | 1007 const FX_WCHAR* pName; |
1063 XFA_METHOD_CALLBACK lpfnCallback; | 1008 XFA_METHOD_CALLBACK lpfnCallback; |
1064 }; | 1009 }; |
1065 | 1010 |
1066 const XFA_METHODINFO* XFA_GetMethodByName(XFA_Element eElement, | |
1067 const CFX_WideStringC& wsMethodName); | |
1068 typedef void (CXFA_Object::*XFA_ATTRIBUTE_CALLBACK)(CFXJSE_Value* pValue, | 1011 typedef void (CXFA_Object::*XFA_ATTRIBUTE_CALLBACK)(CFXJSE_Value* pValue, |
1069 FX_BOOL bSetting, | 1012 FX_BOOL bSetting, |
1070 XFA_ATTRIBUTE eAttribute); | 1013 XFA_ATTRIBUTE eAttribute); |
1071 enum XFA_SCRIPT_TYPE { | 1014 enum XFA_SCRIPT_TYPE { |
1072 XFA_SCRIPT_Basic, | 1015 XFA_SCRIPT_Basic, |
1073 XFA_SCRIPT_Object, | 1016 XFA_SCRIPT_Object, |
1074 }; | 1017 }; |
1075 struct XFA_SCRIPTATTRIBUTEINFO { | 1018 struct XFA_SCRIPTATTRIBUTEINFO { |
1076 uint32_t uHash; | 1019 uint32_t uHash; |
1077 const FX_WCHAR* pName; | 1020 const FX_WCHAR* pName; |
1078 XFA_ATTRIBUTE_CALLBACK lpfnCallback; | 1021 XFA_ATTRIBUTE_CALLBACK lpfnCallback; |
1079 int32_t eAttribute; | 1022 int32_t eAttribute; |
1080 uint16_t eValueType; | 1023 uint16_t eValueType; |
1081 }; | 1024 }; |
1082 const XFA_SCRIPTATTRIBUTEINFO* XFA_GetScriptAttributeByName( | |
1083 XFA_Element eElement, | |
1084 const CFX_WideStringC& wsAttributeName); | |
1085 | 1025 |
1086 #endif // XFA_FXFA_INCLUDE_FXFA_BASIC_H_ | 1026 #endif // XFA_FXFA_INCLUDE_FXFA_BASIC_H_ |
OLD | NEW |