From cece6534e4e4ac10fdcfb47ac1d690e91bf63c19 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 25 May 2016 16:36:53 -0700 Subject: Remove CFX_PrivateData inheritance from CPDF_InterForm It wasn't being used. Also rename a static member from m_ to s_, just because. Review-Url: https://codereview.chromium.org/2009393002 --- core/fpdfdoc/doc_form.cpp | 9 +++---- core/fpdfdoc/include/fpdf_doc.h | 57 ++++------------------------------------- 2 files changed, 9 insertions(+), 57 deletions(-) (limited to 'core/fpdfdoc') diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index 7357f0a2eb..1570a6800c 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -262,8 +262,7 @@ CFieldTree::_Node* CFieldTree::FindNode(const CFX_WideString& full_name) { } CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument) - : CFX_PrivateData(), - m_pDocument(pDocument), + : m_pDocument(pDocument), m_pFormDict(nullptr), m_pFieldTree(new CFieldTree), m_pFormNotify(nullptr) { @@ -293,12 +292,12 @@ CPDF_InterForm::~CPDF_InterForm() { } } -FX_BOOL CPDF_InterForm::m_bUpdateAP = TRUE; +FX_BOOL CPDF_InterForm::s_bUpdateAP = TRUE; FX_BOOL CPDF_InterForm::UpdatingAPEnabled() { - return m_bUpdateAP; + return s_bUpdateAP; } void CPDF_InterForm::EnableUpdateAP(FX_BOOL bUpdateAP) { - m_bUpdateAP = bUpdateAP; + s_bUpdateAP = bUpdateAP; } CFX_ByteString CPDF_InterForm::GenerateNewResourceName( const CPDF_Dictionary* pResDict, diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h index 8c7ce4eeab..339182c19b 100644 --- a/core/fpdfdoc/include/fpdf_doc.h +++ b/core/fpdfdoc/include/fpdf_doc.h @@ -435,106 +435,76 @@ class CPDF_DefaultAppearance { #define FIELDTYPE_TEXTFIELD 6 #define FIELDTYPE_SIGNATURE 7 -class CPDF_InterForm : public CFX_PrivateData { +class CPDF_InterForm { public: explicit CPDF_InterForm(CPDF_Document* pDocument); ~CPDF_InterForm(); static void EnableUpdateAP(FX_BOOL bUpdateAP); - static FX_BOOL UpdatingAPEnabled(); - static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict, const FX_CHAR* csType, int iMinLen = 2, const FX_CHAR* csPrefix = ""); - static CPDF_Font* AddStandardFont(CPDF_Document* pDocument, CFX_ByteString csFontName); - static CFX_ByteString GetNativeFont(uint8_t iCharSet, void* pLogFont = nullptr); - static CFX_ByteString GetNativeFont(void* pLogFont = nullptr); - static uint8_t GetNativeCharSet(); - static CPDF_Font* AddNativeFont(uint8_t iCharSet, CPDF_Document* pDocument); - static CPDF_Font* AddNativeFont(CPDF_Document* pDocument); FX_BOOL ValidateFieldName(CFX_WideString& csNewFieldName, int iType); - FX_BOOL ValidateFieldName(const CPDF_FormField* pField, CFX_WideString& csNewFieldName); - FX_BOOL ValidateFieldName(const CPDF_FormControl* pControl, CFX_WideString& csNewFieldName); uint32_t CountFields(const CFX_WideString& csFieldName = L""); - CPDF_FormField* GetField(uint32_t index, const CFX_WideString& csFieldName = L""); - CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const; CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage, FX_FLOAT pdf_x, FX_FLOAT pdf_y, int* z_order) const; - CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const; CPDF_Document* GetDocument() const { return m_pDocument; } - CPDF_Dictionary* GetFormDict() const { return m_pFormDict; } - FX_BOOL NeedConstructAP() const; - int CountFieldsInCalculationOrder(); - CPDF_FormField* GetFieldInCalculationOrder(int index); - int FindFieldInCalculationOrder(const CPDF_FormField* pField); uint32_t CountFormFonts(); - CPDF_Font* GetFormFont(uint32_t index, CFX_ByteString& csNameTag); - CPDF_Font* GetFormFont(CFX_ByteString csNameTag); - CPDF_Font* GetFormFont(CFX_ByteString csFontName, CFX_ByteString& csNameTag); - CPDF_Font* GetNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); - CPDF_Font* GetNativeFormFont(CFX_ByteString& csNameTag); - FX_BOOL FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); - FX_BOOL FindFormFont(CFX_ByteString csFontName, CPDF_Font*& pFont, CFX_ByteString& csNameTag); - inline FX_BOOL FindFormFont(CFX_WideString csFontName, - CPDF_Font*& pFont, - CFX_ByteString& csNameTag) { + FX_BOOL FindFormFont(CFX_WideString csFontName, + CPDF_Font*& pFont, + CFX_ByteString& csNameTag) { return FindFormFont(PDF_EncodeText(csFontName), pFont, csNameTag); } void AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); - CPDF_Font* AddNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); - CPDF_Font* AddNativeFormFont(CFX_ByteString& csNameTag); void RemoveFormFont(const CPDF_Font* pFont); - void RemoveFormFont(CFX_ByteString csNameTag); CPDF_DefaultAppearance GetDefaultAppearance(); - CPDF_Font* GetDefaultFormFont(); - int GetFormAlignment(); CPDF_FormField* CheckRequiredFields( @@ -543,64 +513,47 @@ class CPDF_InterForm : public CFX_PrivateData { CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, bool bSimpleFileSpec = false) const; - CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, const std::vector& fields, bool bIncludeOrExclude = true, bool bSimpleFileSpec = false) const; - FX_BOOL ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE); bool ResetForm(const std::vector& fields, bool bIncludeOrExclude = true, bool bNotify = false); - bool ResetForm(bool bNotify = false); void SetFormNotify(IPDF_FormNotify* pNotify); - FX_BOOL HasXFAForm() const; - void FixPageFields(const CPDF_Page* pPage); protected: - static FX_BOOL m_bUpdateAP; + static FX_BOOL s_bUpdateAP; void LoadField(CPDF_Dictionary* pFieldDict, int nLevel = 0); - CPDF_Object* GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name); - CPDF_FormField* AddTerminalField(CPDF_Dictionary* pFieldDict); - CPDF_FormControl* AddControl(const CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict); - void FDF_ImportField(CPDF_Dictionary* pField, const CFX_WideString& parent_name, FX_BOOL bNotify = FALSE, int nLevel = 0); - FX_BOOL ValidateFieldName(CFX_WideString& csNewFieldName, int iType, const CPDF_FormField* pExcludedField, const CPDF_FormControl* pExcludedControl); - int CompareFieldName(const CFX_WideString& name1, const CFX_WideString& name2); - int CompareFieldName(const CFX_ByteString& name1, const CFX_ByteString& name2); CPDF_Document* const m_pDocument; - CPDF_Dictionary* m_pFormDict; - std::map m_ControlMap; - std::unique_ptr m_pFieldTree; - CFX_ByteString m_bsEncoding; - IPDF_FormNotify* m_pFormNotify; friend class CPDF_FormControl; -- cgit v1.2.3