• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #ifndef FXJS_XFA_CJX_LAYOUTPSEUDOMODEL_H_
8 #define FXJS_XFA_CJX_LAYOUTPSEUDOMODEL_H_
9 
10 #include <vector>
11 
12 #include "fxjs/xfa/cjx_object.h"
13 #include "fxjs/xfa/jse_define.h"
14 
15 enum XFA_LAYOUTMODEL_HWXY {
16   XFA_LAYOUTMODEL_H,
17   XFA_LAYOUTMODEL_W,
18   XFA_LAYOUTMODEL_X,
19   XFA_LAYOUTMODEL_Y
20 };
21 
22 class CFXJSE_Value;
23 class CScript_LayoutPseudoModel;
24 class CXFA_LayoutProcessor;
25 class CXFA_Node;
26 
27 class CJX_LayoutPseudoModel final : public CJX_Object {
28  public:
29   explicit CJX_LayoutPseudoModel(CScript_LayoutPseudoModel* model);
30   ~CJX_LayoutPseudoModel() override;
31 
32   // CJX_Object:
33   bool DynamicTypeIs(TypeTag eType) const override;
34 
35   JSE_METHOD(absPage);
36   JSE_METHOD(absPageCount);
37   JSE_METHOD(absPageCountInBatch);
38   JSE_METHOD(absPageInBatch);
39   JSE_METHOD(absPageSpan);
40   JSE_METHOD(h);
41   JSE_METHOD(page);
42   JSE_METHOD(pageContent);
43   JSE_METHOD(pageCount);
44   JSE_METHOD(pageSpan);
45   JSE_METHOD(relayout);
46   JSE_METHOD(relayoutPageArea);
47   JSE_METHOD(sheet);
48   JSE_METHOD(sheetCount);
49   JSE_METHOD(sheetCountInBatch);
50   JSE_METHOD(sheetInBatch);
51   JSE_METHOD(w);
52   JSE_METHOD(x);
53   JSE_METHOD(y);
54 
55   JSE_PROP(ready);
56 
57  private:
58   using Type__ = CJX_LayoutPseudoModel;
59   using ParentType__ = CJX_Object;
60 
61   static const TypeTag static_type__ = TypeTag::LayoutPseudoModel;
62   static const CJX_MethodSpec MethodSpecs[];
63 
64   CJS_Result NumberedPageCount(CFX_V8* runtime, bool bNumbered);
65   CJS_Result HWXY(CFX_V8* runtime,
66                   const std::vector<v8::Local<v8::Value>>& params,
67                   XFA_LAYOUTMODEL_HWXY layoutModel);
68   std::vector<CXFA_Node*> GetObjArray(CXFA_LayoutProcessor* pDocLayout,
69                                       int32_t iPageNo,
70                                       const WideString& wsType,
71                                       bool bOnPageArea);
72   CJS_Result PageInternals(CFX_V8* runtime,
73                            const std::vector<v8::Local<v8::Value>>& params,
74                            bool bAbsPage);
75 };
76 
77 #endif  // FXJS_XFA_CJX_LAYOUTPSEUDOMODEL_H_
78