summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-09-14 06:11:08 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-14 06:11:08 -0700
commit89f8fa8694bbf209412845c250af48bbc539962b (patch)
treefa365a5f1a9c43e4d9d8851c36f04f14554ca07f /xfa/fxfa/parser
parent2ca2da505ba75cd830539ffc98dfc482fd4daa41 (diff)
downloadpdfium-89f8fa8694bbf209412845c250af48bbc539962b.tar.xz
Remove unused code in CPDFXFA_Document
Remove methods that always just return without doing any work. Clean up the IXFA_DocProvider interface calls for those methods and cleanup the callers that were calling the methods. Review-Url: https://codereview.chromium.org/2323523002
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cscript_hostpseudomodel.cpp14
-rw-r--r--xfa/fxfa/parser/cscript_layoutpseudomodel.cpp95
-rw-r--r--xfa/fxfa/parser/cscript_signaturepseudomodel.cpp68
3 files changed, 42 insertions, 135 deletions
diff --git a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
index 4448180436..cee99e8a3b 100644
--- a/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_hostpseudomodel.cpp
@@ -628,24 +628,16 @@ void CScript_HostPseudoModel::Print(CFXJSE_Arguments* pArguments) {
}
pNotify->GetDocProvider()->Print(hDoc, nStartPage, nEndPage, dwOptions);
}
+
void CScript_HostPseudoModel::ImportData(CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength < 0 || iLength > 1) {
ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"importData");
return;
}
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
- return;
- }
- CFX_WideString wsFilePath;
- if (iLength > 0) {
- CFX_ByteString bsFilePath = pArguments->GetUTF8String(0);
- wsFilePath = CFX_WideString::FromUTF8(bsFilePath.AsStringC());
- }
- CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- pNotify->GetDocProvider()->ImportData(hDoc, wsFilePath);
+ // Not implemented.
}
+
void CScript_HostPseudoModel::ExportData(CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength < 0 || iLength > 2) {
diff --git a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
index b8330ed909..7c451a96c0 100644
--- a/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_layoutpseudomodel.cpp
@@ -45,6 +45,7 @@ void CScript_LayoutPseudoModel::Ready(CFXJSE_Value* pValue,
int32_t iStatus = pNotify->GetLayoutStatus();
pValue->SetBoolean(iStatus >= 2);
}
+
void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments,
XFA_LAYOUTMODEL_HWXY layoutModel) {
int32_t iLength = pArguments->GetLength();
@@ -125,18 +126,23 @@ void CScript_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments,
if (pValue)
pValue->SetFloat(fValue);
}
+
void CScript_LayoutPseudoModel::H(CFXJSE_Arguments* pArguments) {
HWXY(pArguments, XFA_LAYOUTMODEL_H);
}
+
void CScript_LayoutPseudoModel::W(CFXJSE_Arguments* pArguments) {
HWXY(pArguments, XFA_LAYOUTMODEL_W);
}
+
void CScript_LayoutPseudoModel::X(CFXJSE_Arguments* pArguments) {
HWXY(pArguments, XFA_LAYOUTMODEL_X);
}
+
void CScript_LayoutPseudoModel::Y(CFXJSE_Arguments* pArguments) {
HWXY(pArguments, XFA_LAYOUTMODEL_Y);
}
+
void CScript_LayoutPseudoModel::NumberedPageCount(CFXJSE_Arguments* pArguments,
FX_BOOL bNumbered) {
CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout();
@@ -163,9 +169,11 @@ void CScript_LayoutPseudoModel::NumberedPageCount(CFXJSE_Arguments* pArguments,
if (pValue)
pValue->SetInteger(iPageCount);
}
+
void CScript_LayoutPseudoModel::PageCount(CFXJSE_Arguments* pArguments) {
NumberedPageCount(pArguments, TRUE);
}
+
void CScript_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength != 1) {
@@ -195,9 +203,11 @@ void CScript_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) {
if (pValue)
pValue->SetInteger(iPageSpan);
}
+
void CScript_LayoutPseudoModel::Page(CFXJSE_Arguments* pArguments) {
PageImp(pArguments, FALSE);
}
+
void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout,
int32_t iPageNo,
const CFX_WideString& wsType,
@@ -329,6 +339,7 @@ void CScript_LayoutPseudoModel::GetObjArray(CXFA_LayoutProcessor* pDocLayout,
return;
}
}
+
void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength < 1 || iLength > 3) {
@@ -363,33 +374,25 @@ void CScript_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) {
pArguments->GetReturnValue()->SetObject(
pArrayNodeList, m_pDocument->GetScriptContext()->GetJseNormalClass());
}
+
void CScript_LayoutPseudoModel::AbsPageCount(CFXJSE_Arguments* pArguments) {
NumberedPageCount(pArguments, FALSE);
}
+
void CScript_LayoutPseudoModel::AbsPageCountInBatch(
CFXJSE_Arguments* pArguments) {
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
- return;
- }
- CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- int32_t iPageCount = pNotify->GetDocProvider()->AbsPageCountInBatch(hDoc);
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetInteger(iPageCount);
+ pValue->SetInteger(0);
}
+
void CScript_LayoutPseudoModel::SheetCountInBatch(
CFXJSE_Arguments* pArguments) {
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
- return;
- }
- CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- int32_t iPageCount = pNotify->GetDocProvider()->SheetCountInBatch(hDoc);
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetInteger(iPageCount);
+ pValue->SetInteger(0);
}
+
void CScript_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) {
CXFA_Node* pRootNode = m_pDocument->GetRoot();
CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_Element::Form);
@@ -401,84 +404,48 @@ void CScript_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) {
}
pLayoutProcessor->SetForceReLayout(TRUE);
}
+
void CScript_LayoutPseudoModel::AbsPageSpan(CFXJSE_Arguments* pArguments) {
PageSpan(pArguments);
}
+
void CScript_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) {
- int32_t iLength = pArguments->GetLength();
- if (iLength != 1) {
+ if (pArguments->GetLength() != 1) {
ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"absPageInBatch");
return;
}
- CXFA_Node* pNode = nullptr;
- if (iLength >= 1) {
- pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
- }
- if (!pNode) {
- return;
- }
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
- return;
- }
- CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout();
- if (!pDocLayout) {
- return;
- }
- CXFA_FFWidget* hWidget =
- pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode));
- if (!hWidget) {
- return;
- }
- CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- int32_t iPageCount = pNotify->GetDocProvider()->AbsPageInBatch(hDoc, hWidget);
+
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetInteger(iPageCount);
+ pValue->SetInteger(0);
}
+
void CScript_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) {
- int32_t iLength = pArguments->GetLength();
- if (iLength != 1) {
+ if (pArguments->GetLength() != 1) {
ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sheetInBatch");
return;
}
- CXFA_Node* pNode = nullptr;
- if (iLength >= 1) {
- pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
- }
- if (!pNode) {
- return;
- }
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
- return;
- }
- CXFA_LayoutProcessor* pDocLayout = m_pDocument->GetDocLayout();
- if (!pDocLayout) {
- return;
- }
- CXFA_FFWidget* hWidget =
- pNotify->GetHWidget(pDocLayout->GetLayoutItem(pNode));
- if (!hWidget) {
- return;
- }
- CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- int32_t iPageCount = pNotify->GetDocProvider()->SheetInBatch(hDoc, hWidget);
+
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetInteger(iPageCount);
+ pValue->SetInteger(0);
}
+
void CScript_LayoutPseudoModel::Sheet(CFXJSE_Arguments* pArguments) {
PageImp(pArguments, TRUE);
}
+
void CScript_LayoutPseudoModel::RelayoutPageArea(CFXJSE_Arguments* pArguments) {
}
+
void CScript_LayoutPseudoModel::SheetCount(CFXJSE_Arguments* pArguments) {
NumberedPageCount(pArguments, FALSE);
}
+
void CScript_LayoutPseudoModel::AbsPage(CFXJSE_Arguments* pArguments) {
PageImp(pArguments, TRUE);
}
+
void CScript_LayoutPseudoModel::PageImp(CFXJSE_Arguments* pArguments,
FX_BOOL bAbsPage) {
int32_t iLength = pArguments->GetLength();
diff --git a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
index 071ae39900..83e84b6d79 100644
--- a/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
+++ b/xfa/fxfa/parser/cscript_signaturepseudomodel.cpp
@@ -29,19 +29,10 @@ void CScript_SignaturePseudoModel::Verify(CFXJSE_Arguments* pArguments) {
ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify");
return;
}
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
- return;
- }
- CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- CXFA_Node* pNode = nullptr;
- if (iLength >= 1) {
- pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
- }
- int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode);
+
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetInteger(bVerify);
+ pValue->SetInteger(0);
}
void CScript_SignaturePseudoModel::Sign(CFXJSE_Arguments* pArguments) {
@@ -50,48 +41,18 @@ void CScript_SignaturePseudoModel::Sign(CFXJSE_Arguments* pArguments) {
ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign");
return;
}
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
- return;
- }
- CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- CXFA_NodeList* pNodeList = nullptr;
- CFX_WideString wsExpression;
- CFX_WideString wsXMLIdent;
- if (iLength >= 1) {
- pNodeList = (CXFA_NodeList*)pArguments->GetObject(0);
- }
- if (iLength >= 2) {
- CFX_ByteString bsExpression = pArguments->GetUTF8String(1);
- wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC());
- }
- if (iLength >= 3) {
- CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2);
- wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent.AsStringC());
- }
- FX_BOOL bSign = pNotify->GetDocProvider()->Sign(
- hDoc, pNodeList, wsExpression.AsStringC(), wsXMLIdent.AsStringC());
+
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetBoolean(bSign);
+ pValue->SetBoolean(FALSE);
}
void CScript_SignaturePseudoModel::Enumerate(CFXJSE_Arguments* pArguments) {
- int32_t iLength = pArguments->GetLength();
- if (iLength != 0) {
+ if (pArguments->GetLength() != 0) {
ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate");
return;
}
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
- return;
- }
- CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc);
- if (!pList)
- return;
- pArguments->GetReturnValue()->Assign(
- m_pDocument->GetScriptContext()->GetJSValueFromMap(pList));
+ return;
}
void CScript_SignaturePseudoModel::Clear(CFXJSE_Arguments* pArguments) {
@@ -100,21 +61,8 @@ void CScript_SignaturePseudoModel::Clear(CFXJSE_Arguments* pArguments) {
ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear");
return;
}
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (!pNotify) {
- return;
- }
- CXFA_FFDoc* hDoc = pNotify->GetHDOC();
- CXFA_Node* pNode = nullptr;
- FX_BOOL bClear = TRUE;
- if (iLength >= 1) {
- pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0));
- }
- if (iLength >= 2) {
- bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE;
- }
- FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear);
+
CFXJSE_Value* pValue = pArguments->GetReturnValue();
if (pValue)
- pValue->SetBoolean(bFlag);
+ pValue->SetBoolean(FALSE);
}