diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-03-23 09:17:10 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-23 13:50:52 +0000 |
commit | cdba747a53082a7f36534dffa6a3ad01628e53c3 (patch) | |
tree | 4df0b15de7600592588a263deb9a3adee617f417 /fpdfsdk/fpdfformfill.cpp | |
parent | 1bbedec89cc59df3e305dc25082d9699237d70ab (diff) | |
download | pdfium-cdba747a53082a7f36534dffa6a3ad01628e53c3.tar.xz |
Cleanup DocType defines
This Cl synchronizes the DocType's defined in XFA with the DOCTYPE
flag used in public/. The internal XFA version is converted to an
enum class.
Change-Id: I1f7be71a200c1ec0f09f9b08099791da1f4fa2e4
Reviewed-on: https://pdfium-review.googlesource.com/3152
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdfformfill.cpp')
-rw-r--r-- | fpdfsdk/fpdfformfill.cpp | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index 3c866a91a3..c664d70c57 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -32,6 +32,13 @@ #include "xfa/fxfa/xfa_ffdocview.h" #include "xfa/fxfa/xfa_ffpageview.h" #include "xfa/fxfa/xfa_ffwidget.h" + +static_assert(static_cast<int>(XFA_DocType::PDF) == DOCTYPE_PDF, + "PDF doctype must match"); +static_assert(static_cast<int>(XFA_DocType::Dynamic) == DOCTYPE_DYNAMIC_XFA, + "Dynamic XFA doctype must match"); +static_assert(static_cast<int>(XFA_DocType::Static) == DOCTYPE_STATIC_XFA, + "Static XFA doctype must match"); #endif // PDF_ENABLE_XFA namespace { @@ -423,9 +430,10 @@ DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, return; CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); - if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && - pContext->GetDocType() != XFA_DOCTYPE_Static) + if (pContext->GetDocType() != XFA_DocType::Dynamic && + pContext->GetDocType() != XFA_DocType::Static) { return; + } static_cast<CXFA_FFWidget*>(hWidget)->Undo(); } @@ -436,8 +444,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, return; CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); - if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && - pContext->GetDocType() != XFA_DOCTYPE_Static) + if (pContext->GetDocType() != XFA_DocType::Dynamic && + pContext->GetDocType() != XFA_DocType::Static) return; static_cast<CXFA_FFWidget*>(hWidget)->Redo(); @@ -449,8 +457,8 @@ DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, return; CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); - if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && - pContext->GetDocType() != XFA_DOCTYPE_Static) + if (pContext->GetDocType() != XFA_DocType::Dynamic && + pContext->GetDocType() != XFA_DocType::Static) return; static_cast<CXFA_FFWidget*>(hWidget)->SelectAll(); @@ -464,8 +472,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, return; CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); - if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && - pContext->GetDocType() != XFA_DOCTYPE_Static) + if (pContext->GetDocType() != XFA_DocType::Dynamic && + pContext->GetDocType() != XFA_DocType::Static) return; CFX_WideString wsCpText; @@ -496,8 +504,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, return; CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); - if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && - pContext->GetDocType() != XFA_DOCTYPE_Static) + if (pContext->GetDocType() != XFA_DocType::Dynamic && + pContext->GetDocType() != XFA_DocType::Static) return; CFX_WideString wsCpText; @@ -528,8 +536,8 @@ DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, return; CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); - if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && - pContext->GetDocType() != XFA_DOCTYPE_Static) + if (pContext->GetDocType() != XFA_DocType::Dynamic && + pContext->GetDocType() != XFA_DocType::Static) return; CFX_WideString wstr = CFX_WideString::FromUTF16LE(wsText, size); @@ -546,8 +554,8 @@ FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, return; CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); - if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && - pContext->GetDocType() != XFA_DOCTYPE_Static) + if (pContext->GetDocType() != XFA_DocType::Dynamic && + pContext->GetDocType() != XFA_DocType::Static) return; CFX_PointF ptPopup; @@ -567,8 +575,8 @@ FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, return; CPDFXFA_Context* pContext = static_cast<CPDFXFA_Context*>(document); - if (pContext->GetDocType() != XFA_DOCTYPE_Dynamic && - pContext->GetDocType() != XFA_DOCTYPE_Static) + if (pContext->GetDocType() != XFA_DocType::Dynamic && + pContext->GetDocType() != XFA_DocType::Static) return; std::vector<CFX_ByteString>* sSuggestWords = new std::vector<CFX_ByteString>; |