summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_baseannot.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-03-05 16:44:22 -0800
committerTom Sepez <tsepez@chromium.org>2015-03-05 16:44:22 -0800
commit7b5bc26e8267fec38bef9f95cd04d2bd731faff3 (patch)
tree9203aa0ff0d4a34616a5161b2ded34ce7e9ada24 /fpdfsdk/src/fsdk_baseannot.cpp
parent827a1722f70e7092270b5e0fdfba1e9c0b1ac50f (diff)
downloadpdfium-7b5bc26e8267fec38bef9f95cd04d2bd731faff3.tar.xz
Merge to XFA: Make conversion between CPDF_Action and its dictionary explicit.
Original Review URL: https://codereview.chromium.org/984773002 R=thestig@chromium.org TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/984783002
Diffstat (limited to 'fpdfsdk/src/fsdk_baseannot.cpp')
-rw-r--r--fpdfsdk/src/fsdk_baseannot.cpp42
1 files changed, 13 insertions, 29 deletions
diff --git a/fpdfsdk/src/fsdk_baseannot.cpp b/fpdfsdk/src/fsdk_baseannot.cpp
index 9b669e9f4a..e57eb674cc 100644
--- a/fpdfsdk/src/fsdk_baseannot.cpp
+++ b/fpdfsdk/src/fsdk_baseannot.cpp
@@ -1086,43 +1086,30 @@ FX_BOOL CPDFSDK_BAAnnot::IsVisible() const
CPDF_Action CPDFSDK_BAAnnot::GetAction() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- return m_pAnnot->m_pAnnotDict->GetDict("A");
+ return CPDF_Action(m_pAnnot->m_pAnnotDict->GetDict("A"));
}
void CPDFSDK_BAAnnot::SetAction(const CPDF_Action& action)
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
- ASSERT(action != NULL);
-
- if ((CPDF_Action&)action != m_pAnnot->m_pAnnotDict->GetDict("A"))
+ ASSERT(action);
+ if ((CPDF_Action&)action != CPDF_Action(m_pAnnot->m_pAnnotDict->GetDict("A")))
{
CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
- ASSERT(pDoc != NULL);
-
- if (action.m_pDict && (action.m_pDict->GetObjNum() == 0))
- pDoc->AddIndirectObject(action.m_pDict);
- m_pAnnot->m_pAnnotDict->SetAtReference("A", pDoc, action.m_pDict->GetObjNum());
+ CPDF_Dictionary* pDict = action.GetDict();
+ if (pDict && pDict->GetObjNum() == 0) {
+ pDoc->AddIndirectObject(pDict);
+ }
+ m_pAnnot->m_pAnnotDict->SetAtReference("A", pDoc, pDict->GetObjNum());
}
}
void CPDFSDK_BAAnnot::RemoveAction()
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
m_pAnnot->m_pAnnotDict->RemoveAt("A");
}
CPDF_AAction CPDFSDK_BAAnnot::GetAAction() const
{
- ASSERT(m_pAnnot != NULL);
- ASSERT(m_pAnnot->m_pAnnotDict != NULL);
-
return m_pAnnot->m_pAnnotDict->GetDict("AA");
}
@@ -1147,17 +1134,14 @@ void CPDFSDK_BAAnnot::RemoveAAction()
CPDF_Action CPDFSDK_BAAnnot::GetAAction(CPDF_AAction::AActionType eAAT)
{
CPDF_AAction AAction = GetAAction();
-
+
if (AAction.ActionExist(eAAT))
- {
return AAction.GetAction(eAAT);
- }
- else if (eAAT == CPDF_AAction::ButtonUp)
- {
+
+ if (eAAT == CPDF_AAction::ButtonUp)
return GetAction();
- }
-
- return NULL;
+
+ return CPDF_Action();
}
FX_BOOL CPDFSDK_BAAnnot::IsXFAField()