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_baseannot.h" | 9 #include "../include/fsdk_baseannot.h" |
10 #include "../include/fsdk_baseform.h" | 10 #include "../include/fsdk_baseform.h" |
(...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1616 case CPDF_AAction::CursorExit: | 1616 case CPDF_AAction::CursorExit: |
1617 case CPDF_AAction::ButtonDown: | 1617 case CPDF_AAction::ButtonDown: |
1618 case CPDF_AAction::ButtonUp: | 1618 case CPDF_AAction::ButtonUp: |
1619 case CPDF_AAction::GetFocus: | 1619 case CPDF_AAction::GetFocus: |
1620 case CPDF_AAction::LoseFocus: | 1620 case CPDF_AAction::LoseFocus: |
1621 case CPDF_AAction::PageOpen: | 1621 case CPDF_AAction::PageOpen: |
1622 case CPDF_AAction::PageClose: | 1622 case CPDF_AAction::PageClose: |
1623 case CPDF_AAction::PageVisible: | 1623 case CPDF_AAction::PageVisible: |
1624 case CPDF_AAction::PageInvisible: | 1624 case CPDF_AAction::PageInvisible: |
1625 return CPDFSDK_Annot::GetAAction(eAAT); | 1625 return CPDFSDK_Annot::GetAAction(eAAT); |
| 1626 |
1626 case CPDF_AAction::KeyStroke: | 1627 case CPDF_AAction::KeyStroke: |
1627 case CPDF_AAction::Format: | 1628 case CPDF_AAction::Format: |
1628 case CPDF_AAction::Validate: | 1629 case CPDF_AAction::Validate: |
1629 case CPDF_AAction::Calculate: | 1630 case CPDF_AAction::Calculate: |
1630 { | 1631 { |
1631 CPDF_FormField* pField = this->GetFormField(); | 1632 CPDF_FormField* pField = this->GetFormField(); |
1632 ASSERT(pField != NULL); | |
1633 | |
1634 if (CPDF_AAction aa = pField->GetAdditionalAction()) | 1633 if (CPDF_AAction aa = pField->GetAdditionalAction()) |
1635 return aa.GetAction(eAAT); | 1634 return aa.GetAction(eAAT); |
1636 » » » else | 1635 |
1637 » » » » return CPDFSDK_Annot::GetAAction(eAAT); | 1636 » » » return CPDFSDK_Annot::GetAAction(eAAT); |
1638 } | 1637 } |
1639 default: | 1638 default: |
1640 » » return NULL; | 1639 » » break; |
1641 } | 1640 } |
1642 | 1641 |
1643 » return NULL; | 1642 » return CPDF_Action(); |
1644 } | 1643 } |
1645 | 1644 |
1646 | 1645 |
1647 CFX_WideString CPDFSDK_Widget::GetAlternateName() const | 1646 CFX_WideString CPDFSDK_Widget::GetAlternateName() const |
1648 { | 1647 { |
1649 CPDF_FormField* pFormField = GetFormField(); | 1648 CPDF_FormField* pFormField = GetFormField(); |
1650 ASSERT(pFormField != NULL); | 1649 ASSERT(pFormField != NULL); |
1651 | 1650 |
1652 return pFormField->GetAlternateName(); | 1651 return pFormField->GetAlternateName(); |
1653 } | 1652 } |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 bRC = fa.bRC; | 2153 bRC = fa.bRC; |
2155 | 2154 |
2156 } | 2155 } |
2157 } | 2156 } |
2158 } | 2157 } |
2159 | 2158 |
2160 /* ----------------------------- action ----------------------------- */ | 2159 /* ----------------------------- action ----------------------------- */ |
2161 | 2160 |
2162 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) | 2161 FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action) |
2163 { | 2162 { |
2164 » ASSERT(action != NULL); | 2163 » ASSERT(action); |
2165 | 2164 |
2166 CPDF_ActionFields af = action.GetWidgets(); | 2165 CPDF_ActionFields af = action.GetWidgets(); |
2167 CFX_PtrArray fieldObjects; | 2166 CFX_PtrArray fieldObjects; |
2168 af.GetAllFields(fieldObjects); | 2167 af.GetAllFields(fieldObjects); |
2169 CFX_PtrArray widgetArray; | 2168 CFX_PtrArray widgetArray; |
2170 CFX_PtrArray fields; | 2169 CFX_PtrArray fields; |
2171 GetFieldFromObjects(fieldObjects, fields); | 2170 GetFieldFromObjects(fieldObjects, fields); |
2172 | 2171 |
2173 FX_BOOL bHide = action.GetHideStatus(); | 2172 FX_BOOL bHide = action.GetHideStatus(); |
2174 | 2173 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 bChanged = TRUE; | 2209 bChanged = TRUE; |
2211 } | 2210 } |
2212 } | 2211 } |
2213 } | 2212 } |
2214 | 2213 |
2215 return bChanged; | 2214 return bChanged; |
2216 } | 2215 } |
2217 | 2216 |
2218 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) | 2217 FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action) |
2219 { | 2218 { |
2220 » ASSERT(action != NULL); | 2219 » ASSERT(action); |
2221 ASSERT(m_pInterForm != NULL); | 2220 ASSERT(m_pInterForm != NULL); |
2222 | 2221 |
2223 CFX_WideString sDestination = action.GetFilePath(); | 2222 CFX_WideString sDestination = action.GetFilePath(); |
2224 if (sDestination.IsEmpty()) return FALSE; | 2223 if (sDestination.IsEmpty()) return FALSE; |
2225 | 2224 |
2226 » CPDF_Dictionary* pActionDict = action; | 2225 » CPDF_Dictionary* pActionDict = action.GetDict(); |
2227 if (pActionDict->KeyExist("Fields")) | 2226 if (pActionDict->KeyExist("Fields")) |
2228 { | 2227 { |
2229 CPDF_ActionFields af = action.GetWidgets(); | 2228 CPDF_ActionFields af = action.GetWidgets(); |
2230 FX_DWORD dwFlags = action.GetFlags(); | 2229 FX_DWORD dwFlags = action.GetFlags(); |
2231 | 2230 |
2232 CFX_PtrArray fieldObjects; | 2231 CFX_PtrArray fieldObjects; |
2233 af.GetAllFields(fieldObjects); | 2232 af.GetAllFields(fieldObjects); |
2234 CFX_PtrArray fields; | 2233 CFX_PtrArray fields; |
2235 GetFieldFromObjects(fieldObjects, fields); | 2234 GetFieldFromObjects(fieldObjects, fields); |
2236 | 2235 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2441 | 2440 |
2442 FX_BOOL bRet = pFDF->WriteBuf(textBuf); | 2441 FX_BOOL bRet = pFDF->WriteBuf(textBuf); |
2443 delete pFDF; | 2442 delete pFDF; |
2444 | 2443 |
2445 return bRet; | 2444 return bRet; |
2446 } | 2445 } |
2447 | 2446 |
2448 | 2447 |
2449 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) | 2448 FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) |
2450 { | 2449 { |
2451 » ASSERT(action != NULL); | 2450 » ASSERT(action); |
2452 | 2451 |
2453 » CPDF_Dictionary* pActionDict = action; | 2452 » CPDF_Dictionary* pActionDict = action.GetDict(); |
2454 | |
2455 if (pActionDict->KeyExist("Fields")) | 2453 if (pActionDict->KeyExist("Fields")) |
2456 { | 2454 { |
2457 CPDF_ActionFields af = action.GetWidgets(); | 2455 CPDF_ActionFields af = action.GetWidgets(); |
2458 FX_DWORD dwFlags = action.GetFlags(); | 2456 FX_DWORD dwFlags = action.GetFlags(); |
2459 » » | 2457 |
2460 CFX_PtrArray fieldObjects; | 2458 CFX_PtrArray fieldObjects; |
2461 af.GetAllFields(fieldObjects); | 2459 af.GetAllFields(fieldObjects); |
2462 CFX_PtrArray fields; | 2460 CFX_PtrArray fields; |
2463 GetFieldFromObjects(fieldObjects, fields); | 2461 GetFieldFromObjects(fieldObjects, fields); |
2464 | |
2465 ASSERT(m_pInterForm != NULL); | |
2466 | |
2467 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE); | 2462 return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE); |
2468 } | 2463 } |
2469 » else | 2464 |
2470 » { | 2465 » return m_pInterForm->ResetForm(TRUE); |
2471 » » ASSERT(m_pInterForm != NULL); | |
2472 » » return m_pInterForm->ResetForm(TRUE); | |
2473 » } | |
2474 } | 2466 } |
2475 | 2467 |
2476 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) | 2468 FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) |
2477 { | 2469 { |
2478 return FALSE; | 2470 return FALSE; |
2479 } | 2471 } |
2480 | 2472 |
2481 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, CFX_Ptr
Array& fields) | 2473 void CPDFSDK_InterForm::GetFieldFromObjects(const CFX_PtrArray& objects, CFX_Ptr
Array& fields) |
2482 { | 2474 { |
2483 ASSERT(m_pInterForm != NULL); | 2475 ASSERT(m_pInterForm != NULL); |
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3012 | 3004 |
3013 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); | 3005 CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot(); |
3014 ASSERT(pPDFAnnot != NULL); | 3006 ASSERT(pPDFAnnot != NULL); |
3015 | 3007 |
3016 CPDF_Rect rcAnnot; | 3008 CPDF_Rect rcAnnot; |
3017 pPDFAnnot->GetRect(rcAnnot); | 3009 pPDFAnnot->GetRect(rcAnnot); |
3018 | 3010 |
3019 return rcAnnot; | 3011 return rcAnnot; |
3020 } | 3012 } |
3021 | 3013 |
OLD | NEW |