summaryrefslogtreecommitdiff
path: root/fxjs/cjx_layoutpseudomodel.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-12-07 22:33:43 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-12-07 22:33:43 +0000
commit93bb725b62f9779534c9444c1e1319fe8c28912e (patch)
treeaf0c758c1129dc076cbf67a89f1c23e4703e02bd /fxjs/cjx_layoutpseudomodel.cpp
parentce6979f8d064507300fe0b3a856687fb958c9a5c (diff)
downloadpdfium-93bb725b62f9779534c9444c1e1319fe8c28912e.tar.xz
[xfa] Move JS method information to files.chromium/3288
This CL moves the XFA SOM JS Method information out of the c-array and into individual CJX class files. Change-Id: I401046a06aacaf1f04e5a51eb899e479de012e15 Reviewed-on: https://pdfium-review.googlesource.com/20450 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cjx_layoutpseudomodel.cpp')
-rw-r--r--fxjs/cjx_layoutpseudomodel.cpp66
1 files changed, 45 insertions, 21 deletions
diff --git a/fxjs/cjx_layoutpseudomodel.cpp b/fxjs/cjx_layoutpseudomodel.cpp
index 9767c15d3a..cc7c154841 100644
--- a/fxjs/cjx_layoutpseudomodel.cpp
+++ b/fxjs/cjx_layoutpseudomodel.cpp
@@ -24,8 +24,32 @@
#include "xfa/fxfa/parser/cxfa_nodeiteratortemplate.h"
#include "xfa/fxfa/parser/cxfa_traversestrategy_contentlayoutitem.h"
+const CJX_MethodSpec CJX_LayoutPseudoModel::MethodSpecs[] = {
+ {"absPage", absPage_static},
+ {"absPageCount", absPageCount_static},
+ {"absPageCountInBatch", absPageCountInBatch_static},
+ {"absPageInBatch", absPageInBatch_static},
+ {"absPageSpan", absPageSpan_static},
+ {"h", h_static},
+ {"page", page_static},
+ {"pageContent", pageContent_static},
+ {"pageCount", pageCount_static},
+ {"pageSpan", pageSpan_static},
+ {"relayout", relayout_static},
+ {"relayoutPageArea", relayoutPageArea_static},
+ {"sheet", sheet_static},
+ {"sheetCount", sheetCount_static},
+ {"sheetCountInBatch", sheetCountInBatch_static},
+ {"sheetInBatch", sheetInBatch_static},
+ {"w", w_static},
+ {"x", x_static},
+ {"y", y_static},
+ {"", nullptr}};
+
CJX_LayoutPseudoModel::CJX_LayoutPseudoModel(CScript_LayoutPseudoModel* model)
- : CJX_Object(model) {}
+ : CJX_Object(model) {
+ DefineMethods(MethodSpecs);
+}
CJX_LayoutPseudoModel::~CJX_LayoutPseudoModel() {}
@@ -122,19 +146,19 @@ void CJX_LayoutPseudoModel::HWXY(CFXJSE_Arguments* pArguments,
pValue->SetFloat(fValue);
}
-void CJX_LayoutPseudoModel::H(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::h(CFXJSE_Arguments* pArguments) {
HWXY(pArguments, XFA_LAYOUTMODEL_H);
}
-void CJX_LayoutPseudoModel::W(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::w(CFXJSE_Arguments* pArguments) {
HWXY(pArguments, XFA_LAYOUTMODEL_W);
}
-void CJX_LayoutPseudoModel::X(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::x(CFXJSE_Arguments* pArguments) {
HWXY(pArguments, XFA_LAYOUTMODEL_X);
}
-void CJX_LayoutPseudoModel::Y(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::y(CFXJSE_Arguments* pArguments) {
HWXY(pArguments, XFA_LAYOUTMODEL_Y);
}
@@ -163,11 +187,11 @@ void CJX_LayoutPseudoModel::NumberedPageCount(CFXJSE_Arguments* pArguments,
pArguments->GetReturnValue()->SetInteger(iPageCount);
}
-void CJX_LayoutPseudoModel::PageCount(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::pageCount(CFXJSE_Arguments* pArguments) {
NumberedPageCount(pArguments, true);
}
-void CJX_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::pageSpan(CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength != 1) {
ThrowParamCountMismatchException(L"pageSpan");
@@ -197,7 +221,7 @@ void CJX_LayoutPseudoModel::PageSpan(CFXJSE_Arguments* pArguments) {
pValue->SetInteger(iPageSpan);
}
-void CJX_LayoutPseudoModel::Page(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::page(CFXJSE_Arguments* pArguments) {
PageInternals(pArguments, false);
}
@@ -335,7 +359,7 @@ std::vector<CXFA_Node*> CJX_LayoutPseudoModel::GetObjArray(
return retArray;
}
-void CJX_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::pageContent(CFXJSE_Arguments* pArguments) {
int32_t iLength = pArguments->GetLength();
if (iLength < 1 || iLength > 3) {
ThrowParamCountMismatchException(L"pageContent");
@@ -371,19 +395,19 @@ void CJX_LayoutPseudoModel::PageContent(CFXJSE_Arguments* pArguments) {
GetDocument()->GetScriptContext()->GetJseNormalClass());
}
-void CJX_LayoutPseudoModel::AbsPageCount(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::absPageCount(CFXJSE_Arguments* pArguments) {
NumberedPageCount(pArguments, false);
}
-void CJX_LayoutPseudoModel::AbsPageCountInBatch(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::absPageCountInBatch(CFXJSE_Arguments* pArguments) {
pArguments->GetReturnValue()->SetInteger(0);
}
-void CJX_LayoutPseudoModel::SheetCountInBatch(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::sheetCountInBatch(CFXJSE_Arguments* pArguments) {
pArguments->GetReturnValue()->SetInteger(0);
}
-void CJX_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::relayout(CFXJSE_Arguments* pArguments) {
CXFA_Node* pRootNode = GetDocument()->GetRoot();
CXFA_Node* pFormRoot = pRootNode->GetFirstChildByClass(XFA_Element::Form);
CXFA_Node* pContentRootNode = pFormRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
@@ -394,11 +418,11 @@ void CJX_LayoutPseudoModel::Relayout(CFXJSE_Arguments* pArguments) {
pLayoutProcessor->SetForceReLayout(true);
}
-void CJX_LayoutPseudoModel::AbsPageSpan(CFXJSE_Arguments* pArguments) {
- PageSpan(pArguments);
+void CJX_LayoutPseudoModel::absPageSpan(CFXJSE_Arguments* pArguments) {
+ pageSpan(pArguments);
}
-void CJX_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::absPageInBatch(CFXJSE_Arguments* pArguments) {
if (pArguments->GetLength() != 1) {
ThrowParamCountMismatchException(L"absPageInBatch");
return;
@@ -407,7 +431,7 @@ void CJX_LayoutPseudoModel::AbsPageInBatch(CFXJSE_Arguments* pArguments) {
pArguments->GetReturnValue()->SetInteger(0);
}
-void CJX_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::sheetInBatch(CFXJSE_Arguments* pArguments) {
if (pArguments->GetLength() != 1) {
ThrowParamCountMismatchException(L"sheetInBatch");
return;
@@ -416,17 +440,17 @@ void CJX_LayoutPseudoModel::SheetInBatch(CFXJSE_Arguments* pArguments) {
pArguments->GetReturnValue()->SetInteger(0);
}
-void CJX_LayoutPseudoModel::Sheet(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::sheet(CFXJSE_Arguments* pArguments) {
PageInternals(pArguments, true);
}
-void CJX_LayoutPseudoModel::RelayoutPageArea(CFXJSE_Arguments* pArguments) {}
+void CJX_LayoutPseudoModel::relayoutPageArea(CFXJSE_Arguments* pArguments) {}
-void CJX_LayoutPseudoModel::SheetCount(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::sheetCount(CFXJSE_Arguments* pArguments) {
NumberedPageCount(pArguments, false);
}
-void CJX_LayoutPseudoModel::AbsPage(CFXJSE_Arguments* pArguments) {
+void CJX_LayoutPseudoModel::absPage(CFXJSE_Arguments* pArguments) {
PageInternals(pArguments, true);
}