Revert "FX Bool considered harmful, part 3"
[pdfium.git] / fpdfsdk / include / fsdk_baseform.h
index ac0f72a..edbd5e4 100644 (file)
@@ -13,6 +13,8 @@
 #include <ctime>
 #endif
 
+#include <map>
+
 #include "../../core/include/fpdfapi/fpdf_parser.h"
 #include "../../core/include/fpdfdoc/fpdf_doc.h"
 #include "../../core/include/fxcrt/fx_basic.h"
@@ -56,7 +58,7 @@ typedef struct _PDFSDK_FieldAction
        FX_BOOL                                 bFieldFull;             //in
        FX_BOOL                                 bRC;                    //in[out]
 }PDFSDK_FieldAction;
-class CPDFSDK_Widget:public CPDFSDK_Annot
+class CPDFSDK_Widget : public CPDFSDK_Annot
 {
 public:
        CPDFSDK_Widget(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPageView, CPDFSDK_InterForm* pInterForm);
@@ -165,19 +167,15 @@ private:
        int32_t                                         m_nValueAge;
 };
 
-#define CPDFSDK_WidgetMap                              CFX_MapPtrTemplate<CPDF_FormControl*, CPDFSDK_Widget*>
-
 class CPDFSDK_InterForm : public CPDF_FormNotify
 {
 public:
-       CPDFSDK_InterForm(CPDFSDK_Document* pDocument);
-       virtual ~CPDFSDK_InterForm();
+       explicit CPDFSDK_InterForm(CPDFSDK_Document* pDocument);
+       ~CPDFSDK_InterForm() override;
 
-public:
-       virtual void                                    Destroy();
-       virtual CPDF_InterForm*                 GetInterForm();
+       CPDF_InterForm* GetInterForm() const { return m_pInterForm; }
+       CPDFSDK_Document* GetDocument() const { return m_pDocument; }
 
-       CPDFSDK_Document*                               GetDocument();
        FX_BOOL                                                 HighlightWidgets();
 
        CPDFSDK_Widget*                                 GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const;
@@ -203,7 +201,6 @@ public:
        void                                                    ResetFieldAppearance(CPDF_FormField* pFormField, const FX_WCHAR* sValue, FX_BOOL bValueChanged);
        void                                                    UpdateField(CPDF_FormField* pFormField);
 
-public:
        FX_BOOL                                                 DoAction_Hide(const CPDF_Action& action);
        FX_BOOL                                                 DoAction_SubmitForm(const CPDF_Action& action);
        FX_BOOL                                                 DoAction_ResetForm(const CPDF_Action& action);
@@ -229,18 +226,18 @@ private:
        virtual int                                             BeforeFormImportData(const CPDF_InterForm* pForm);
        virtual int                                             AfterFormImportData(const CPDF_InterForm* pForm);
 
-private:
        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);
 
-private:
-       CPDFSDK_Document*                               m_pDocument;
-       CPDF_InterForm*                                 m_pInterForm;
-       CPDFSDK_WidgetMap                               m_Map;
-       FX_BOOL                                                 m_bCalculate;
-       FX_BOOL                                                 m_bBusy;
+    using CPDFSDK_WidgetMap = std::map<CPDF_FormControl*, CPDFSDK_Widget*>;
+
+    CPDFSDK_Document* m_pDocument;
+    CPDF_InterForm* m_pInterForm;
+    CPDFSDK_WidgetMap m_Map;
+    FX_BOOL m_bCalculate;
+    FX_BOOL m_bBusy;
 
 public:
        FX_BOOL IsNeedHighLight(int nFieldType);