1 // Copyright 2016 The PDFium Authors 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 CORE_FPDFDOC_CPDF_APSETTINGS_H_ 8 #define CORE_FPDFDOC_CPDF_APSETTINGS_H_ 9 10 #include "core/fpdfdoc/cpdf_iconfit.h" 11 #include "core/fxcrt/fx_string.h" 12 #include "core/fxcrt/retain_ptr.h" 13 #include "core/fxge/cfx_color.h" 14 #include "core/fxge/dib/fx_dib.h" 15 16 class CPDF_Dictionary; 17 class CPDF_Stream; 18 19 // Corresponds to PDF spec section 12.5.6.19 (Widget annotation TP dictionary). 20 #define TEXTPOS_CAPTION 0 21 #define TEXTPOS_ICON 1 22 #define TEXTPOS_BELOW 2 23 #define TEXTPOS_ABOVE 3 24 #define TEXTPOS_RIGHT 4 25 #define TEXTPOS_LEFT 5 26 #define TEXTPOS_OVERLAID 6 27 28 class CPDF_ApSettings { 29 public: 30 explicit CPDF_ApSettings(RetainPtr<CPDF_Dictionary> pDict); 31 CPDF_ApSettings(const CPDF_ApSettings& that); 32 ~CPDF_ApSettings(); 33 34 bool HasMKEntry(const ByteString& csEntry) const; 35 int GetRotation() const; 36 37 CPDF_IconFit GetIconFit() const; 38 39 // Returns one of the TEXTPOS_* values above. 40 int GetTextPosition() const; 41 42 CFX_Color::TypeAndARGB GetColorARGB(const ByteString& csEntry) const; 43 44 float GetOriginalColorComponent(int index, const ByteString& csEntry) const; 45 CFX_Color GetOriginalColor(const ByteString& csEntry) const; 46 47 WideString GetCaption(const ByteString& csEntry) const; 48 RetainPtr<CPDF_Stream> GetIcon(const ByteString& csEntry) const; 49 50 private: 51 RetainPtr<CPDF_Dictionary> const m_pDict; 52 }; 53 54 #endif // CORE_FPDFDOC_CPDF_APSETTINGS_H_ 55