Home | History | Annotate | Download | only in fxfa
      1 // Copyright 2014 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 _FXFA_WIDGET_H
      8 #define _FXFA_WIDGET_H
      9 class CXFA_Node;
     10 class CXFA_FFDocView;
     11 class CXFA_FFDoc;
     12 class CXFA_FFApp;
     13 class CXFA_Node;
     14 class CXFA_EventParam;
     15 class CXFA_FFWidget;
     16 class CXFA_TextLayout;
     17 class CXFA_TextProvider;
     18 class CXFA_WidgetLayoutData;
     19 class IFX_Font;
     20 class CXFA_WidgetAcc;
     21 #include "fxfa_objectacc.h"
     22 class CXFA_WidgetAcc : public CXFA_WidgetData {
     23  public:
     24   CXFA_WidgetAcc(CXFA_FFDocView* pDocView, CXFA_Node* pNode);
     25   ~CXFA_WidgetAcc();
     26 
     27   FX_BOOL GetName(CFX_WideString& wsName, int32_t iNameType = 0);
     28   FX_BOOL ProcessValueChanged();
     29 
     30  public:
     31   void ResetData();
     32 
     33   void SetImageEdit(const CFX_WideStringC& wsContentType,
     34                     const CFX_WideStringC& wsHref,
     35                     const CFX_WideStringC& wsData);
     36 
     37   CXFA_WidgetAcc* GetExclGroup();
     38   CXFA_FFDocView* GetDocView();
     39   CXFA_FFDoc* GetDoc();
     40   CXFA_FFApp* GetApp();
     41   IXFA_AppProvider* GetAppProvider();
     42 
     43   int32_t ProcessEvent(int32_t iActivity, CXFA_EventParam* pEventParam);
     44   int32_t ProcessEvent(CXFA_Event& event, CXFA_EventParam* pEventParam);
     45   int32_t ProcessCalculate();
     46   int32_t ProcessValidate(int32_t iFlags = 0);
     47   int32_t ExecuteScript(CXFA_Script script,
     48                         CXFA_EventParam* pEventParam,
     49                         FXJSE_HVALUE* pRetValue = NULL);
     50 
     51   CXFA_FFWidget* GetNextWidget(CXFA_FFWidget* pWidget);
     52   void StartWidgetLayout(FX_FLOAT& fCalcWidth, FX_FLOAT& fCalcHeight);
     53   FX_BOOL FindSplitPos(int32_t iBlockIndex, FX_FLOAT& fCalcHeight);
     54   FX_BOOL LoadCaption();
     55   void LoadText();
     56   FX_BOOL LoadImageImage();
     57   FX_BOOL LoadImageEditImage();
     58   void GetImageDpi(int32_t& iImageXDpi, int32_t& iImageYDpi);
     59   void GetImageEditDpi(int32_t& iImageXDpi, int32_t& iImageYDpi);
     60   CXFA_TextLayout* GetCaptionTextLayout();
     61   CXFA_TextLayout* GetTextLayout();
     62   CFX_DIBitmap* GetImageImage();
     63   CFX_DIBitmap* GetImageEditImage();
     64   void SetImageImage(CFX_DIBitmap* newImage);
     65   void SetImageEditImage(CFX_DIBitmap* newImage);
     66   void UpdateUIDisplay(CXFA_FFWidget* pExcept = NULL);
     67   void NotifyEvent(FX_DWORD dwEvent,
     68                    CXFA_FFWidget* pWidget = NULL,
     69                    void* pParam = NULL,
     70                    void* pAdditional = NULL);
     71 
     72   CXFA_Node* GetDatasets();
     73   IFX_Font* GetFDEFont();
     74   FX_FLOAT GetFontSize();
     75   FX_ARGB GetTextColor();
     76   FX_FLOAT GetLineHeight();
     77   CXFA_WidgetLayoutData* GetWidgetLayoutData();
     78 
     79  protected:
     80   void ProcessScriptTestValidate(CXFA_Validate validate,
     81                                  int32_t iRet,
     82                                  FXJSE_HVALUE pRetValue,
     83                                  FX_BOOL bVersionFlag);
     84   int32_t ProcessFormatTestValidate(CXFA_Validate validate,
     85                                     FX_BOOL bVersionFlag);
     86   int32_t ProcessNullTestValidate(CXFA_Validate validate,
     87                                   int32_t iFlags,
     88                                   FX_BOOL bVersionFlag);
     89   void GetValidateCaptionName(CFX_WideString& wsCaptionName,
     90                               FX_BOOL bVersionFlag);
     91   void GetValidateMessage(IXFA_AppProvider* pAppProvider,
     92                           CFX_WideString& wsMessage,
     93                           FX_BOOL bError,
     94                           FX_BOOL bVersionFlag);
     95   void CalcCaptionSize(CFX_SizeF& szCap);
     96   FX_BOOL CalculateFieldAutoSize(CFX_SizeF& size);
     97   FX_BOOL CalculateWidgetAutoSize(CFX_SizeF& size);
     98   FX_BOOL CalculateTextEditAutoSize(CFX_SizeF& size);
     99   FX_BOOL CalculateCheckButtonAutoSize(CFX_SizeF& size);
    100   FX_BOOL CalculatePushButtonAutoSize(CFX_SizeF& size);
    101   FX_BOOL CalculateImageEditAutoSize(CFX_SizeF& size);
    102   FX_BOOL CalculateImageAutoSize(CFX_SizeF& size);
    103   FX_BOOL CalculateTextAutoSize(CFX_SizeF& size);
    104   FX_FLOAT CalculateWidgetAutoHeight(FX_FLOAT fHeightCalc);
    105   FX_FLOAT CalculateWidgetAutoWidth(FX_FLOAT fWidthCalc);
    106   FX_FLOAT GetWidthWithoutMargin(FX_FLOAT fWidthCalc);
    107   FX_FLOAT GetHeightWithoutMargin(FX_FLOAT fHeightCalc);
    108   void CalculateTextContentSize(CFX_SizeF& size);
    109   void CalculateAccWidthAndHeight(XFA_ELEMENT eUIType,
    110                                   FX_FLOAT& fWidth,
    111                                   FX_FLOAT& fCalcHeight);
    112   void InitLayoutData();
    113   void StartTextLayout(FX_FLOAT& fCalcWidth, FX_FLOAT& fCalcHeight);
    114   CXFA_FFDocView* m_pDocView;
    115   CXFA_WidgetLayoutData* m_pLayoutData;
    116   uint32_t m_nRecursionDepth;
    117 };
    118 #endif
    119