summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfformfill.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/fpdfformfill.cpp')
-rw-r--r--fpdfsdk/fpdfformfill.cpp40
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>;