summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_annot.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-16 15:34:05 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-16 21:00:57 +0000
commit90fffb31e2ec6cf66fe1b85b466cd2f12ee9c87f (patch)
tree38ac9992765ed34727da873eefe4ece39c0c63e2 /core/fpdfdoc/cpdf_annot.cpp
parent9521036052646f60dc5c1ccd4821108eac4bca55 (diff)
downloadpdfium-90fffb31e2ec6cf66fe1b85b466cd2f12ee9c87f.tar.xz
Simplify CPVT_GenerateAP interface
This CL moves the annotation decision inside GenerateAnnotAP and hides the individual annotation AP generation methods. The form methods are hidden inside GenerateFormAP and a general GenerateEmptyAP has been added. Change-Id: I9e761cb10ceca70681df4e546631a7859f1bfc7c Reviewed-on: https://pdfium-review.googlesource.com/16130 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfdoc/cpdf_annot.cpp')
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp31
1 files changed, 6 insertions, 25 deletions
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index 1ccb890c04..9f8ab7878f 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -87,32 +87,13 @@ void CPDF_Annot::Init() {
void CPDF_Annot::GenerateAPIfNeeded() {
if (!ShouldGenerateAPForAnnotation(m_pAnnotDict.Get()))
return;
-
- CPDF_Dictionary* pDict = m_pAnnotDict.Get();
- bool result = false;
- if (m_nSubtype == CPDF_Annot::Subtype::CIRCLE)
- result = CPVT_GenerateAP::GenerateCircleAP(m_pDocument.Get(), pDict);
- else if (m_nSubtype == CPDF_Annot::Subtype::HIGHLIGHT)
- result = CPVT_GenerateAP::GenerateHighlightAP(m_pDocument.Get(), pDict);
- else if (m_nSubtype == CPDF_Annot::Subtype::INK)
- result = CPVT_GenerateAP::GenerateInkAP(m_pDocument.Get(), pDict);
- else if (m_nSubtype == CPDF_Annot::Subtype::POPUP)
- result = CPVT_GenerateAP::GeneratePopupAP(m_pDocument.Get(), pDict);
- else if (m_nSubtype == CPDF_Annot::Subtype::SQUARE)
- result = CPVT_GenerateAP::GenerateSquareAP(m_pDocument.Get(), pDict);
- else if (m_nSubtype == CPDF_Annot::Subtype::SQUIGGLY)
- result = CPVT_GenerateAP::GenerateSquigglyAP(m_pDocument.Get(), pDict);
- else if (m_nSubtype == CPDF_Annot::Subtype::STRIKEOUT)
- result = CPVT_GenerateAP::GenerateStrikeOutAP(m_pDocument.Get(), pDict);
- else if (m_nSubtype == CPDF_Annot::Subtype::TEXT)
- result = CPVT_GenerateAP::GenerateTextAP(m_pDocument.Get(), pDict);
- else if (m_nSubtype == CPDF_Annot::Subtype::UNDERLINE)
- result = CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument.Get(), pDict);
-
- if (result) {
- m_pAnnotDict->SetNewFor<CPDF_Boolean>(kPDFiumKey_HasGeneratedAP, result);
- m_bHasGeneratedAP = result;
+ if (!CPVT_GenerateAP::GenerateAnnotAP(m_nSubtype, m_pDocument.Get(),
+ m_pAnnotDict.Get())) {
+ return;
}
+
+ m_pAnnotDict->SetNewFor<CPDF_Boolean>(kPDFiumKey_HasGeneratedAP, true);
+ m_bHasGeneratedAP = true;
}
bool CPDF_Annot::ShouldDrawAnnotation() {