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