summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fsdk_annothandler.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-11-24 09:50:51 -0800
committerTom Sepez <tsepez@chromium.org>2015-11-24 09:50:51 -0800
commit50d12ada784ad3ba3f9ed6935d59f1ce828695e5 (patch)
tree27caed4654213e5433256147a7c6b1b085692a32 /fpdfsdk/src/fsdk_annothandler.cpp
parenta2167107bbcef6a3e3687d49a5b1e62503391316 (diff)
downloadpdfium-50d12ada784ad3ba3f9ed6935d59f1ce828695e5.tar.xz
Introduce "underlying types" to abstract XFA differences.
See the comment in fsdk_define.h. Also tidy up a bit, and remove dead DeletePages(). This should help us match master more closely (given corresponding changes on the master side). R=thestig@chromium.org Review URL: https://codereview.chromium.org/1473503002 .
Diffstat (limited to 'fpdfsdk/src/fsdk_annothandler.cpp')
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp58
1 files changed, 24 insertions, 34 deletions
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index bf0993bd4b..2965d3290f 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -646,42 +646,32 @@ void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {
}
void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot != NULL);
-
- CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
- ASSERT(pPageView != NULL);
-
- CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
- ASSERT(pSDKDoc != NULL);
-
- CPDFXFA_Document* pDoc = pSDKDoc->GetDocument();
- ASSERT(pDoc != NULL);
-
- CFX_ByteString sSubType = pAnnot->GetSubType();
-
- if (sSubType == BFFT_SIGNATURE) {
- } else {
- CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- if (!pWidget->IsAppearanceValid())
- pWidget->ResetAppearance(NULL, FALSE);
-
- int nFieldType = pWidget->GetFieldType();
- if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
- FX_BOOL bFormated = FALSE;
- CFX_WideString sValue = pWidget->OnFormat(bFormated);
- if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) {
- pWidget->ResetAppearance(sValue.c_str(), FALSE);
- }
- }
+ if (pAnnot->GetSubType() == BFFT_SIGNATURE)
+ return;
- if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
- if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
- pWidget->ResetAppearance(FALSE);
+ CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
+ if (!pWidget->IsAppearanceValid())
+ pWidget->ResetAppearance(NULL, FALSE);
+
+ int nFieldType = pWidget->GetFieldType();
+ if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
+ FX_BOOL bFormated = FALSE;
+ CFX_WideString sValue = pWidget->OnFormat(bFormated);
+ if (bFormated && nFieldType == FIELDTYPE_COMBOBOX) {
+ pWidget->ResetAppearance(sValue.c_str(), FALSE);
}
+ }
- if (m_pFormFiller)
- m_pFormFiller->OnLoad(pAnnot);
+ CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
+ CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
+ CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
+ if (pDoc->GetDocType() == DOCTYPE_STATIC_XFA) {
+ if (!pWidget->IsAppearanceValid() && !pWidget->GetValue().IsEmpty())
+ pWidget->ResetAppearance(FALSE);
}
+
+ if (m_pFormFiller)
+ m_pFormFiller->OnLoad(pAnnot);
}
FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
@@ -842,7 +832,7 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::HitTest(CPDFSDK_PageView* pPageView,
if (!pSDKDoc)
return FALSE;
- CPDFXFA_Document* pDoc = pSDKDoc->GetDocument();
+ CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
if (!pDoc)
return FALSE;
@@ -1116,7 +1106,7 @@ IXFA_WidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler(
if (!pSDKDoc)
return NULL;
- CPDFXFA_Document* pDoc = pSDKDoc->GetDocument();
+ CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
if (!pDoc)
return NULL;