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 #include "../include/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
8 #include "../include/fpdfxfa/fpdfxfa_doc.h" | 8 #include "../include/fpdfxfa/fpdfxfa_doc.h" |
9 #include "../include/fsdk_mgr.h" | 9 #include "../include/fsdk_mgr.h" |
10 #include "../include/fsdk_baseannot.h" | 10 #include "../include/fsdk_baseannot.h" |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1079 return TRUE; | 1079 return TRUE; |
1080 } | 1080 } |
1081 FX_BOOL CPDFSDK_BAAnnot::IsVisible() const | 1081 FX_BOOL CPDFSDK_BAAnnot::IsVisible() const |
1082 { | 1082 { |
1083 int nFlags = GetFlags(); | 1083 int nFlags = GetFlags(); |
1084 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) |
| (nFlags & ANNOTFLAG_NOVIEW)); | 1084 return !((nFlags & ANNOTFLAG_INVISIBLE) || (nFlags & ANNOTFLAG_HIDDEN) |
| (nFlags & ANNOTFLAG_NOVIEW)); |
1085 } | 1085 } |
1086 | 1086 |
1087 CPDF_Action CPDFSDK_BAAnnot::GetAction() const | 1087 CPDF_Action CPDFSDK_BAAnnot::GetAction() const |
1088 { | 1088 { |
1089 » ASSERT(m_pAnnot != NULL); | 1089 » return CPDF_Action(m_pAnnot->m_pAnnotDict->GetDict("A")); |
1090 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | |
1091 » | |
1092 » return m_pAnnot->m_pAnnotDict->GetDict("A"); | |
1093 } | 1090 } |
1094 | 1091 |
1095 void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) | 1092 void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action) |
1096 { | 1093 { |
1097 » ASSERT(m_pAnnot != NULL); | 1094 » ASSERT(action); |
1098 » ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 1095 » if ((CPDF_Action&)action != CPDF_Action(m_pAnnot->m_pAnnotDict->GetDict(
"A"))) |
1099 » | |
1100 » ASSERT(action != NULL); | |
1101 » | |
1102 » if ((CPDF_Action&)action != m_pAnnot->m_pAnnotDict->GetDict("A")) | |
1103 { | 1096 { |
1104 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); | 1097 CPDF_Document* pDoc = m_pPageView->GetPDFDocument(); |
1105 » » ASSERT(pDoc != NULL); | 1098 » » CPDF_Dictionary* pDict = action.GetDict(); |
1106 » » | 1099 » » if (pDict && pDict->GetObjNum() == 0) { |
1107 » » if (action.m_pDict && (action.m_pDict->GetObjNum() == 0)) | 1100 » » » pDoc->AddIndirectObject(pDict); |
1108 » » » pDoc->AddIndirectObject(action.m_pDict); | 1101 » » } |
1109 » » m_pAnnot->m_pAnnotDict->SetAtReference("A", pDoc, action.m_pDict
->GetObjNum()); | 1102 » » m_pAnnot->m_pAnnotDict->SetAtReference("A", pDoc, pDict->GetObjN
um()); |
1110 } | 1103 } |
1111 } | 1104 } |
1112 | 1105 |
1113 void CPDFSDK_BAAnnot::RemoveAction() | 1106 void CPDFSDK_BAAnnot::RemoveAction() |
1114 { | 1107 { |
1115 ASSERT(m_pAnnot != NULL); | |
1116 ASSERT(m_pAnnot->m_pAnnotDict != NULL); | |
1117 | |
1118 m_pAnnot->m_pAnnotDict->RemoveAt("A"); | 1108 m_pAnnot->m_pAnnotDict->RemoveAt("A"); |
1119 } | 1109 } |
1120 | 1110 |
1121 CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const | 1111 CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const |
1122 { | 1112 { |
1123 ASSERT(m_pAnnot != NULL); | |
1124 ASSERT(m_pAnnot->m_pAnnotDict != NULL); | |
1125 | |
1126 return m_pAnnot->m_pAnnotDict->GetDict("AA"); | 1113 return m_pAnnot->m_pAnnotDict->GetDict("AA"); |
1127 } | 1114 } |
1128 | 1115 |
1129 void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) | 1116 void CPDFSDK_BAAnnot::SetAAction(const CPDF_AAction& aa) |
1130 { | 1117 { |
1131 ASSERT(m_pAnnot != NULL); | 1118 ASSERT(m_pAnnot != NULL); |
1132 ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 1119 ASSERT(m_pAnnot->m_pAnnotDict != NULL); |
1133 ASSERT(aa != NULL); | 1120 ASSERT(aa != NULL); |
1134 | 1121 |
1135 if ((CPDF_AAction&)aa != m_pAnnot->m_pAnnotDict->GetDict("AA")) | 1122 if ((CPDF_AAction&)aa != m_pAnnot->m_pAnnotDict->GetDict("AA")) |
1136 m_pAnnot->m_pAnnotDict->SetAt("AA", (CPDF_AAction&)aa); | 1123 m_pAnnot->m_pAnnotDict->SetAt("AA", (CPDF_AAction&)aa); |
1137 } | 1124 } |
1138 | 1125 |
1139 void CPDFSDK_BAAnnot::RemoveAAction() | 1126 void CPDFSDK_BAAnnot::RemoveAAction() |
1140 { | 1127 { |
1141 ASSERT(m_pAnnot != NULL); | 1128 ASSERT(m_pAnnot != NULL); |
1142 ASSERT(m_pAnnot->m_pAnnotDict != NULL); | 1129 ASSERT(m_pAnnot->m_pAnnotDict != NULL); |
1143 | 1130 |
1144 m_pAnnot->m_pAnnotDict->RemoveAt("AA"); | 1131 m_pAnnot->m_pAnnotDict->RemoveAt("AA"); |
1145 } | 1132 } |
1146 | 1133 |
1147 CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) | 1134 CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT) |
1148 { | 1135 { |
1149 CPDF_AAction AAction = GetAAction(); | 1136 CPDF_AAction AAction = GetAAction(); |
1150 » | 1137 |
1151 if (AAction.ActionExist(eAAT)) | 1138 if (AAction.ActionExist(eAAT)) |
1152 { | |
1153 return AAction.GetAction(eAAT); | 1139 return AAction.GetAction(eAAT); |
1154 » } | 1140 |
1155 » else if (eAAT == CPDF_AAction::ButtonUp) | 1141 » if (eAAT == CPDF_AAction::ButtonUp) |
1156 » { | |
1157 return GetAction(); | 1142 return GetAction(); |
1158 » } | 1143 |
1159 » | 1144 » return CPDF_Action(); |
1160 » return NULL; | |
1161 } | 1145 } |
1162 | 1146 |
1163 FX_BOOL CPDFSDK_BAAnnot::IsXFAField() | 1147 FX_BOOL CPDFSDK_BAAnnot::IsXFAField() |
1164 { | 1148 { |
1165 return FALSE; | 1149 return FALSE; |
1166 } | 1150 } |
1167 | 1151 |
1168 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse
r2Device, CPDF_RenderOptions* pOptions) | 1152 void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, CPDF_Matrix* pUse
r2Device, CPDF_RenderOptions* pOptions) |
1169 { | 1153 { |
1170 | 1154 |
(...skipping 10 matching lines...) Expand all Loading... |
1181 return NULL; | 1165 return NULL; |
1182 } | 1166 } |
1183 | 1167 |
1184 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() | 1168 CPDFXFA_Page* CPDFSDK_Annot::GetPDFXFAPage() |
1185 { | 1169 { |
1186 if (m_pPageView) | 1170 if (m_pPageView) |
1187 return m_pPageView->GetPDFXFAPage(); | 1171 return m_pPageView->GetPDFXFAPage(); |
1188 return NULL; | 1172 return NULL; |
1189 } | 1173 } |
1190 | 1174 |
OLD | NEW |