xref: /aosp_15_r20/external/pdfium/fxjs/xfa/cjx_layoutpseudomodel.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 The PDFium Authors
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 class CScript_LayoutPseudoModel;
16 class CXFA_LayoutProcessor;
17 class CXFA_Node;
18 
19 class CJX_LayoutPseudoModel final : public CJX_Object {
20  public:
21   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
22   ~CJX_LayoutPseudoModel() override;
23 
24   // CJX_Object:
25   bool DynamicTypeIs(TypeTag eType) const override;
26 
27   JSE_METHOD(absPage);
28   JSE_METHOD(absPageCount);
29   JSE_METHOD(absPageCountInBatch);
30   JSE_METHOD(absPageInBatch);
31   JSE_METHOD(absPageSpan);
32   JSE_METHOD(h);
33   JSE_METHOD(page);
34   JSE_METHOD(pageContent);
35   JSE_METHOD(pageCount);
36   JSE_METHOD(pageSpan);
37   JSE_METHOD(relayout);
38   JSE_METHOD(relayoutPageArea);
39   JSE_METHOD(sheet);
40   JSE_METHOD(sheetCount);
41   JSE_METHOD(sheetCountInBatch);
42   JSE_METHOD(sheetInBatch);
43   JSE_METHOD(w);
44   JSE_METHOD(x);
45   JSE_METHOD(y);
46 
47   JSE_PROP(ready);
48 
49  private:
50   enum class HWXY { kH, kW, kX, kY };
51 
52   explicit CJX_LayoutPseudoModel(CScript_LayoutPseudoModel* model);
53 
54   using Type__ = CJX_LayoutPseudoModel;
55   using ParentType__ = CJX_Object;
56 
57   static const TypeTag static_type__ = TypeTag::LayoutPseudoModel;
58   static const CJX_MethodSpec MethodSpecs[];
59 
60   CJS_Result AllPageCount(CFXJSE_Engine* runtime);
61   CJS_Result NumberedPageCount(CFXJSE_Engine* runtime);
62   CJS_Result DoHWXYInternal(CFXJSE_Engine* runtime,
63                             const std::vector<v8::Local<v8::Value>>& params,
64                             HWXY layoutModel);
65   std::vector<CXFA_Node*> GetObjArray(CXFA_LayoutProcessor* pDocLayout,
66                                       int32_t iPageNo,
67                                       const WideString& wsType,
68                                       bool bOnPageArea);
69   CJS_Result PageInternals(CFXJSE_Engine* runtime,
70                            const std::vector<v8::Local<v8::Value>>& params,
71                            bool bAbsPage);
72 };
73 
74 #endif  // FXJS_XFA_CJX_LAYOUTPSEUDOMODEL_H_
75