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