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