diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfdoc/doc_formcontrol.cpp | 38 | ||||
-rw-r--r-- | core/fpdfdoc/include/fpdf_doc.h | 54 |
2 files changed, 33 insertions, 59 deletions
diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp index b833f89c17..18e7330d29 100644 --- a/core/fpdfdoc/doc_formcontrol.cpp +++ b/core/fpdfdoc/doc_formcontrol.cpp @@ -201,33 +201,35 @@ CPDF_ApSettings CPDF_FormControl::GetMK() const { : nullptr); } -bool CPDF_FormControl::HasMKEntry(CFX_ByteString csEntry) const { - return GetMK().HasMKEntry(csEntry.AsStringC()); +bool CPDF_FormControl::HasMKEntry(const CFX_ByteString& csEntry) const { + return GetMK().HasMKEntry(csEntry); } int CPDF_FormControl::GetRotation() { return GetMK().GetRotation(); } -FX_ARGB CPDF_FormControl::GetColor(int& iColorType, CFX_ByteString csEntry) { - return GetMK().GetColor(iColorType, csEntry.AsStringC()); +FX_ARGB CPDF_FormControl::GetColor(int& iColorType, + const CFX_ByteString& csEntry) { + return GetMK().GetColor(iColorType, csEntry); } -FX_FLOAT CPDF_FormControl::GetOriginalColor(int index, CFX_ByteString csEntry) { - return GetMK().GetOriginalColor(index, csEntry.AsStringC()); +FX_FLOAT CPDF_FormControl::GetOriginalColor(int index, + const CFX_ByteString& csEntry) { + return GetMK().GetOriginalColor(index, csEntry); } void CPDF_FormControl::GetOriginalColor(int& iColorType, FX_FLOAT fc[4], - CFX_ByteString csEntry) { - GetMK().GetOriginalColor(iColorType, fc, csEntry.AsStringC()); + const CFX_ByteString& csEntry) { + GetMK().GetOriginalColor(iColorType, fc, csEntry); } -CFX_WideString CPDF_FormControl::GetCaption(CFX_ByteString csEntry) { - return GetMK().GetCaption(csEntry.AsStringC()); +CFX_WideString CPDF_FormControl::GetCaption(const CFX_ByteString& csEntry) { + return GetMK().GetCaption(csEntry); } -CPDF_Stream* CPDF_FormControl::GetIcon(CFX_ByteString csEntry) { - return GetMK().GetIcon(csEntry.AsStringC()); +CPDF_Stream* CPDF_FormControl::GetIcon(const CFX_ByteString& csEntry) { + return GetMK().GetIcon(csEntry); } CPDF_IconFit CPDF_FormControl::GetIconFit() { @@ -330,7 +332,7 @@ int CPDF_FormControl::GetControlAlignment() { CPDF_ApSettings::CPDF_ApSettings(CPDF_Dictionary* pDict) : m_pDict(pDict) {} -bool CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry) const { +bool CPDF_ApSettings::HasMKEntry(const CFX_ByteString& csEntry) const { return m_pDict && m_pDict->KeyExist(csEntry); } @@ -339,7 +341,7 @@ int CPDF_ApSettings::GetRotation() const { } FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, - const CFX_ByteStringC& csEntry) const { + const CFX_ByteString& csEntry) const { iColorType = COLORTYPE_TRANSPARENT; if (!m_pDict) return 0; @@ -376,7 +378,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, FX_FLOAT CPDF_ApSettings::GetOriginalColor( int index, - const CFX_ByteStringC& csEntry) const { + const CFX_ByteString& csEntry) const { if (!m_pDict) return 0; @@ -386,7 +388,7 @@ FX_FLOAT CPDF_ApSettings::GetOriginalColor( void CPDF_ApSettings::GetOriginalColor(int& iColorType, FX_FLOAT fc[4], - const CFX_ByteStringC& csEntry) const { + const CFX_ByteString& csEntry) const { iColorType = COLORTYPE_TRANSPARENT; for (int i = 0; i < 4; i++) { fc[i] = 0; @@ -417,11 +419,11 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType, } CFX_WideString CPDF_ApSettings::GetCaption( - const CFX_ByteStringC& csEntry) const { + const CFX_ByteString& csEntry) const { return m_pDict ? m_pDict->GetUnicodeTextBy(csEntry) : CFX_WideString(); } -CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteStringC& csEntry) const { +CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteString& csEntry) const { return m_pDict ? m_pDict->GetStreamBy(csEntry) : nullptr; } diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h index bcbfcf33ba..b8bc56b0cc 100644 --- a/core/fpdfdoc/include/fpdf_doc.h +++ b/core/fpdfdoc/include/fpdf_doc.h @@ -840,7 +840,7 @@ class CPDF_FormControl { bool IsDefaultChecked() const; HighlightingMode GetHighlightingMode(); - bool HasMKEntry(CFX_ByteString csEntry) const; + bool HasMKEntry(const CFX_ByteString& csEntry) const; int GetRotation(); inline FX_ARGB GetBorderColor(int& iColorType) { @@ -868,29 +868,20 @@ class CPDF_FormControl { } CFX_WideString GetNormalCaption() { return GetCaption("CA"); } - CFX_WideString GetRolloverCaption() { return GetCaption("RC"); } - CFX_WideString GetDownCaption() { return GetCaption("AC"); } CPDF_Stream* GetNormalIcon() { return GetIcon("I"); } - CPDF_Stream* GetRolloverIcon() { return GetIcon("RI"); } - CPDF_Stream* GetDownIcon() { return GetIcon("IX"); } - CPDF_IconFit GetIconFit(); int GetTextPosition(); - CPDF_Action GetAction(); - CPDF_AAction GetAdditionalAction(); - CPDF_DefaultAppearance GetDefaultAppearance(); CPDF_Font* GetDefaultControlFont(); - int GetControlAlignment(); protected: @@ -898,28 +889,21 @@ class CPDF_FormControl { CFX_ByteString GetOnStateName() const; void SetOnStateName(const CFX_ByteString& csOn); - void CheckControl(FX_BOOL bChecked); - - FX_ARGB GetColor(int& iColorType, CFX_ByteString csEntry); - - FX_FLOAT GetOriginalColor(int index, CFX_ByteString csEntry); - + FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry); + FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry); void GetOriginalColor(int& iColorType, FX_FLOAT fc[4], - CFX_ByteString csEntry); - - CFX_WideString GetCaption(CFX_ByteString csEntry); - - CPDF_Stream* GetIcon(CFX_ByteString csEntry); + const CFX_ByteString& csEntry); + CFX_WideString GetCaption(const CFX_ByteString& csEntry); + CPDF_Stream* GetIcon(const CFX_ByteString& csEntry); CPDF_ApSettings GetMK() const; CPDF_InterForm* m_pForm; - CPDF_FormField* m_pField; - CPDF_Dictionary* m_pWidgetDict; + friend class CPDF_InterForm; friend class CPDF_FormField; }; @@ -987,7 +971,7 @@ class CPDF_ApSettings { public: explicit CPDF_ApSettings(CPDF_Dictionary* pDict); - bool HasMKEntry(const CFX_ByteStringC& csEntry) const; + bool HasMKEntry(const CFX_ByteString& csEntry) const; int GetRotation() const; FX_ARGB GetBorderColor(int& iColorType) const { @@ -1015,39 +999,27 @@ class CPDF_ApSettings { } CFX_WideString GetNormalCaption() const { return GetCaption("CA"); } - CFX_WideString GetRolloverCaption() const { return GetCaption("RC"); } - CFX_WideString GetDownCaption() const { return GetCaption("AC"); } - CPDF_Stream* GetNormalIcon() const { return GetIcon("I"); } - CPDF_Stream* GetRolloverIcon() const { return GetIcon("RI"); } - CPDF_Stream* GetDownIcon() const { return GetIcon("IX"); } - CPDF_IconFit GetIconFit() const; - int GetTextPosition() const; protected: friend class CPDF_FormControl; - FX_ARGB GetColor(int& iColorType, const CFX_ByteStringC& csEntry) const; - - FX_FLOAT GetOriginalColor(int index, const CFX_ByteStringC& csEntry) const; - + FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry) const; + FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry) const; void GetOriginalColor(int& iColorType, FX_FLOAT fc[4], - const CFX_ByteStringC& csEntry) const; - - CFX_WideString GetCaption(const CFX_ByteStringC& csEntry) const; + const CFX_ByteString& csEntry) const; - CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry) const; + CFX_WideString GetCaption(const CFX_ByteString& csEntry) const; + CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const; CPDF_Dictionary* const m_pDict; }; -CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath); - #endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ |