Revert "FX Bool considered harmful, part 3"
[pdfium.git] / fpdfsdk / include / fsdk_baseform.h
index 6b974c5..edbd5e4 100644 (file)
@@ -35,28 +35,28 @@ typedef struct _PDFSDK_FieldAction
 {
        _PDFSDK_FieldAction()
        {
-               bModifier = false;
-               bShift = false;
+               bModifier = FALSE;
+               bShift = FALSE;
                nCommitKey = 0;
-               bKeyDown = false;
+               bKeyDown = FALSE;
                nSelEnd = nSelStart = 0;
-               bWillCommit = false;
-               bFieldFull = false;
-               bRC = true;
+               bWillCommit = FALSE;
+               bFieldFull = FALSE;
+               bRC = TRUE;
        }
 
-       bool                                    bModifier;              //in
-       bool                                    bShift;                 //in
+       FX_BOOL                                 bModifier;              //in
+       FX_BOOL                                 bShift;                 //in
        int                                             nCommitKey;             //in
        CFX_WideString                  sChange;                //in[out]
        CFX_WideString                  sChangeEx;              //in
-       bool                                    bKeyDown;               //in
+       FX_BOOL                                 bKeyDown;               //in
        int                                             nSelEnd;                //in[out]
        int                                             nSelStart;              //in[out]
        CFX_WideString                  sValue;                 //in[out]
-       bool                                    bWillCommit;    //in
-       bool                                    bFieldFull;             //in
-       bool                                    bRC;                    //in[out]
+       FX_BOOL                                 bWillCommit;    //in
+       FX_BOOL                                 bFieldFull;             //in
+       FX_BOOL                                 bRC;                    //in[out]
 }PDFSDK_FieldAction;
 class CPDFSDK_Widget : public CPDFSDK_Annot
 {
@@ -80,9 +80,9 @@ public:
        int                                                             GetFieldFlags() const;
        int                                                             GetRotate() const;
 
-       bool                                                    GetFillColor(FX_COLORREF& color) const;
-       bool                                                    GetBorderColor(FX_COLORREF& color) const;
-       bool                                                    GetTextColor(FX_COLORREF& color) const;
+       FX_BOOL                                                 GetFillColor(FX_COLORREF& color) const;
+       FX_BOOL                                                 GetBorderColor(FX_COLORREF& color) const;
+       FX_BOOL                                                 GetTextColor(FX_COLORREF& color) const;
        FX_FLOAT                                                GetFontSize() const;
 
        int                                                             GetSelectedIndex(int nIndex) const;
@@ -90,9 +90,9 @@ public:
        CFX_WideString                                  GetDefaultValue() const;
        CFX_WideString                                  GetOptionLabel(int nIndex) const;
        int                                                             CountOptions() const;
-       bool                                                    IsOptionSelected(int nIndex) const;
+       FX_BOOL                                                 IsOptionSelected(int nIndex) const;
        int                                                             GetTopVisibleIndex() const;
-       bool                                                    IsChecked() const;
+       FX_BOOL                                                 IsChecked() const;
        /*
        BF_ALIGN_LEFT
        BF_ALIGN_MIDDL
@@ -103,20 +103,20 @@ public:
        CFX_WideString                                  GetAlternateName() const;
 
 //Set Properties.
-       void                                                    SetCheck(bool bChecked, bool bNotify);
-       void                                                    SetValue(const CFX_WideString& sValue, bool bNotify);
+       void                                                    SetCheck(FX_BOOL bChecked, FX_BOOL bNotify);
+       void                                                    SetValue(const CFX_WideString& sValue, FX_BOOL bNotify);
        void                                                    SetDefaultValue(const CFX_WideString& sValue);
-       void                                                    SetOptionSelection(int index, bool bSelected, bool bNotify);
-       void                                                    ClearSelection(bool bNotify);
+       void                                                    SetOptionSelection(int index, FX_BOOL bSelected, FX_BOOL bNotify);
+       void                                                    ClearSelection(FX_BOOL bNotify);
        void                                                    SetTopVisibleIndex(int index);
 
-       void                                                    ResetAppearance(const FX_WCHAR* sValue, bool bValueChanged);
-       void                                                    ResetFieldAppearance(bool bValueChanged);
+       void                                                    ResetAppearance(const FX_WCHAR* sValue, FX_BOOL bValueChanged);
+       void                                                    ResetFieldAppearance(FX_BOOL bValueChanged);
        void                                                    UpdateField();
-       CFX_WideString                                  OnFormat(bool& bFormated);
+       CFX_WideString                                  OnFormat(FX_BOOL& bFormated);
 
 //Message.
-       bool                                                    OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAction& data,
+       FX_BOOL                                                 OnAAction(CPDF_AAction::AActionType type, PDFSDK_FieldAction& data,
                                                                                                CPDFSDK_PageView* pPageView);
 
        CPDFSDK_InterForm*                              GetInterForm() const {return m_pInterForm;}
@@ -128,7 +128,7 @@ public:
 
        void                                                    SetAppModified();
        void                                                    ClearAppModified();
-       bool                                                    IsAppModified() const;
+       FX_BOOL                                                 IsAppModified() const;
 
        int32_t                                         GetAppearanceAge() const;
        int32_t                                         GetValueAge() const;
@@ -155,14 +155,14 @@ private:
        void                                                    AddImageToAppearance(const CFX_ByteString& sAPType, CPDF_Stream* pImage);
        void                                                    RemoveAppearance(const CFX_ByteString& sAPType);
 public:
-       bool                                                    IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode);
+       FX_BOOL                                                 IsWidgetAppearanceValid(CPDF_Annot::AppearanceMode mode);
        void                                                    DrawAppearance(CFX_RenderDevice* pDevice, const CPDF_Matrix* pUser2Device,
                CPDF_Annot::AppearanceMode mode, const CPDF_RenderOptions* pOptions);
 public:
-       bool                                                    HitTest(FX_FLOAT pageX, FX_FLOAT pageY);
+       FX_BOOL                                                 HitTest(FX_FLOAT pageX, FX_FLOAT pageY);
 private:
        CPDFSDK_InterForm*                              m_pInterForm;
-       bool                                                    m_bAppModified;
+       FX_BOOL                                                 m_bAppModified;
        int32_t                                         m_nAppAge;
        int32_t                                         m_nValueAge;
 };
@@ -176,9 +176,9 @@ public:
        CPDF_InterForm* GetInterForm() const { return m_pInterForm; }
        CPDFSDK_Document* GetDocument() const { return m_pDocument; }
 
-       bool                                                    HighlightWidgets();
+       FX_BOOL                                                 HighlightWidgets();
 
-       CPDFSDK_Widget*                                 GetSibling(CPDFSDK_Widget* pWidget, bool bNext) const;
+       CPDFSDK_Widget*                                 GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const;
        CPDFSDK_Widget*                                 GetWidget(CPDF_FormControl* pControl) const;
        void                                                    GetWidgets(const CFX_WideString& sFieldName, CFX_PtrArray& widgets);
        void                                                    GetWidgets(CPDF_FormField* pField, CFX_PtrArray& widgets);
@@ -186,33 +186,33 @@ public:
        void                                                    AddMap(CPDF_FormControl* pControl, CPDFSDK_Widget* pWidget);
        void                                                    RemoveMap(CPDF_FormControl* pControl);
 
-       void                                                    EnableCalculate(bool bEnabled);
-       bool                                                    IsCalculateEnabled() const;
+       void                                                    EnableCalculate(FX_BOOL bEnabled);
+       FX_BOOL                                                 IsCalculateEnabled() const;
 
 #ifdef _WIN32
        CPDF_Stream*                                    LoadImageFromFile(const CFX_WideString& sFile);
 #endif
 
-       void                                                    OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideString& csValue, bool& bRC);
-       void                                                    OnValidate(CPDF_FormField* pFormField, CFX_WideString& csValue, bool& bRC);
+       void                                                    OnKeyStrokeCommit(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);
+       void                                                    OnValidate(CPDF_FormField* pFormField, CFX_WideString& csValue, FX_BOOL& bRC);
        void                                                    OnCalculate(CPDF_FormField* pFormField = NULL);
-       CFX_WideString                                  OnFormat(CPDF_FormField* pFormField, bool& bFormated);
+       CFX_WideString                                  OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormated);
 
-       void                                                    ResetFieldAppearance(CPDF_FormField* pFormField, const FX_WCHAR* sValue, bool bValueChanged);
+       void                                                    ResetFieldAppearance(CPDF_FormField* pFormField, const FX_WCHAR* sValue, FX_BOOL bValueChanged);
        void                                                    UpdateField(CPDF_FormField* pFormField);
 
-       bool                                                    DoAction_Hide(const CPDF_Action& action);
-       bool                                                    DoAction_SubmitForm(const CPDF_Action& action);
-       bool                                                    DoAction_ResetForm(const CPDF_Action& action);
-       bool                                                    DoAction_ImportData(const CPDF_Action& action);
+       FX_BOOL                                                 DoAction_Hide(const CPDF_Action& action);
+       FX_BOOL                                                 DoAction_SubmitForm(const CPDF_Action& action);
+       FX_BOOL                                                 DoAction_ResetForm(const CPDF_Action& action);
+       FX_BOOL                                                 DoAction_ImportData(const CPDF_Action& action);
 
        void                                                    GetFieldFromObjects(const CFX_PtrArray& objects, CFX_PtrArray& fields);
-       bool                                                    IsValidField(CPDF_Dictionary* pFieldDict);
-       bool                                                    SubmitFields(const CFX_WideString& csDestination, const CFX_PtrArray& fields,
-               bool bIncludeOrExclude, bool bUrlEncoded);
-       bool                                                    SubmitForm(const CFX_WideString& sDestination, bool bUrlEncoded);
-       bool                                                    ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf);
-       bool                                                    ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,bool bIncludeOrExclude, CFX_ByteTextBuf& textBuf);
+       FX_BOOL                                                 IsValidField(CPDF_Dictionary* pFieldDict);
+       FX_BOOL                                                 SubmitFields(const CFX_WideString& csDestination, const CFX_PtrArray& fields,
+               FX_BOOL bIncludeOrExclude, FX_BOOL bUrlEncoded);
+       FX_BOOL                                                 SubmitForm(const CFX_WideString& sDestination, FX_BOOL bUrlEncoded);
+       FX_BOOL                                                 ExportFormToFDFTextBuf(CFX_ByteTextBuf& textBuf);
+       FX_BOOL                                                 ExportFieldsToFDFTextBuf(const CFX_PtrArray& fields,FX_BOOL bIncludeOrExclude, CFX_ByteTextBuf& textBuf);
        CFX_WideString                                  GetTemporaryFileName(const CFX_WideString& sFileExt);
 
 private:
@@ -226,8 +226,8 @@ private:
        virtual int                                             BeforeFormImportData(const CPDF_InterForm* pForm);
        virtual int                                             AfterFormImportData(const CPDF_InterForm* pForm);
 
-       bool                                                    FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_WideString csTxtFile);
-       bool                                                    FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize);
+       FX_BOOL                                                 FDFToURLEncodedData(CFX_WideString csFDFFile, CFX_WideString csTxtFile);
+       FX_BOOL                                                 FDFToURLEncodedData(uint8_t*& pBuf, FX_STRSIZE& nBufSize);
        int                                                             GetPageIndexByAnnotDict(CPDF_Document* pDocument, CPDF_Dictionary* pAnnotDict) const;
        void                                                    DoFDFBuffer(CFX_ByteString sBuffer);
 
@@ -236,11 +236,11 @@ private:
     CPDFSDK_Document* m_pDocument;
     CPDF_InterForm* m_pInterForm;
     CPDFSDK_WidgetMap m_Map;
-    bool m_bCalculate;
-    bool m_bBusy;
+    FX_BOOL m_bCalculate;
+    FX_BOOL m_bBusy;
 
 public:
-       bool IsNeedHighLight(int nFieldType);
+       FX_BOOL IsNeedHighLight(int nFieldType);
        void    RemoveAllHighLight();
        void    SetHighlightAlpha(uint8_t alpha) {m_iHighlightAlpha = alpha;}
        uint8_t GetHighlightAlpha() {return m_iHighlightAlpha;}
@@ -249,7 +249,7 @@ public:
 private:
        FX_COLORREF m_aHighlightColor[6];
        uint8_t m_iHighlightAlpha;
-       bool    m_bNeedHightlight[6];
+       FX_BOOL m_bNeedHightlight[6];
 };
 
 #define BAI_STRUCTURE          0