| 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_actionhandler.h" | 10 #include "../include/fsdk_actionhandler.h" |
| 11 #include "../include/javascript/IJavaScript.h" | 11 #include "../include/javascript/IJavaScript.h" |
| 12 | 12 |
| 13 /* -------------------------- CBA_ActionHandler -------------------------- */ | 13 /* -------------------------- CBA_ActionHandler -------------------------- */ |
| 14 | 14 |
| 15 CPDFSDK_ActionHandler::CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi) : | 15 CPDFSDK_ActionHandler::CPDFSDK_ActionHandler(CPDFDoc_Environment* pEvi) : |
| 16 m_pFormActionHandler(NULL), | 16 m_pFormActionHandler(NULL), |
| 17 m_pMediaActionHandler(NULL) | 17 m_pMediaActionHandler(NULL) |
| 18 { | 18 { |
| 19 m_pFormActionHandler = new CPDFSDK_FormActionHandler; | 19 m_pFormActionHandler = new CPDFSDK_FormActionHandler; |
| 20 } | 20 } |
| 21 | 21 |
| 22 CPDFSDK_ActionHandler::~CPDFSDK_ActionHandler() | 22 CPDFSDK_ActionHandler::~CPDFSDK_ActionHandler() |
| 23 { | 23 { |
| 24 if(m_pFormActionHandler) | 24 if(m_pFormActionHandler) |
| 25 { | 25 { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 41 ASSERT(m_pMediaActionHandler == NULL); | 41 ASSERT(m_pMediaActionHandler == NULL); |
| 42 m_pMediaActionHandler = pHandler; | 42 m_pMediaActionHandler = pHandler; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void CPDFSDK_ActionHandler::Destroy() | 45 void CPDFSDK_ActionHandler::Destroy() |
| 46 { | 46 { |
| 47 delete this; | 47 delete this; |
| 48 } | 48 } |
| 49 | 49 |
| 50 //document open | 50 //document open |
| 51 FX_BOOL»CPDFSDK_ActionHandler::DoAction_DocOpen(const CPDF_Action& action, CPDFS
DK_Document* pDocument | 51 FX_BOOL»CPDFSDK_ActionHandler::DoAction_DocOpen(const CPDF_Action& action, CPDFS
DK_Document* pDocument) |
| 52 » » » » » » » » » »
» » /*CReader_Document* pDocument, CReader_DocView *pDocView*/) | |
| 53 { | 52 { |
| 54 CFX_PtrList list; | 53 CFX_PtrList list; |
| 55 » return ExecuteDocumentOpenAction(action, pDocument, /*pDocView, */list); | 54 » return ExecuteDocumentOpenAction(action, pDocument, list); |
| 56 } | 55 } |
| 57 | 56 |
| 58 //document open | 57 //document open |
| 59 FX_BOOL CPDFSDK_ActionHandler::DoAction_JavaScript(const CPDF_Action& JsAction,C
FX_WideString csJSName, | 58 FX_BOOL CPDFSDK_ActionHandler::DoAction_JavaScript(const CPDF_Action& JsAction,C
FX_WideString csJSName, |
| 60 » » » » » » » CPDFSDK_Document* pDocum
ent/*, CReader_DocView *pDocView*/) | 59 » » » » » » » CPDFSDK_Document* pDocum
ent) |
| 61 { | 60 { |
| 62 if (JsAction.GetType() == CPDF_Action::JavaScript) | 61 if (JsAction.GetType() == CPDF_Action::JavaScript) |
| 63 { | 62 { |
| 64 CFX_WideString swJS = JsAction.GetJavaScript(); | 63 CFX_WideString swJS = JsAction.GetJavaScript(); |
| 65 if (!swJS.IsEmpty()) | 64 if (!swJS.IsEmpty()) |
| 66 { | 65 { |
| 67 RunDocumentOpenJavaScript(pDocument, csJSName, swJS); | 66 RunDocumentOpenJavaScript(pDocument, csJSName, swJS); |
| 68 return TRUE; | 67 return TRUE; |
| 69 } | 68 } |
| 70 } | 69 } |
| 71 | 70 |
| 72 return FALSE; | 71 return FALSE; |
| 73 } | 72 } |
| 74 | 73 |
| 75 FX_BOOL»CPDFSDK_ActionHandler::DoAction_FieldJavaScript(const CPDF_Action& JsAct
ion, CPDF_AAction::AActionType type, | 74 FX_BOOL»CPDFSDK_ActionHandler::DoAction_FieldJavaScript(const CPDF_Action& JsAct
ion, CPDF_AAction::AActionType type, |
| 76 » » » » » » » » » CPDFSDK_
Document* pDocument, CPDF_FormField* pFormField, | 75 » » » » » » » » » CPDFSDK_
Document* pDocument, CPDF_FormField* pFormField, |
| 77 PDFSDK_F
ieldAction& data) | 76 PDFSDK_F
ieldAction& data) |
| 78 { | 77 { |
| 79 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); | 78 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); |
| 80 ASSERT(pEnv); | 79 ASSERT(pEnv); |
| 81 if (pEnv->IsJSInitiated() && JsAction.GetType() == CPDF_Action::JavaScri
pt) | 80 if (pEnv->IsJSInitiated() && JsAction.GetType() == CPDF_Action::JavaScri
pt) |
| 82 { | 81 { |
| 83 CFX_WideString swJS = JsAction.GetJavaScript(); | 82 CFX_WideString swJS = JsAction.GetJavaScript(); |
| 84 if (!swJS.IsEmpty()) | 83 if (!swJS.IsEmpty()) |
| 85 { | 84 { |
| 86 RunFieldJavaScript(pDocument, pFormField, type, data, sw
JS); | 85 RunFieldJavaScript(pDocument, pFormField, type, data, sw
JS); |
| 87 return TRUE; | 86 return TRUE; |
| 88 } | 87 } |
| 89 } | 88 } |
| 90 return FALSE; | 89 return FALSE; |
| 91 } | 90 } |
| 92 | 91 |
| 93 FX_BOOL CPDFSDK_ActionHandler::DoAction_Page(const CPDF_Action& action, enum CPD
F_AAction::AActionType eType, | 92 FX_BOOL CPDFSDK_ActionHandler::DoAction_Page(const CPDF_Action& action, enum CPD
F_AAction::AActionType eType, |
| 94 » » » » » » » » » »
CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/) | 93 » » » » » » » » » »
CPDFSDK_Document* pDocument) |
| 95 { | 94 { |
| 96 CFX_PtrList list; | 95 CFX_PtrList list; |
| 97 » return ExecuteDocumentPageAction(action, eType, pDocument,/* pDocView,*/
list); | 96 » return ExecuteDocumentPageAction(action, eType, pDocument, list); |
| 98 } | 97 } |
| 99 | 98 |
| 100 FX_BOOL CPDFSDK_ActionHandler::DoAction_Document(const CPDF_Action& action, enum
CPDF_AAction::AActionType eType, | 99 FX_BOOL CPDFSDK_ActionHandler::DoAction_Document(const CPDF_Action& action, enum
CPDF_AAction::AActionType eType, |
| 101 » » » » » » » » » »
» CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/) | 100 » » » » » » » » » »
» CPDFSDK_Document* pDocument) |
| 102 { | 101 { |
| 103 CFX_PtrList list; | 102 CFX_PtrList list; |
| 104 » return ExecuteDocumentPageAction(action, eType, pDocument,/* pDocView,*/
list); | 103 » return ExecuteDocumentPageAction(action, eType, pDocument, list); |
| 105 } | 104 } |
| 106 | 105 |
| 107 FX_BOOL»CPDFSDK_ActionHandler::DoAction_BookMark(CPDF_Bookmark *pBookMark, const
CPDF_Action& action, CPDF_AAction::AActionType type, | 106 FX_BOOL»CPDFSDK_ActionHandler::DoAction_BookMark(CPDF_Bookmark *pBookMark, const
CPDF_Action& action, CPDF_AAction::AActionType type, |
| 108 » » » » » » » CPDFSDK_Document* pDocum
ent/*, CReader_DocView *pDocView*/) | 107 » » » » » » » CPDFSDK_Document* pDocum
ent) |
| 109 { | 108 { |
| 110 CFX_PtrList list; | 109 CFX_PtrList list; |
| 111 » return this->ExecuteBookMark(action, pDocument,/* pDocView,*/ pBookMark,
list); | 110 » return this->ExecuteBookMark(action, pDocument, pBookMark, list); |
| 112 } | 111 } |
| 113 | 112 |
| 114 FX_BOOL»CPDFSDK_ActionHandler::DoAction_Screen(const CPDF_Action& action, CPDF_A
Action::AActionType type, | 113 FX_BOOL»CPDFSDK_ActionHandler::DoAction_Screen(const CPDF_Action& action, CPDF_A
Action::AActionType type, |
| 115 » » » » » » » » » »
CPDFSDK_Document* pDocument,/* CReader_DocView *pDocView,*/ CPDFSDK_Annot* pScre
en) | 114 » » » » » » » » » »
CPDFSDK_Document* pDocument, CPDFSDK_Annot* pScreen) |
| 116 { | 115 { |
| 117 CFX_PtrList list; | 116 CFX_PtrList list; |
| 118 » return this->ExecuteScreenAction(action, type, pDocument,/* pDocView,*/
pScreen, list); | 117 » return this->ExecuteScreenAction(action, type, pDocument, pScreen, list)
; |
| 119 } | 118 } |
| 120 | 119 |
| 121 FX_BOOL»CPDFSDK_ActionHandler::DoAction_Link(const CPDF_Action& action, | 120 FX_BOOL»CPDFSDK_ActionHandler::DoAction_Link(const CPDF_Action& action, |
| 122 » » » » » » » » » »
CPDFSDK_Document* pDocument/*, CReader_DocView *pDocView*/) | 121 » » » » » » » » » »
CPDFSDK_Document* pDocument) |
| 123 { | 122 { |
| 124 CFX_PtrList list; | 123 CFX_PtrList list; |
| 125 » return ExecuteLinkAction(action, pDocument,/* pDocView,*/ list); | 124 » return ExecuteLinkAction(action, pDocument, list); |
| 126 } | 125 } |
| 127 | 126 |
| 128 FX_BOOL»CPDFSDK_ActionHandler::DoAction_Field(const CPDF_Action& action, CPDF_AA
ction::AActionType type, | 127 FX_BOOL»CPDFSDK_ActionHandler::DoAction_Field(const CPDF_Action& action, CPDF_AA
ction::AActionType type, |
| 129 » » » » » » » » » »
CPDFSDK_Document* pDocument,/* CReader_DocView *pDocView,*/ | 128 » » » » » » » » » »
CPDFSDK_Document* pDocument, |
| 130
CPDF_FormField* pFormField, PDFSDK_FieldAction& data) | 129
CPDF_FormField* pFormField, PDFSDK_FieldAction& data) |
| 131 { | 130 { |
| 132 CFX_PtrList list; | 131 CFX_PtrList list; |
| 133 » return ExecuteFieldAction(action, type, pDocument,/* pDocView,*/ pFormFi
eld, data, list); | 132 » return ExecuteFieldAction(action, type, pDocument, pFormField, data, lis
t); |
| 134 } | 133 } |
| 135 | 134 |
| 136 FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction(const CPDF_Action& acti
on, CPDFSDK_Document* pDocument, | 135 FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentOpenAction(const CPDF_Action& acti
on, CPDFSDK_Document* pDocument, |
| 137 » » » » » » » » » »
» » » /*CReader_DocView *pDocView,*/ CFX_PtrList& list) | 136 CFX_PtrList& list) |
| 138 { | 137 { |
| 139 » ASSERT(pDocument != NULL); | 138 » CPDF_Dictionary* pDict = action.GetDict(); |
| 139 » if (list.Find(pDict)) |
| 140 » » return FALSE; |
| 140 | 141 |
| 141 » if (list.Find((CPDF_Dictionary*)action)) | 142 » list.AddTail(pDict); |
| 142 » » return FALSE; | |
| 143 » list.AddTail((CPDF_Dictionary*)action); | |
| 144 | 143 |
| 145 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); | 144 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); |
| 146 ASSERT(pEnv); | 145 ASSERT(pEnv); |
| 147 if (action.GetType() == CPDF_Action::JavaScript) | 146 if (action.GetType() == CPDF_Action::JavaScript) |
| 148 { | 147 { |
| 149 if(pEnv->IsJSInitiated()) | 148 if(pEnv->IsJSInitiated()) |
| 150 { | 149 { |
| 151 CFX_WideString swJS = action.GetJavaScript(); | 150 CFX_WideString swJS = action.GetJavaScript(); |
| 152 if (!swJS.IsEmpty()) | 151 if (!swJS.IsEmpty()) |
| 153 { | 152 { |
| 154 RunDocumentOpenJavaScript(pDocument, L"", swJS); | 153 RunDocumentOpenJavaScript(pDocument, L"", swJS); |
| 155 } | 154 } |
| 156 } | 155 } |
| 157 } | 156 } |
| 158 else | 157 else |
| 159 { | 158 { |
| 160 » » DoAction_NoJs(action, pDocument/*, pDocView*/); | 159 » » DoAction_NoJs(action, pDocument); |
| 161 } | 160 } |
| 162 | 161 |
| 163 // if (!IsValidDocView(pDocument, pDocView)) | |
| 164 // return FALSE; | |
| 165 | |
| 166 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) | 162 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) |
| 167 { | 163 { |
| 168 CPDF_Action subaction = action.GetSubAction(i); | 164 CPDF_Action subaction = action.GetSubAction(i); |
| 169 » » if (!ExecuteDocumentOpenAction(subaction, pDocument,/* pDocView,
*/ list)) return FALSE; | 165 » » if (!ExecuteDocumentOpenAction(subaction, pDocument, list)) retu
rn FALSE; |
| 170 } | 166 } |
| 171 | 167 |
| 172 return TRUE; | 168 return TRUE; |
| 173 } | 169 } |
| 174 | 170 |
| 175 FX_BOOL CPDFSDK_ActionHandler::ExecuteLinkAction(const CPDF_Action& action,
CPDFSDK_Document* pDocument, | 171 FX_BOOL CPDFSDK_ActionHandler::ExecuteLinkAction(const CPDF_Action& action,
CPDFSDK_Document* pDocument, |
| 176 » » » » » » » » » »
» » /*CReader_DocView* pDocView,*/ CFX_PtrList& list) | 172 » » » » » » » » » »
» » CFX_PtrList& list) |
| 177 { | 173 { |
| 178 ASSERT(pDocument != NULL); | 174 ASSERT(pDocument != NULL); |
| 179 | 175 |
| 180 » if (list.Find((CPDF_Dictionary*)action)) | 176 » CPDF_Dictionary* pDict = action.GetDict(); |
| 177 » if (list.Find(pDict)) |
| 181 return FALSE; | 178 return FALSE; |
| 182 » list.AddTail((CPDF_Dictionary*)action); | 179 |
| 180 » list.AddTail(pDict); |
| 183 | 181 |
| 184 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); | 182 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); |
| 185 ASSERT(pEnv); | 183 ASSERT(pEnv); |
| 186 if (action.GetType() == CPDF_Action::JavaScript) | 184 if (action.GetType() == CPDF_Action::JavaScript) |
| 187 { | 185 { |
| 188 if(pEnv->IsJSInitiated()) | 186 if(pEnv->IsJSInitiated()) |
| 189 { | 187 { |
| 190 CFX_WideString swJS = action.GetJavaScript(); | 188 CFX_WideString swJS = action.GetJavaScript(); |
| 191 if (!swJS.IsEmpty()) | 189 if (!swJS.IsEmpty()) |
| 192 { | 190 { |
| 193 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntim
e(); //???? | 191 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntim
e(); //???? |
| 194 ASSERT(pRuntime != NULL); | 192 ASSERT(pRuntime != NULL); |
| 195 | 193 |
| 196 pRuntime->SetReaderDocument(pDocument); | 194 pRuntime->SetReaderDocument(pDocument); |
| 197 | 195 |
| 198 IFXJS_Context* pContext = pRuntime->NewContext()
; | 196 IFXJS_Context* pContext = pRuntime->NewContext()
; |
| 199 ASSERT(pContext != NULL); | 197 ASSERT(pContext != NULL); |
| 200 | 198 |
| 201 pContext->OnLink_MouseUp(pDocument); | 199 pContext->OnLink_MouseUp(pDocument); |
| 202 | 200 |
| 203 CFX_WideString csInfo; | 201 CFX_WideString csInfo; |
| 204 FX_BOOL bRet = pContext->RunScript(swJS, csInfo)
; | 202 FX_BOOL bRet = pContext->RunScript(swJS, csInfo)
; |
| 205 if (!bRet) | 203 if (!bRet) |
| 206 { | 204 { |
| 207 » » » » » //CBCL_FormNotify::MsgBoxJSError(pPageVi
ew->GetPageViewWnd(), csInfo); | 205 » » » » » // FIXME: return error. |
| 208 } | 206 } |
| 209 | 207 |
| 210 pRuntime->ReleaseContext(pContext); | 208 pRuntime->ReleaseContext(pContext); |
| 211 } | 209 } |
| 212 } | 210 } |
| 213 } | 211 } |
| 214 else | 212 else |
| 215 { | 213 { |
| 216 » » DoAction_NoJs(action, pDocument/*, pDocView*/); | 214 » » DoAction_NoJs(action, pDocument); |
| 217 } | 215 } |
| 218 | 216 |
| 219 // if (!IsValidDocView(pDocument, pDocView)) | |
| 220 // return FALSE; | |
| 221 | |
| 222 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) | 217 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) |
| 223 { | 218 { |
| 224 CPDF_Action subaction = action.GetSubAction(i); | 219 CPDF_Action subaction = action.GetSubAction(i); |
| 225 » » if (!ExecuteLinkAction(subaction, pDocument,/* pDocView,*/ list)
) return FALSE; | 220 » » if (!ExecuteLinkAction(subaction, pDocument, list)) return FALSE
; |
| 226 } | 221 } |
| 227 | 222 |
| 228 return TRUE; | 223 return TRUE; |
| 229 } | 224 } |
| 230 | 225 |
| 231 FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction(const CPDF_Action& acti
on, CPDF_AAction::AActionType type, | 226 FX_BOOL CPDFSDK_ActionHandler::ExecuteDocumentPageAction(const CPDF_Action& acti
on, CPDF_AAction::AActionType type, |
| 232 » » » » » » » » » »
» » CPDFSDK_Document* pDocument,/* CReader_DocView* pDocView,*/ CFX
_PtrList& list) | 227 » » » » » » » » » »
» » CPDFSDK_Document* pDocument, CFX_PtrList& list) |
| 233 { | 228 { |
| 234 ASSERT(pDocument != NULL); | 229 ASSERT(pDocument != NULL); |
| 235 | 230 |
| 236 » if (list.Find((CPDF_Dictionary*)action)) | 231 » CPDF_Dictionary* pDict = action.GetDict(); |
| 232 » if (list.Find(pDict)) |
| 237 return FALSE; | 233 return FALSE; |
| 238 » list.AddTail((CPDF_Dictionary*)action); | 234 |
| 235 » list.AddTail(pDict); |
| 239 | 236 |
| 240 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); | 237 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); |
| 241 ASSERT(pEnv); | 238 ASSERT(pEnv); |
| 242 if (action.GetType() == CPDF_Action::JavaScript) | 239 if (action.GetType() == CPDF_Action::JavaScript) |
| 243 { | 240 { |
| 244 if(pEnv->IsJSInitiated()) | 241 if(pEnv->IsJSInitiated()) |
| 245 { | 242 { |
| 246 CFX_WideString swJS = action.GetJavaScript(); | 243 CFX_WideString swJS = action.GetJavaScript(); |
| 247 if (!swJS.IsEmpty()) | 244 if (!swJS.IsEmpty()) |
| 248 { | 245 { |
| 249 RunDocumentPageJavaScript(pDocument, type, swJS)
; | 246 RunDocumentPageJavaScript(pDocument, type, swJS)
; |
| 250 } | 247 } |
| 251 } | 248 } |
| 252 } | 249 } |
| 253 else | 250 else |
| 254 { | 251 { |
| 255 » » DoAction_NoJs(action, pDocument/*, pDocView*/); | 252 » » DoAction_NoJs(action, pDocument); |
| 256 } | 253 } |
| 257 | 254 |
| 258 » if (!IsValidDocView(pDocument/*, pDocView*/)) | 255 » if (!IsValidDocView(pDocument)) |
| 259 return FALSE; | 256 return FALSE; |
| 260 | 257 |
| 261 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) | 258 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) |
| 262 { | 259 { |
| 263 CPDF_Action subaction = action.GetSubAction(i); | 260 CPDF_Action subaction = action.GetSubAction(i); |
| 264 » » if (!ExecuteDocumentPageAction(subaction, type, pDocument,/* pDo
cView,*/ list)) return FALSE; | 261 » » if (!ExecuteDocumentPageAction(subaction, type, pDocument, list)
) return FALSE; |
| 265 } | 262 } |
| 266 | 263 |
| 267 return TRUE; | 264 return TRUE; |
| 268 } | 265 } |
| 269 | 266 |
| 270 FX_BOOL CPDFSDK_ActionHandler::IsValidField(CPDFSDK_Document* pDocument, CPDF_Di
ctionary* pFieldDict) | 267 FX_BOOL CPDFSDK_ActionHandler::IsValidField(CPDFSDK_Document* pDocument, CPDF_Di
ctionary* pFieldDict) |
| 271 { | 268 { |
| 272 ASSERT(pDocument != NULL); | 269 ASSERT(pDocument != NULL); |
| 273 ASSERT(pFieldDict != NULL); | 270 ASSERT(pFieldDict != NULL); |
| 274 | 271 |
| 275 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); | 272 CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm(); |
| 276 ASSERT(pInterForm != NULL); | 273 ASSERT(pInterForm != NULL); |
| 277 | 274 |
| 278 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); | 275 CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm(); |
| 279 ASSERT(pPDFInterForm != NULL); | 276 ASSERT(pPDFInterForm != NULL); |
| 280 | 277 |
| 281 return pPDFInterForm->GetFieldByDict(pFieldDict) != NULL; | 278 return pPDFInterForm->GetFieldByDict(pFieldDict) != NULL; |
| 282 } | 279 } |
| 283 | 280 |
| 284 FX_BOOL»CPDFSDK_ActionHandler::ExecuteFieldAction(const CPDF_Action& action, CPD
F_AAction::AActionType type, | 281 FX_BOOL»CPDFSDK_ActionHandler::ExecuteFieldAction(const CPDF_Action& action, CPD
F_AAction::AActionType type, |
| 285 » » » » » » » » » »
CPDFSDK_Document* pDocument,/* CReader_DocView* pDocView,*/ CPDF_FormField* pF
ormField, | 282 » » » » » » » » » »
CPDFSDK_Document* pDocument, CPDF_FormField* pFormField, |
| 286
PDFSDK_FieldAction& data, CFX_PtrList& list) | 283
PDFSDK_FieldAction& data, CFX_PtrList& list) |
| 287 { | 284 { |
| 288 ASSERT(pDocument != NULL); | 285 ASSERT(pDocument != NULL); |
| 289 | 286 |
| 290 » if (list.Find((CPDF_Dictionary*)action)) | 287 » CPDF_Dictionary* pDict = action.GetDict(); |
| 288 » if (list.Find(pDict)) |
| 291 return FALSE; | 289 return FALSE; |
| 292 » list.AddTail((CPDF_Dictionary*)action); | 290 |
| 291 » list.AddTail(pDict); |
| 293 | 292 |
| 294 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); | 293 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); |
| 295 ASSERT(pEnv); | 294 ASSERT(pEnv); |
| 296 if (action.GetType() == CPDF_Action::JavaScript) | 295 if (action.GetType() == CPDF_Action::JavaScript) |
| 297 { | 296 { |
| 298 if(pEnv->IsJSInitiated()) | 297 if(pEnv->IsJSInitiated()) |
| 299 { | 298 { |
| 300 CFX_WideString swJS = action.GetJavaScript(); | 299 CFX_WideString swJS = action.GetJavaScript(); |
| 301 if (!swJS.IsEmpty()) | 300 if (!swJS.IsEmpty()) |
| 302 { | 301 { |
| 303 RunFieldJavaScript(pDocument, pFormField, type,
data, swJS); | 302 RunFieldJavaScript(pDocument, pFormField, type,
data, swJS); |
| 304 if (!IsValidField(pDocument, pFormField->GetFiel
dDict())) | 303 if (!IsValidField(pDocument, pFormField->GetFiel
dDict())) |
| 305 return FALSE; | 304 return FALSE; |
| 306 } | 305 } |
| 307 } | 306 } |
| 308 } | 307 } |
| 309 else | 308 else |
| 310 { | 309 { |
| 311 » » DoAction_NoJs(action, pDocument/*, pDocView*/); | 310 » » DoAction_NoJs(action, pDocument); |
| 312 // » » if (!IsValidDocView(pDocument, pDocView)) | |
| 313 // » » » return FALSE; | |
| 314 } | 311 } |
| 315 | 312 |
| 316 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) | 313 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) |
| 317 { | 314 { |
| 318 CPDF_Action subaction = action.GetSubAction(i); | 315 CPDF_Action subaction = action.GetSubAction(i); |
| 319 » » if (!ExecuteFieldAction(subaction, type, pDocument,/* pDocView,*
/ pFormField, data, list)) return FALSE; | 316 » » if (!ExecuteFieldAction(subaction, type, pDocument, pFormField,
data, list)) return FALSE; |
| 320 } | 317 } |
| 321 | 318 |
| 322 return TRUE; | 319 return TRUE; |
| 323 } | 320 } |
| 324 | 321 |
| 325 FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction(const CPDF_Action& action, CP
DF_AAction::AActionType type, | 322 FX_BOOL CPDFSDK_ActionHandler::ExecuteScreenAction(const CPDF_Action& action, CP
DF_AAction::AActionType type, |
| 326 » » » » » » » » » »
CPDFSDK_Document* pDocument,/* CReader_DocView* pDocView,*/ CPDFSDK_Annot* pScre
en, CFX_PtrList& list) | 323 » » » » » » » » » »
CPDFSDK_Document* pDocument, CPDFSDK_Annot* pScreen, CFX_PtrList& list) |
| 327 { | 324 { |
| 328 ASSERT(pDocument != NULL); | 325 ASSERT(pDocument != NULL); |
| 329 | 326 |
| 330 » if (list.Find((CPDF_Dictionary*)action)) | 327 » CPDF_Dictionary* pDict = action.GetDict(); |
| 328 » if (list.Find(pDict)) |
| 331 return FALSE; | 329 return FALSE; |
| 332 » list.AddTail((CPDF_Dictionary*)action); | 330 |
| 331 » list.AddTail(pDict); |
| 333 | 332 |
| 334 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); | 333 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); |
| 335 ASSERT(pEnv); | 334 ASSERT(pEnv); |
| 336 if (action.GetType() == CPDF_Action::JavaScript) | 335 if (action.GetType() == CPDF_Action::JavaScript) |
| 337 { | 336 { |
| 338 if(pEnv->IsJSInitiated()) | 337 if(pEnv->IsJSInitiated()) |
| 339 { | 338 { |
| 340 CFX_WideString swJS = action.GetJavaScript(); | 339 CFX_WideString swJS = action.GetJavaScript(); |
| 341 if (!swJS.IsEmpty()) | 340 if (!swJS.IsEmpty()) |
| 342 { | 341 { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 { | 390 { |
| 392 //CBCL_FormNotify::MsgBoxJSError(pPageVi
ew->GetPageViewWnd(), csInfo); | 391 //CBCL_FormNotify::MsgBoxJSError(pPageVi
ew->GetPageViewWnd(), csInfo); |
| 393 } | 392 } |
| 394 | 393 |
| 395 pRuntime->ReleaseContext(pContext); | 394 pRuntime->ReleaseContext(pContext); |
| 396 } | 395 } |
| 397 } | 396 } |
| 398 } | 397 } |
| 399 else | 398 else |
| 400 { | 399 { |
| 401 » » DoAction_NoJs(action, pDocument/*, pDocView*/); | 400 » » DoAction_NoJs(action, pDocument); |
| 402 } | 401 } |
| 403 | 402 |
| 404 // if (!IsValidDocView(pDocument, pDocView)) | |
| 405 // return FALSE; | |
| 406 | |
| 407 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) | 403 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) |
| 408 { | 404 { |
| 409 CPDF_Action subaction = action.GetSubAction(i); | 405 CPDF_Action subaction = action.GetSubAction(i); |
| 410 » » if (!ExecuteScreenAction(subaction, type, pDocument,/* pDocView,
*/ pScreen, list)) return FALSE; | 406 » » if (!ExecuteScreenAction(subaction, type, pDocument, pScreen, li
st)) return FALSE; |
| 411 } | 407 } |
| 412 | 408 |
| 413 return TRUE; | 409 return TRUE; |
| 414 } | 410 } |
| 415 | 411 |
| 416 FX_BOOL»CPDFSDK_ActionHandler::ExecuteBookMark(const CPDF_Action& action, CPDFSD
K_Document* pDocument, | 412 FX_BOOL»CPDFSDK_ActionHandler::ExecuteBookMark(const CPDF_Action& action, CPDFSD
K_Document* pDocument, |
| 417 » » » » » » » » » »
/*CReader_DocView* pDocView,*/ CPDF_Bookmark* pBookmark, CFX_PtrList& list) | 413 » » » » » » » » » »
CPDF_Bookmark* pBookmark, CFX_PtrList& list) |
| 418 { | 414 { |
| 419 ASSERT(pDocument != NULL); | 415 ASSERT(pDocument != NULL); |
| 420 | 416 |
| 421 » if (list.Find((CPDF_Dictionary*)action)) | 417 » CPDF_Dictionary* pDict = action.GetDict(); |
| 418 » if (list.Find(pDict)) |
| 422 return FALSE; | 419 return FALSE; |
| 423 » list.AddTail((CPDF_Dictionary*)action); | 420 |
| 421 » list.AddTail(pDict); |
| 424 | 422 |
| 425 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); | 423 CPDFDoc_Environment* pEnv = pDocument->GetEnv(); |
| 426 ASSERT(pEnv); | 424 ASSERT(pEnv); |
| 427 if (action.GetType() == CPDF_Action::JavaScript) | 425 if (action.GetType() == CPDF_Action::JavaScript) |
| 428 { | 426 { |
| 429 if(pEnv->IsJSInitiated()) | 427 if(pEnv->IsJSInitiated()) |
| 430 { | 428 { |
| 431 CFX_WideString swJS = action.GetJavaScript(); | 429 CFX_WideString swJS = action.GetJavaScript(); |
| 432 if (!swJS.IsEmpty()) | 430 if (!swJS.IsEmpty()) |
| 433 { | 431 { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 447 { | 445 { |
| 448 //CBCL_FormNotify::MsgBoxJSError(pPageVi
ew->GetPageViewWnd(), csInfo); | 446 //CBCL_FormNotify::MsgBoxJSError(pPageVi
ew->GetPageViewWnd(), csInfo); |
| 449 } | 447 } |
| 450 | 448 |
| 451 pRuntime->ReleaseContext(pContext); | 449 pRuntime->ReleaseContext(pContext); |
| 452 } | 450 } |
| 453 } | 451 } |
| 454 } | 452 } |
| 455 else | 453 else |
| 456 { | 454 { |
| 457 » » DoAction_NoJs(action, pDocument/*, pDocView*/); | 455 » » DoAction_NoJs(action, pDocument); |
| 458 } | 456 } |
| 459 | 457 |
| 460 // if (!IsValidDocView(pDocument, pDocView)) | |
| 461 // return FALSE; | |
| 462 | |
| 463 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) | 458 for (FX_INT32 i=0,sz=action.GetSubActionsCount(); i<sz; i++) |
| 464 { | 459 { |
| 465 CPDF_Action subaction = action.GetSubAction(i); | 460 CPDF_Action subaction = action.GetSubAction(i); |
| 466 » » if (!ExecuteBookMark(subaction, pDocument,/* pDocView,*/ pBookma
rk, list)) return FALSE; | 461 » » if (!ExecuteBookMark(subaction, pDocument, pBookmark, list)) ret
urn FALSE; |
| 467 } | 462 } |
| 468 | 463 |
| 469 return TRUE; | 464 return TRUE; |
| 470 } | 465 } |
| 471 | 466 |
| 472 void CPDFSDK_ActionHandler::DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Doc
ument* pDocument/*, CReader_DocView* pDocView*/) | 467 void CPDFSDK_ActionHandler::DoAction_NoJs(const CPDF_Action& action, CPDFSDK_Doc
ument* pDocument) |
| 473 { | 468 { |
| 474 ASSERT(pDocument != NULL); | 469 ASSERT(pDocument != NULL); |
| 475 | 470 |
| 476 switch (action.GetType()) | 471 switch (action.GetType()) |
| 477 { | 472 { |
| 478 case CPDF_Action::GoTo: | 473 case CPDF_Action::GoTo: |
| 479 » » DoAction_GoTo(pDocument,/* pDocView,*/ action); | 474 » » DoAction_GoTo(pDocument, action); |
| 480 break; | 475 break; |
| 481 case CPDF_Action::GoToR: | 476 case CPDF_Action::GoToR: |
| 482 DoAction_GoToR(pDocument, action); | 477 DoAction_GoToR(pDocument, action); |
| 483 break; | 478 break; |
| 484 case CPDF_Action::GoToE: | 479 case CPDF_Action::GoToE: |
| 485 break; | 480 break; |
| 486 case CPDF_Action::Launch: | 481 case CPDF_Action::Launch: |
| 487 DoAction_Launch(pDocument, action); | 482 DoAction_Launch(pDocument, action); |
| 488 break; | 483 break; |
| 489 case CPDF_Action::Thread: | 484 case CPDF_Action::Thread: |
| 490 break; | 485 break; |
| 491 case CPDF_Action::URI: | 486 case CPDF_Action::URI: |
| 492 DoAction_URI(pDocument, action); | 487 DoAction_URI(pDocument, action); |
| 493 break; | 488 break; |
| 494 case CPDF_Action::Sound: | 489 case CPDF_Action::Sound: |
| 495 if (m_pMediaActionHandler) | 490 if (m_pMediaActionHandler) |
| 496 { | 491 { |
| 497 » » » m_pMediaActionHandler->DoAction_Sound(action, pDocument/
*, pDocView*/); | 492 » » » m_pMediaActionHandler->DoAction_Sound(action, pDocument)
; |
| 498 } | 493 } |
| 499 break; | 494 break; |
| 500 case CPDF_Action::Movie: | 495 case CPDF_Action::Movie: |
| 501 if (m_pMediaActionHandler) | 496 if (m_pMediaActionHandler) |
| 502 { | 497 { |
| 503 » » » m_pMediaActionHandler->DoAction_Movie(action, pDocument/
*, pDocView*/); | 498 » » » m_pMediaActionHandler->DoAction_Movie(action, pDocument)
; |
| 504 } | 499 } |
| 505 break; | 500 break; |
| 506 case CPDF_Action::Hide: | 501 case CPDF_Action::Hide: |
| 507 if (m_pFormActionHandler) | 502 if (m_pFormActionHandler) |
| 508 { | 503 { |
| 509 m_pFormActionHandler->DoAction_Hide(action, pDocument); | 504 m_pFormActionHandler->DoAction_Hide(action, pDocument); |
| 510 } | 505 } |
| 511 break; | 506 break; |
| 512 case CPDF_Action::Named: | 507 case CPDF_Action::Named: |
| 513 DoAction_Named(pDocument, action); | 508 DoAction_Named(pDocument, action); |
| 514 break; | 509 break; |
| 515 case CPDF_Action::SubmitForm: | 510 case CPDF_Action::SubmitForm: |
| 516 if (m_pFormActionHandler) | 511 if (m_pFormActionHandler) |
| 517 { | 512 { |
| 518 » » » m_pFormActionHandler->DoAction_SubmitForm(action, pDocum
ent/*, pDocView*/); | 513 » » » m_pFormActionHandler->DoAction_SubmitForm(action, pDocum
ent); |
| 519 } | 514 } |
| 520 break; | 515 break; |
| 521 case CPDF_Action::ResetForm: | 516 case CPDF_Action::ResetForm: |
| 522 if (m_pFormActionHandler) | 517 if (m_pFormActionHandler) |
| 523 { | 518 { |
| 524 m_pFormActionHandler->DoAction_ResetForm(action, pDocume
nt); | 519 m_pFormActionHandler->DoAction_ResetForm(action, pDocume
nt); |
| 525 } | 520 } |
| 526 break; | 521 break; |
| 527 case CPDF_Action::ImportData: | 522 case CPDF_Action::ImportData: |
| 528 if (m_pFormActionHandler) | 523 if (m_pFormActionHandler) |
| 529 { | 524 { |
| 530 » » » m_pFormActionHandler->DoAction_ImportData(action, pDocum
ent/*, pDocView*/); | 525 » » » m_pFormActionHandler->DoAction_ImportData(action, pDocum
ent); |
| 531 } | 526 } |
| 532 break; | 527 break; |
| 533 case CPDF_Action::JavaScript: | 528 case CPDF_Action::JavaScript: |
| 534 ASSERT(FALSE); | 529 ASSERT(FALSE); |
| 535 break; | 530 break; |
| 536 case CPDF_Action::SetOCGState: | 531 case CPDF_Action::SetOCGState: |
| 537 » » DoAction_SetOCGState(pDocument, /*pDocView,*/ action); | 532 » » DoAction_SetOCGState(pDocument, action); |
| 538 break; | 533 break; |
| 539 case CPDF_Action::Rendition: | 534 case CPDF_Action::Rendition: |
| 540 if (m_pMediaActionHandler) | 535 if (m_pMediaActionHandler) |
| 541 { | 536 { |
| 542 » » » m_pMediaActionHandler->DoAction_Rendition(action, pDocum
ent/*, pDocView*/); | 537 » » » m_pMediaActionHandler->DoAction_Rendition(action, pDocum
ent); |
| 543 } | 538 } |
| 544 break; | 539 break; |
| 545 case CPDF_Action::Trans: | 540 case CPDF_Action::Trans: |
| 546 break; | 541 break; |
| 547 case CPDF_Action::GoTo3DView: | 542 case CPDF_Action::GoTo3DView: |
| 548 break; | 543 break; |
| 549 default: | 544 default: |
| 550 break; | 545 break; |
| 551 } | 546 } |
| 552 } | 547 } |
| 553 | 548 |
| 554 FX_BOOL»CPDFSDK_ActionHandler::IsValidDocView(CPDFSDK_Document* pDocument/*, CRe
ader_DocView* pDocView*/) | 549 FX_BOOL»CPDFSDK_ActionHandler::IsValidDocView(CPDFSDK_Document* pDocument) |
| 555 { | 550 { |
| 556 ASSERT(pDocument != NULL); | 551 ASSERT(pDocument != NULL); |
| 557 //ASSERT(pDocView != NULL); | |
| 558 | |
| 559 //return pDocument->IsValidDocView(pDocView); | |
| 560 return TRUE; | 552 return TRUE; |
| 561 } | 553 } |
| 562 | 554 |
| 563 void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument, /*CReader
_DocView* pDocView,*/ | 555 void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument, |
| 564 const CPDF_Act
ion& action) | 556 const CPDF_Act
ion& action) |
| 565 { | 557 { |
| 566 » ASSERT(pDocument != NULL); | 558 » ASSERT(action); |
| 567 //» ASSERT(pDocView != NULL); | |
| 568 » ASSERT(action != NULL); | |
| 569 | 559 |
| 570 CPDF_Document* pPDFDocument = pDocument->GetDocument()->GetPDFDoc(); | 560 CPDF_Document* pPDFDocument = pDocument->GetDocument()->GetPDFDoc(); |
| 571 ASSERT(pPDFDocument != NULL); | 561 ASSERT(pPDFDocument != NULL); |
| 572 CPDFDoc_Environment* pApp = pDocument->GetEnv(); | 562 CPDFDoc_Environment* pApp = pDocument->GetEnv(); |
| 573 ASSERT(pApp != NULL); | 563 ASSERT(pApp != NULL); |
| 574 | 564 |
| 575 CPDF_Dest MyDest = action.GetDest(pPDFDocument); | 565 CPDF_Dest MyDest = action.GetDest(pPDFDocument); |
| 576 int nPageIndex = MyDest.GetPageIndex(pPDFDocument); | 566 int nPageIndex = MyDest.GetPageIndex(pPDFDocument); |
| 577 int nFitType = MyDest.GetZoomMode(); | 567 int nFitType = MyDest.GetZoomMode(); |
| 578 const CPDF_Array * pMyArray = (CPDF_Array*)MyDest.m_pObj; | 568 const CPDF_Array * pMyArray = (CPDF_Array*)MyDest.m_pObj; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 598 | 588 |
| 599 } | 589 } |
| 600 | 590 |
| 601 void CPDFSDK_ActionHandler::DoAction_Launch(CPDFSDK_Document* pDocument, const C
PDF_Action& action) | 591 void CPDFSDK_ActionHandler::DoAction_Launch(CPDFSDK_Document* pDocument, const C
PDF_Action& action) |
| 602 { | 592 { |
| 603 | 593 |
| 604 } | 594 } |
| 605 | 595 |
| 606 void CPDFSDK_ActionHandler::DoAction_URI(CPDFSDK_Document* pDocument, const CPDF
_Action& action) | 596 void CPDFSDK_ActionHandler::DoAction_URI(CPDFSDK_Document* pDocument, const CPDF
_Action& action) |
| 607 { | 597 { |
| 608 » ASSERT(pDocument != NULL); | 598 » ASSERT(action); |
| 609 » ASSERT(action != NULL); | |
| 610 | 599 |
| 611 CPDFDoc_Environment* pApp = pDocument->GetEnv(); | 600 CPDFDoc_Environment* pApp = pDocument->GetEnv(); |
| 612 ASSERT(pApp != NULL); | 601 ASSERT(pApp != NULL); |
| 613 | |
| 614 CFX_ByteString sURI = action.GetURI(pDocument->GetDocument()->GetPDFDoc(
)); | 602 CFX_ByteString sURI = action.GetURI(pDocument->GetDocument()->GetPDFDoc(
)); |
| 615 pApp->FFI_DoURIAction(FX_LPCSTR(sURI)); | 603 pApp->FFI_DoURIAction(FX_LPCSTR(sURI)); |
| 616 } | 604 } |
| 617 | 605 |
| 618 void CPDFSDK_ActionHandler::DoAction_Named(CPDFSDK_Document* pDocument, const CP
DF_Action& action) | 606 void CPDFSDK_ActionHandler::DoAction_Named(CPDFSDK_Document* pDocument, const CP
DF_Action& action) |
| 619 { | 607 { |
| 620 » ASSERT(pDocument != NULL); | 608 » ASSERT(action); |
| 621 » ASSERT(action != NULL); | 609 |
| 622 | |
| 623 CFX_ByteString csName = action.GetNamedAction(); | 610 CFX_ByteString csName = action.GetNamedAction(); |
| 624 pDocument->GetEnv()->FFI_ExecuteNamedAction(csName); | 611 pDocument->GetEnv()->FFI_ExecuteNamedAction(csName); |
| 625 } | 612 } |
| 626 | 613 |
| 627 | 614 |
| 628 void CPDFSDK_ActionHandler::DoAction_SetOCGState(CPDFSDK_Document* pDocument,/*
CReader_DocView* pDocView,*/ const CPDF_Action& action) | 615 void CPDFSDK_ActionHandler::DoAction_SetOCGState(CPDFSDK_Document* pDocument, co
nst CPDF_Action& action) |
| 629 { | 616 { |
| 630 } | 617 } |
| 631 | 618 |
| 632 void CPDFSDK_ActionHandler::RunFieldJavaScript(CPDFSDK_Document* pDocument, CPDF
_FormField* pFormField, CPDF_AAction::AActionType type, | 619 void CPDFSDK_ActionHandler::RunFieldJavaScript(CPDFSDK_Document* pDocument, CPDF
_FormField* pFormField, CPDF_AAction::AActionType type, |
| 633
PDFSDK_FieldAction& data, const CFX_WideString& script) | 620
PDFSDK_FieldAction& data, const CFX_WideString& script) |
| 634 { | 621 { |
| 635 ASSERT(type != CPDF_AAction::Calculate); | 622 ASSERT(type != CPDF_AAction::Calculate); |
| 636 ASSERT(type != CPDF_AAction::Format); | 623 ASSERT(type != CPDF_AAction::Format); |
| 637 | 624 |
| 638 ASSERT(pDocument != NULL); | 625 ASSERT(pDocument != NULL); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 659 case CPDF_AAction::ButtonUp: | 646 case CPDF_AAction::ButtonUp: |
| 660 pContext->OnField_MouseUp(data.bModifier, data.bShift, pFormFiel
d); | 647 pContext->OnField_MouseUp(data.bModifier, data.bShift, pFormFiel
d); |
| 661 break; | 648 break; |
| 662 case CPDF_AAction::GetFocus: | 649 case CPDF_AAction::GetFocus: |
| 663 pContext->OnField_Focus(data.bModifier, data.bShift, pFormField,
data.sValue); | 650 pContext->OnField_Focus(data.bModifier, data.bShift, pFormField,
data.sValue); |
| 664 break; | 651 break; |
| 665 case CPDF_AAction::LoseFocus: | 652 case CPDF_AAction::LoseFocus: |
| 666 pContext->OnField_Blur(data.bModifier, data.bShift, pFormField,
data.sValue); | 653 pContext->OnField_Blur(data.bModifier, data.bShift, pFormField,
data.sValue); |
| 667 break; | 654 break; |
| 668 case CPDF_AAction::KeyStroke: | 655 case CPDF_AAction::KeyStroke: |
| 669 » » pContext->OnField_Keystroke(data.nCommitKey, data.sChange, data.
sChangeEx, data.bKeyDown, | 656 » » pContext->OnField_Keystroke(data.nCommitKey, data.sChange, data.
sChangeEx, data.bKeyDown, |
| 670 data.bModifier, data.nSelEnd, data.nSelStart, data.bShif
t, pFormField, data.sValue, | 657 data.bModifier, data.nSelEnd, data.nSelStart, data.bShif
t, pFormField, data.sValue, |
| 671 data.bWillCommit, data.bFieldFull, data.bRC); | 658 data.bWillCommit, data.bFieldFull, data.bRC); |
| 672 break; | 659 break; |
| 673 case CPDF_AAction::Validate: | 660 case CPDF_AAction::Validate: |
| 674 pContext->OnField_Validate(data.sChange, data.sChangeEx, data.bK
eyDown, data.bModifier, | 661 pContext->OnField_Validate(data.sChange, data.sChangeEx, data.bK
eyDown, data.bModifier, |
| 675 data.bShift, pFormField, data.sValue, data.bRC); | 662 data.bShift, pFormField, data.sValue, data.bRC); |
| 676 break; | 663 break; |
| 677 default: | 664 default: |
| 678 ASSERT(FALSE); | 665 ASSERT(FALSE); |
| 679 break; | 666 break; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 | 706 |
| 720 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntime(); | 707 IFXJS_Runtime* pRuntime = pDocument->GetJsRuntime(); |
| 721 ASSERT(pRuntime != NULL); | 708 ASSERT(pRuntime != NULL); |
| 722 | 709 |
| 723 pRuntime->SetReaderDocument(pDocument); | 710 pRuntime->SetReaderDocument(pDocument); |
| 724 | 711 |
| 725 IFXJS_Context* pContext = pRuntime->NewContext(); | 712 IFXJS_Context* pContext = pRuntime->NewContext(); |
| 726 ASSERT(pContext != NULL); | 713 ASSERT(pContext != NULL); |
| 727 | 714 |
| 728 switch (type) | 715 switch (type) |
| 729 » {» | 716 » { |
| 730 case CPDF_AAction::OpenPage: | 717 case CPDF_AAction::OpenPage: |
| 731 pContext->OnPage_Open(pDocument); | 718 pContext->OnPage_Open(pDocument); |
| 732 break; | 719 break; |
| 733 case CPDF_AAction::ClosePage: | 720 case CPDF_AAction::ClosePage: |
| 734 pContext->OnPage_Close(pDocument); | 721 pContext->OnPage_Close(pDocument); |
| 735 break; | 722 break; |
| 736 case CPDF_AAction::CloseDocument: | 723 case CPDF_AAction::CloseDocument: |
| 737 pContext->OnDoc_WillClose(pDocument); | 724 pContext->OnDoc_WillClose(pDocument); |
| 738 break; | 725 break; |
| 739 case CPDF_AAction::SaveDocument: | 726 case CPDF_AAction::SaveDocument: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 766 //CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), cs
Info); | 753 //CBCL_FormNotify::MsgBoxJSError(pPageView->GetPageViewWnd(), cs
Info); |
| 767 } | 754 } |
| 768 | 755 |
| 769 pRuntime->ReleaseContext(pContext); | 756 pRuntime->ReleaseContext(pContext); |
| 770 } | 757 } |
| 771 | 758 |
| 772 | 759 |
| 773 FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, CPDF
SDK_Document* pDocument) | 760 FX_BOOL CPDFSDK_FormActionHandler::DoAction_Hide(const CPDF_Action& action, CPDF
SDK_Document* pDocument) |
| 774 { | 761 { |
| 775 ASSERT(pDocument != NULL); | 762 ASSERT(pDocument != NULL); |
| 776 » | 763 |
| 777 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 764 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 778 ASSERT(pInterForm != NULL); | 765 ASSERT(pInterForm != NULL); |
| 779 » | 766 |
| 780 if (pInterForm->DoAction_Hide(action)) | 767 if (pInterForm->DoAction_Hide(action)) |
| 781 { | 768 { |
| 782 pDocument->SetChangeMark(); | 769 pDocument->SetChangeMark(); |
| 783 return TRUE; | 770 return TRUE; |
| 784 } | 771 } |
| 785 » | 772 |
| 786 return FALSE; | 773 return FALSE; |
| 787 } | 774 } |
| 788 | 775 |
| 789 FX_BOOL CPDFSDK_FormActionHandler::DoAction_SubmitForm(const CPDF_Action& action
, CPDFSDK_Document* pDocument) | 776 FX_BOOL CPDFSDK_FormActionHandler::DoAction_SubmitForm(const CPDF_Action& action
, CPDFSDK_Document* pDocument) |
| 790 { | 777 { |
| 791 ASSERT(pDocument != NULL); | 778 ASSERT(pDocument != NULL); |
| 792 » | 779 |
| 793 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 780 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 794 ASSERT(pInterForm != NULL); | 781 ASSERT(pInterForm != NULL); |
| 795 » | 782 |
| 796 return pInterForm->DoAction_SubmitForm(action); | 783 return pInterForm->DoAction_SubmitForm(action); |
| 797 } | 784 } |
| 798 | 785 |
| 799 FX_BOOL CPDFSDK_FormActionHandler::DoAction_ResetForm(const CPDF_Action& action,
CPDFSDK_Document* pDocument) | 786 FX_BOOL CPDFSDK_FormActionHandler::DoAction_ResetForm(const CPDF_Action& action,
CPDFSDK_Document* pDocument) |
| 800 { | 787 { |
| 801 ASSERT(pDocument != NULL); | 788 ASSERT(pDocument != NULL); |
| 802 » | 789 |
| 803 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 790 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 804 ASSERT(pInterForm != NULL); | 791 ASSERT(pInterForm != NULL); |
| 805 » | 792 |
| 806 if (pInterForm->DoAction_ResetForm(action)) | 793 if (pInterForm->DoAction_ResetForm(action)) |
| 807 » {» | 794 » { |
| 808 return TRUE; | 795 return TRUE; |
| 809 } | 796 } |
| 810 » | 797 |
| 811 return FALSE; | 798 return FALSE; |
| 812 } | 799 } |
| 813 | 800 |
| 814 FX_BOOL CPDFSDK_FormActionHandler::DoAction_ImportData(const CPDF_Action& action
, CPDFSDK_Document* pDocument) | 801 FX_BOOL CPDFSDK_FormActionHandler::DoAction_ImportData(const CPDF_Action& action
, CPDFSDK_Document* pDocument) |
| 815 { | 802 { |
| 816 ASSERT(pDocument != NULL); | 803 ASSERT(pDocument != NULL); |
| 817 » | 804 |
| 818 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); | 805 CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterF
orm(); |
| 819 ASSERT(pInterForm != NULL); | 806 ASSERT(pInterForm != NULL); |
| 820 » | 807 |
| 821 if (pInterForm->DoAction_ImportData(action)) | 808 if (pInterForm->DoAction_ImportData(action)) |
| 822 { | 809 { |
| 823 » » pDocument->SetChangeMark();» | 810 » » pDocument->SetChangeMark(); |
| 824 return TRUE; | 811 return TRUE; |
| 825 } | 812 } |
| 826 » | 813 |
| 827 return FALSE; | 814 return FALSE; |
| 828 } | 815 } |
| 829 | 816 |
| 830 FX_BOOL CPDFSDK_MediaActionHandler::DoAction_Rendition(const CPDF_Action& action
, CPDFSDK_Document* pDocument) | 817 FX_BOOL CPDFSDK_MediaActionHandler::DoAction_Rendition(const CPDF_Action& action
, CPDFSDK_Document* pDocument) |
| 831 { | 818 { |
| 832 return FALSE; | 819 return FALSE; |
| 833 } | 820 } |
| 834 | 821 |
| 835 FX_BOOL CPDFSDK_MediaActionHandler::DoAction_Sound(const CPDF_Action& action, CP
DFSDK_Document* pDocument) | 822 FX_BOOL CPDFSDK_MediaActionHandler::DoAction_Sound(const CPDF_Action& action, CP
DFSDK_Document* pDocument) |
| 836 { | 823 { |
| 837 return FALSE; | 824 return FALSE; |
| 838 } | 825 } |
| 839 | 826 |
| 840 FX_BOOL CPDFSDK_MediaActionHandler::DoAction_Movie(const CPDF_Action& action, CP
DFSDK_Document* pDocument) | 827 FX_BOOL CPDFSDK_MediaActionHandler::DoAction_Movie(const CPDF_Action& action, CP
DFSDK_Document* pDocument) |
| 841 { | 828 { |
| 842 return FALSE; | 829 return FALSE; |
| 843 } | 830 } |
| 844 | |
| OLD | NEW |