summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-12 15:47:07 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-12 15:47:07 -0700
commita8a39e25af3c19bb91434fdf367cffa0e1536934 (patch)
treed6bfa30a756014ec79dfce75d6658ecf3778594a /fpdfsdk/src
parent5ef9faa8e8f5593556d78f775d86f1e52e4c341a (diff)
downloadpdfium-a8a39e25af3c19bb91434fdf367cffa0e1536934.tar.xz
Allow building of XFA branch without XFA
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1399833002 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdfsave.cpp3
-rw-r--r--fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp4
-rw-r--r--fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp12
-rw-r--r--fpdfsdk/src/fsdk_annothandler.cpp7
-rw-r--r--fpdfsdk/src/fsdk_baseform.cpp24
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp3
-rw-r--r--fpdfsdk/src/javascript/JS_Runtime.cpp5
7 files changed, 48 insertions, 10 deletions
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index 7a666bceb8..2cfbb81cd0 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -60,6 +60,7 @@ void CFX_IFileWrite::Release() {
FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument,
CFX_PtrArray& fileList) {
+#ifdef PDF_ENABLE_XFA
if (!pDocument)
return FALSE;
if (pDocument->GetDocType() != DOCTYPE_DYNIMIC_XFA &&
@@ -228,6 +229,8 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument,
}
}
pContext->Release();
+#endif // PDF_ENABLE_XFA
+
return TRUE;
}
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
index 255d2bb024..fed3f32318 100644
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp
@@ -43,14 +43,17 @@ CPDFXFA_App::~CPDFXFA_App() {
delete m_pXFAApp;
m_pXFAApp = NULL;
+#ifdef PDF_ENABLE_XFA
FXJSE_Runtime_Release(m_hJSERuntime);
m_hJSERuntime = NULL;
FXJSE_Finalize();
BC_Library_Destory();
+#endif
}
FX_BOOL CPDFXFA_App::Initialize() {
+#ifdef PDF_ENABLE_XFA
BC_Library_Init();
FXJSE_Initialize();
@@ -67,6 +70,7 @@ FX_BOOL CPDFXFA_App::Initialize() {
return FALSE;
m_pXFAApp->SetDefaultFontMgr(m_pFontMgr);
+#endif
return TRUE;
}
diff --git a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
index cef65acd1b..365d5d786b 100644
--- a/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/src/fpdfxfa/fpdfxfa_doc.cpp
@@ -338,7 +338,10 @@ FX_BOOL CPDFXFA_Document::GetPopupPos(IXFA_Widget* hWidget,
CXFA_WidgetAcc* pWidgetAcc =
m_pXFADocView->GetWidgetHandler()->GetDataAcc(hWidget);
- int nRotate = pWidgetAcc->GetRotate();
+ int nRotate = 0;
+#ifdef PDF_ENABLE_XFA
+ nRotate = pWidgetAcc->GetRotate();
+#endif
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
if (pEnv == NULL)
@@ -894,6 +897,7 @@ FX_BOOL CPDFXFA_Document::_NotifySubmit(FX_BOOL bPrevOrPost) {
}
FX_BOOL CPDFXFA_Document::_OnBeforeNotifySumbit() {
+#ifdef PDF_ENABLE_XFA
if (m_iDocType != DOCTYPE_DYNIMIC_XFA && m_iDocType != DOCTYPE_STATIC_XFA)
return TRUE;
if (m_pXFADocView == NULL)
@@ -939,7 +943,7 @@ FX_BOOL CPDFXFA_Document::_OnBeforeNotifySumbit() {
pWidgetAccIterator->Release();
m_pXFADocView->UpdateDocView();
}
-
+#endif
return TRUE;
}
void CPDFXFA_Document::_OnAfterNotifySumbit() {
@@ -1190,6 +1194,7 @@ FX_BOOL CPDFXFA_Document::_MailToInfo(CFX_WideString& csURL,
}
FX_BOOL CPDFXFA_Document::_SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) {
+#ifdef PDF_ENABLE_XFA
CFX_WideStringC csURLC;
submit.GetSubmitTarget(csURLC);
CFX_WideString csURL = csURLC;
@@ -1290,6 +1295,9 @@ FX_BOOL CPDFXFA_Document::_SubmitData(IXFA_Doc* hDoc, CXFA_Submit submit) {
}
return bRet;
+#else
+ return TRUE;
+#endif
}
FX_BOOL CPDFXFA_Document::SetGlobalProperty(IXFA_Doc* hDoc,
diff --git a/fpdfsdk/src/fsdk_annothandler.cpp b/fpdfsdk/src/fsdk_annothandler.cpp
index 287a26baa8..11d2aef928 100644
--- a/fpdfsdk/src/fsdk_annothandler.cpp
+++ b/fpdfsdk/src/fsdk_annothandler.cpp
@@ -765,6 +765,8 @@ void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
CFX_RenderDevice* pDevice,
CPDF_Matrix* pUser2Device,
FX_DWORD dwFlags) {
+#ifdef PDF_ENABLE_XFA
+
ASSERT(pPageView != NULL);
ASSERT(pAnnot != NULL);
@@ -790,6 +792,7 @@ void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighlight);
// to do highlight and shadow
+#endif // PDF_ENABLE_XFA
}
void CPDFSDK_XFAAnnotHandler::ReleaseAnnot(CPDFSDK_Annot* pAnnot) {
@@ -811,13 +814,15 @@ CPDF_Rect CPDFSDK_XFAAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
IXFA_WidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
ASSERT(pWidgetHandler != NULL);
+ CFX_RectF rcBBox;
+#ifdef PDF_ENABLE_XFA
XFA_ELEMENT eType =
pWidgetHandler->GetDataAcc(pAnnot->GetXFAWidget())->GetUIType();
- CFX_RectF rcBBox;
if (eType == XFA_ELEMENT_Signature)
pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox,
XFA_WIDGETSTATUS_Visible, TRUE);
else
+#endif
pWidgetHandler->GetBBox(pAnnot->GetXFAWidget(), rcBBox, 0);
CFX_FloatRect rcWidget(rcBBox.left, rcBBox.top, rcBBox.left + rcBBox.width,
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp
index 81b4ef409f..4a6b98782c 100644
--- a/fpdfsdk/src/fsdk_baseform.cpp
+++ b/fpdfsdk/src/fsdk_baseform.cpp
@@ -276,6 +276,7 @@ FX_BOOL CPDFSDK_Widget::OnXFAAAction(PDFSDK_XFAAActionType eXFAAAT,
}
void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) {
+#ifdef PDF_ENABLE_XFA
if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
CPDF_FormField* pFormField = GetFormField();
@@ -325,9 +326,11 @@ void CPDFSDK_Widget::Synchronize(FX_BOOL bSynchronizeElse) {
}
}
}
+#endif // PDF_ENABLE_XFA
}
void CPDFSDK_Widget::SynchronizeXFAValue() {
+#ifdef PDF_ENABLE_XFA
ASSERT(m_pPageView != NULL);
CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
@@ -352,9 +355,11 @@ void CPDFSDK_Widget::SynchronizeXFAValue() {
pFormCtrl);
}
}
+#endif // PDF_ENABLE_XFA
}
void CPDFSDK_Widget::SynchronizeXFAItems() {
+#ifdef PDF_ENABLE_XFA
ASSERT(m_pPageView != NULL);
CPDFSDK_Document* pSDKDoc = m_pPageView->GetSDKDocument();
@@ -375,12 +380,14 @@ void CPDFSDK_Widget::SynchronizeXFAItems() {
SynchronizeXFAItems(pXFADocView, hWidget, pFormField, NULL);
}
}
+#endif // PDF_ENABLE_XFA
}
void CPDFSDK_Widget::SynchronizeXFAValue(IXFA_DocView* pXFADocView,
IXFA_Widget* hWidget,
CPDF_FormField* pFormField,
CPDF_FormControl* pFormControl) {
+#ifdef PDF_ENABLE_XFA
ASSERT(pXFADocView != NULL);
ASSERT(hWidget != NULL);
@@ -449,12 +456,14 @@ void CPDFSDK_Widget::SynchronizeXFAValue(IXFA_DocView* pXFADocView,
} break;
}
}
+#endif // PDF_ENABLE_XFA
}
void CPDFSDK_Widget::SynchronizeXFAItems(IXFA_DocView* pXFADocView,
IXFA_Widget* hWidget,
CPDF_FormField* pFormField,
CPDF_FormControl* pFormControl) {
+#ifdef PDF_ENABLE_XFA
ASSERT(pXFADocView != NULL);
ASSERT(hWidget != NULL);
@@ -496,6 +505,7 @@ void CPDFSDK_Widget::SynchronizeXFAItems(IXFA_DocView* pXFADocView,
} break;
}
}
+#endif // PDF_ENABLE_XFA
}
FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(
@@ -672,6 +682,7 @@ FX_FLOAT CPDFSDK_Widget::GetFontSize() const {
}
int CPDFSDK_Widget::GetSelectedIndex(int nIndex) {
+#ifdef PDF_ENABLE_XFA
if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
@@ -680,14 +691,14 @@ int CPDFSDK_Widget::GetSelectedIndex(int nIndex) {
}
}
}
+#endif // PDF_ENABLE_XFA
CPDF_FormField* pFormField = GetFormField();
- ASSERT(pFormField != NULL);
-
return pFormField->GetSelectedIndex(nIndex);
}
CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) {
+#ifdef PDF_ENABLE_XFA
if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
@@ -698,10 +709,9 @@ CFX_WideString CPDFSDK_Widget::GetValue(FX_BOOL bDisplay) {
}
}
}
+#endif // PDF_ENABLE_XFA
CPDF_FormField* pFormField = GetFormField();
- ASSERT(pFormField != NULL);
-
return pFormField->GetValue();
}
@@ -727,6 +737,7 @@ int CPDFSDK_Widget::CountOptions() const {
}
FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) {
+#ifdef PDF_ENABLE_XFA
if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
@@ -737,6 +748,7 @@ FX_BOOL CPDFSDK_Widget::IsOptionSelected(int nIndex) {
}
}
}
+#endif // PDF_ENABLE_XFA
CPDF_FormField* pFormField = GetFormField();
return pFormField->IsItemSelected(nIndex);
@@ -748,6 +760,7 @@ int CPDFSDK_Widget::GetTopVisibleIndex() const {
}
FX_BOOL CPDFSDK_Widget::IsChecked() {
+#ifdef PDF_ENABLE_XFA
if (IXFA_WidgetHandler* pXFAWidgetHandler = this->GetXFAWidgetHandler()) {
if (IXFA_Widget* hWidget = this->GetMixXFAWidget()) {
if (CXFA_WidgetAcc* pWidgetAcc = pXFAWidgetHandler->GetDataAcc(hWidget)) {
@@ -756,10 +769,9 @@ FX_BOOL CPDFSDK_Widget::IsChecked() {
}
}
}
+#endif // PDF_ENABLE_XFA
CPDF_FormControl* pFormCtrl = GetFormControl();
- ASSERT(pFormCtrl != NULL);
-
return pFormCtrl->IsChecked();
}
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index 4c684cfb69..2ab9d8bf78 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -694,6 +694,7 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
if (pPage == NULL)
return;
+#ifdef PDF_ENABLE_XFA
if (pPage->GetDocument()->GetDocType() == DOCTYPE_DYNIMIC_XFA) {
CFX_Graphics gs;
gs.Create(pDevice);
@@ -717,6 +718,8 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
pRenderContext->Release();
return;
}
+#endif // PDF_ENABLE_XFA
+
// for pdf/static xfa.
CPDFSDK_AnnotIterator annotIterator(this, TRUE);
CPDFSDK_Annot* pSDKAnnot = NULL;
diff --git a/fpdfsdk/src/javascript/JS_Runtime.cpp b/fpdfsdk/src/javascript/JS_Runtime.cpp
index d01c1fae7d..8a0d6666bb 100644
--- a/fpdfsdk/src/javascript/JS_Runtime.cpp
+++ b/fpdfsdk/src/javascript/JS_Runtime.cpp
@@ -222,6 +222,7 @@ CFX_WideString ChangeObjName(const CFX_WideString& str) {
}
FX_BOOL CJS_Runtime::GetHValueByName(const CFX_ByteStringC& utf8Name,
FXJSE_HVALUE hValue) {
+#ifdef PDF_ENABLE_XFA
const FX_CHAR* name = utf8Name.GetCStr();
v8::Locker lock(GetIsolate());
@@ -242,11 +243,13 @@ FX_BOOL CJS_Runtime::GetHValueByName(const CFX_ByteStringC& utf8Name,
return FALSE;
}
((CFXJSE_Value*)hValue)->ForceSetValue(propvalue);
+#endif
return TRUE;
}
FX_BOOL CJS_Runtime::SetHValueByName(const CFX_ByteStringC& utf8Name,
FXJSE_HVALUE hValue) {
+#ifdef PDF_ENABLE_XFA
if (utf8Name.IsEmpty() || hValue == NULL)
return FALSE;
const FX_CHAR* name = utf8Name.GetCStr();
@@ -266,7 +269,7 @@ FX_BOOL CJS_Runtime::SetHValueByName(const CFX_ByteStringC& utf8Name,
v8::String::NewFromUtf8(pIsolate, name, v8::String::kNormalString,
utf8Name.GetLength()),
propvalue);
-
+#endif
return TRUE;
}