summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_baseform.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-03-05 16:30:09 -0800
committerTom Sepez <tsepez@chromium.org>2015-03-05 16:30:09 -0800
commit624b6c1e0fc6a5b0467061ef37b6db6856681afb (patch)
tree8b1083b0b3f167da7fa7747ab530a9b37dab44b7 /fpdfsdk/src/fsdk_baseform.cpp
parent61c25eebf5a0fcf44dd1a434c88f502a34073eac (diff)
downloadpdfium-624b6c1e0fc6a5b0467061ef37b6db6856681afb.tar.xz
Make conversion between CPDF_Action and its dictionary explicit.
Precursor to taking a second shot at cleaning up the FPDF_* APIs. A FPDF_Action is a CPDF_Dictionary, and a CPDF_Action is a structure holding a FPDF_Action. This goes against the convention that FPDF_ types get cast to CPDF_* types, so we want to make it clear where objects are getting constructed, etc. Also tidy fpdf_actionhandler.cpp because it bugs me. R=thestig@chromium.org Review URL: https://codereview.chromium.org/984773002
Diffstat (limited to 'fpdfsdk/src/fsdk_baseform.cpp')
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp34
1 files changed, 13 insertions, 21 deletions
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 6203f85662..a53e914b5c 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -1623,24 +1623,23 @@ CPDF_Action CPDFSDK_Widget::GetAAction(CPDF_AAction::AActionType eAAT)
case CPDF_AAction::PageVisible:
case CPDF_AAction::PageInvisible:
return CPDFSDK_Annot::GetAAction(eAAT);
+
case CPDF_AAction::KeyStroke:
case CPDF_AAction::Format:
case CPDF_AAction::Validate:
case CPDF_AAction::Calculate:
{
CPDF_FormField* pField = this->GetFormField();
- ASSERT(pField != NULL);
-
if (CPDF_AAction aa = pField->GetAdditionalAction())
return aa.GetAction(eAAT);
- else
- return CPDFSDK_Annot::GetAAction(eAAT);
+
+ return CPDFSDK_Annot::GetAAction(eAAT);
}
default:
- return NULL;
+ break;
}
- return NULL;
+ return CPDF_Action();
}
@@ -2161,7 +2160,7 @@ void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, CFX_WideString& c
FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action)
{
- ASSERT(action != NULL);
+ ASSERT(action);
CPDF_ActionFields af = action.GetWidgets();
CFX_PtrArray fieldObjects;
@@ -2217,13 +2216,13 @@ FX_BOOL CPDFSDK_InterForm::DoAction_Hide(const CPDF_Action& action)
FX_BOOL CPDFSDK_InterForm::DoAction_SubmitForm(const CPDF_Action& action)
{
- ASSERT(action != NULL);
+ ASSERT(action);
ASSERT(m_pInterForm != NULL);
CFX_WideString sDestination = action.GetFilePath();
if (sDestination.IsEmpty()) return FALSE;
- CPDF_Dictionary* pActionDict = action;
+ CPDF_Dictionary* pActionDict = action.GetDict();
if (pActionDict->KeyExist("Fields"))
{
CPDF_ActionFields af = action.GetWidgets();
@@ -2448,29 +2447,22 @@ FX_BOOL CPDFSDK_InterForm::ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf)
FX_BOOL CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action)
{
- ASSERT(action != NULL);
-
- CPDF_Dictionary* pActionDict = action;
+ ASSERT(action);
+ CPDF_Dictionary* pActionDict = action.GetDict();
if (pActionDict->KeyExist("Fields"))
{
CPDF_ActionFields af = action.GetWidgets();
FX_DWORD dwFlags = action.GetFlags();
-
+
CFX_PtrArray fieldObjects;
af.GetAllFields(fieldObjects);
CFX_PtrArray fields;
GetFieldFromObjects(fieldObjects, fields);
-
- ASSERT(m_pInterForm != NULL);
-
return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), TRUE);
}
- else
- {
- ASSERT(m_pInterForm != NULL);
- return m_pInterForm->ResetForm(TRUE);
- }
+
+ return m_pInterForm->ResetForm(TRUE);
}
FX_BOOL CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action)