Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_formcontrol.h
Go to the documentation of this file.
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_FORMCONTROL_H_
8#define CORE_FPDFDOC_CPDF_FORMCONTROL_H_
9
10#include "constants/appearance.h"
11#include "core/fpdfdoc/cpdf_aaction.h"
12#include "core/fpdfdoc/cpdf_action.h"
13#include "core/fpdfdoc/cpdf_annot.h"
14#include "core/fpdfdoc/cpdf_annotlist.h"
15#include "core/fpdfdoc/cpdf_apsettings.h"
16#include "core/fpdfdoc/cpdf_defaultappearance.h"
17#include "core/fpdfdoc/cpdf_formfield.h"
18#include "core/fpdfdoc/cpdf_iconfit.h"
19#include "core/fxcrt/fx_coordinates.h"
20#include "core/fxcrt/fx_string.h"
21#include "core/fxcrt/retain_ptr.h"
22#include "core/fxcrt/unowned_ptr.h"
23#include "core/fxge/cfx_color.h"
24#include "core/fxge/dib/fx_dib.h"
25#include "third_party/abseil-cpp/absl/types/optional.h"
26
28class CPDF_Dictionary;
29class CPDF_Font;
30class CPDF_FormField;
32class CPDF_Stream;
33
35 public:
37
39 RetainPtr<CPDF_Dictionary> pWidgetDict,
42
43 CPDF_FormField::Type GetType() const { return m_pField->GetType(); }
44 CPDF_FormField* GetField() const { return m_pField; }
45 RetainPtr<const CPDF_Dictionary> GetWidgetDict() const {
46 return m_pWidgetDict;
47 }
48 CFX_FloatRect GetRect() const;
49
50 ByteString GetCheckedAPState() const;
51 WideString GetExportValue() const;
52
53 bool IsChecked() const;
54 bool IsDefaultChecked() const;
55
57 bool HasMKEntry(const ByteString& csEntry) const;
58 int GetRotation() const;
59
60 CFX_Color::TypeAndARGB GetColorARGB(const ByteString& csEntry);
61 float GetOriginalColorComponent(int index, const ByteString& csEntry);
62
64 return GetOriginalColor(pdfium::appearance::kBC);
65 }
66
68 return GetOriginalColor(pdfium::appearance::kBG);
69 }
70
71 WideString GetNormalCaption() const {
72 return GetCaption(pdfium::appearance::kCA);
73 }
74 WideString GetRolloverCaption() const {
75 return GetCaption(pdfium::appearance::kRC);
76 }
77 WideString GetDownCaption() const {
78 return GetCaption(pdfium::appearance::kAC);
79 }
80
81 RetainPtr<CPDF_Stream> GetNormalIcon() {
82 return GetIcon(pdfium::appearance::kI);
83 }
84 RetainPtr<CPDF_Stream> GetRolloverIcon() {
85 return GetIcon(pdfium::appearance::kRI);
86 }
87 RetainPtr<CPDF_Stream> GetDownIcon() {
88 return GetIcon(pdfium::appearance::kIX);
89 }
91
92 int GetTextPosition() const;
94
96 int GetControlAlignment() const;
97
98 ByteString GetOnStateName() const;
99 void CheckControl(bool bChecked);
100
101 private:
102 RetainPtr<CPDF_Font> GetDefaultControlFont() const;
103 CFX_Color GetOriginalColor(const ByteString& csEntry);
104
105 WideString GetCaption(const ByteString& csEntry) const;
106 RetainPtr<CPDF_Stream> GetIcon(const ByteString& csEntry);
107 CPDF_ApSettings GetMK() const;
108
109 UnownedPtr<CPDF_FormField> const m_pField;
110 RetainPtr<CPDF_Dictionary> const m_pWidgetDict;
111 UnownedPtr<const CPDF_InteractiveForm> const m_pForm;
112};
113
114#endif // CORE_FPDFDOC_CPDF_FORMCONTROL_H_
CFX_Color GetOriginalColor(const ByteString &csEntry) const
bool HasMKEntry(const ByteString &csEntry) const
int GetRotation() const
RetainPtr< CPDF_Stream > GetIcon(const ByteString &csEntry) const
CPDF_ApSettings(const CPDF_ApSettings &that)
CPDF_IconFit GetIconFit() const
WideString GetCaption(const ByteString &csEntry) const
float GetOriginalColorComponent(int index, const ByteString &csEntry) const
CFX_Color::TypeAndARGB GetColorARGB(const ByteString &csEntry) const
CPDF_ApSettings(RetainPtr< CPDF_Dictionary > pDict)
int GetTextPosition() const
CPDF_FormField::Type GetType() const
WideString GetExportValue() const
int GetControlAlignment() const
bool HasMKEntry(const ByteString &csEntry) const
CFX_FloatRect GetRect() const
RetainPtr< CPDF_Stream > GetDownIcon()
WideString GetDownCaption() const
RetainPtr< CPDF_Stream > GetNormalIcon()
HighlightingMode GetHighlightingMode() const
float GetOriginalColorComponent(int index, const ByteString &csEntry)
WideString GetRolloverCaption() const
CFX_Color GetOriginalBackgroundColor()
CPDF_FormField * GetField() const
RetainPtr< const CPDF_Dictionary > GetWidgetDict() const
absl::optional< WideString > GetDefaultControlFontName() const
WideString GetNormalCaption() const
ByteString GetCheckedAPState() const
ByteString GetOnStateName() const
CPDF_IconFit GetIconFit() const
CPDF_DefaultAppearance GetDefaultAppearance() const
CFX_Color::TypeAndARGB GetColorARGB(const ByteString &csEntry)
RetainPtr< CPDF_Stream > GetRolloverIcon()
void CheckControl(bool bChecked)
CFX_Color GetOriginalBorderColor()
bool IsDefaultChecked() const
CPDF_FormControl(CPDF_FormField *pField, RetainPtr< CPDF_Dictionary > pWidgetDict, CPDF_InteractiveForm *pForm)
int GetTextPosition() const
ScaleMethod GetScaleMethod() const
bool GetFittingBounds() const
CFX_VectorF GetImageOffset(const CFX_SizeF &image_size, const CFX_VectorF &scale, const CFX_FloatRect &rcPlate) const
CFX_PointF GetIconBottomLeftPosition() const
bool IsProportionalScale() const
CFX_VectorF GetScale(const CFX_SizeF &image_size, const CFX_FloatRect &rcPlate) const
CPDF_IconFit(RetainPtr< const CPDF_Dictionary > pDict)
CPDF_IconFit(const CPDF_IconFit &that)
#define TEXTPOS_CAPTION
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:118
const char kRC[]
const char kIX[]
const char kBC[]
const char kAC[]
const char kCA[]
const char kI[]
const char kBG[]
const char kRI[]
TypeAndARGB(CFX_Color::Type type_in, FX_ARGB argb_in)
Definition cfx_color.h:17
constexpr CFX_Color(Type type=CFX_Color::Type::kTransparent, float color1=0.0f, float color2=0.0f, float color3=0.0f, float color4=0.0f)
Definition cfx_color.h:27