• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 PDFium Authors. All rights reserved.
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/fx_system.h"
13 #include "core/fxcrt/unowned_ptr.h"
14 #include "core/fxge/fx_dib.h"
15 
16 class CPDF_Dictionary;
17 class CPDF_FormControl;
18 class CPDF_Stream;
19 
20 class CPDF_ApSettings {
21  public:
22   explicit CPDF_ApSettings(CPDF_Dictionary* pDict);
23   CPDF_ApSettings(const CPDF_ApSettings& that);
24   ~CPDF_ApSettings();
25 
26   bool HasMKEntry(const ByteString& csEntry) const;
27   int GetRotation() const;
28 
GetBorderColor(int & iColorType)29   FX_ARGB GetBorderColor(int& iColorType) const {
30     return GetColor(iColorType, "BC");
31   }
32 
GetOriginalBorderColor(int index)33   float GetOriginalBorderColor(int index) const {
34     return GetOriginalColor(index, "BC");
35   }
36 
GetOriginalBorderColor(int & iColorType,float fc[4])37   void GetOriginalBorderColor(int& iColorType, float fc[4]) const {
38     GetOriginalColor(iColorType, fc, "BC");
39   }
40 
GetBackgroundColor(int & iColorType)41   FX_ARGB GetBackgroundColor(int& iColorType) const {
42     return GetColor(iColorType, "BG");
43   }
44 
GetOriginalBackgroundColor(int index)45   float GetOriginalBackgroundColor(int index) const {
46     return GetOriginalColor(index, "BG");
47   }
48 
GetOriginalBackgroundColor(int & iColorType,float fc[4])49   void GetOriginalBackgroundColor(int& iColorType, float fc[4]) const {
50     GetOriginalColor(iColorType, fc, "BG");
51   }
52 
GetNormalCaption()53   WideString GetNormalCaption() const { return GetCaption("CA"); }
GetRolloverCaption()54   WideString GetRolloverCaption() const { return GetCaption("RC"); }
GetDownCaption()55   WideString GetDownCaption() const { return GetCaption("AC"); }
GetNormalIcon()56   CPDF_Stream* GetNormalIcon() const { return GetIcon("I"); }
GetRolloverIcon()57   CPDF_Stream* GetRolloverIcon() const { return GetIcon("RI"); }
GetDownIcon()58   CPDF_Stream* GetDownIcon() const { return GetIcon("IX"); }
59   CPDF_IconFit GetIconFit() const;
60   int GetTextPosition() const;
61 
62   FX_ARGB GetColor(int& iColorType, const ByteString& csEntry) const;
63   float GetOriginalColor(int index, const ByteString& csEntry) const;
64   void GetOriginalColor(int& iColorType,
65                         float fc[4],
66                         const ByteString& csEntry) const;
67 
68   WideString GetCaption(const ByteString& csEntry) const;
69   CPDF_Stream* GetIcon(const ByteString& csEntry) const;
70 
71  private:
72   UnownedPtr<CPDF_Dictionary> const m_pDict;
73 };
74 
75 #endif  // CORE_FPDFDOC_CPDF_APSETTINGS_H_
76