Home | History | Annotate | Download | only in xfa
      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/CJX_Define.h"
     13 #include "fxjs/xfa/cjx_object.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 : public CJX_Object {
     28  public:
     29   explicit CJX_LayoutPseudoModel(CScript_LayoutPseudoModel* model);
     30   ~CJX_LayoutPseudoModel() override;
     31 
     32   JS_METHOD(absPage, CJX_LayoutPseudoModel);
     33   JS_METHOD(absPageCount, CJX_LayoutPseudoModel);
     34   JS_METHOD(absPageCountInBatch, CJX_LayoutPseudoModel);
     35   JS_METHOD(absPageInBatch, CJX_LayoutPseudoModel);
     36   JS_METHOD(absPageSpan, CJX_LayoutPseudoModel);
     37   JS_METHOD(h, CJX_LayoutPseudoModel);
     38   JS_METHOD(page, CJX_LayoutPseudoModel);
     39   JS_METHOD(pageContent, CJX_LayoutPseudoModel);
     40   JS_METHOD(pageCount, CJX_LayoutPseudoModel);
     41   JS_METHOD(pageSpan, CJX_LayoutPseudoModel);
     42   JS_METHOD(relayout, CJX_LayoutPseudoModel);
     43   JS_METHOD(relayoutPageArea, CJX_LayoutPseudoModel);
     44   JS_METHOD(sheet, CJX_LayoutPseudoModel);
     45   JS_METHOD(sheetCount, CJX_LayoutPseudoModel);
     46   JS_METHOD(sheetCountInBatch, CJX_LayoutPseudoModel);
     47   JS_METHOD(sheetInBatch, CJX_LayoutPseudoModel);
     48   JS_METHOD(w, CJX_LayoutPseudoModel);
     49   JS_METHOD(x, CJX_LayoutPseudoModel);
     50   JS_METHOD(y, CJX_LayoutPseudoModel);
     51 
     52   JS_PROP(ready);
     53 
     54  private:
     55   CJS_Return NumberedPageCount(CJS_V8* runtime, bool bNumbered);
     56   CJS_Return HWXY(CJS_V8* runtime,
     57                   const std::vector<v8::Local<v8::Value>>& params,
     58                   XFA_LAYOUTMODEL_HWXY layoutModel);
     59   std::vector<CXFA_Node*> GetObjArray(CXFA_LayoutProcessor* pDocLayout,
     60                                       int32_t iPageNo,
     61                                       const WideString& wsType,
     62                                       bool bOnPageArea);
     63   CJS_Return PageInternals(CJS_V8* runtime,
     64                            const std::vector<v8::Local<v8::Value>>& params,
     65                            bool bAbsPage);
     66 
     67   static const CJX_MethodSpec MethodSpecs[];
     68 };
     69 
     70 #endif  // FXJS_XFA_CJX_LAYOUTPSEUDOMODEL_H_
     71