xref: /aosp_15_r20/external/pdfium/fpdfsdk/cpdfsdk_appstream.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2017 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 FPDFSDK_CPDFSDK_APPSTREAM_H_
8 #define FPDFSDK_CPDFSDK_APPSTREAM_H_
9 
10 #include "core/fxcrt/fx_string.h"
11 #include "core/fxcrt/retain_ptr.h"
12 #include "core/fxcrt/unowned_ptr.h"
13 #include "third_party/abseil-cpp/absl/types/optional.h"
14 
15 class CPDFSDK_Widget;
16 class CPDF_Dictionary;
17 class CPDF_Stream;
18 
19 class CPDFSDK_AppStream {
20  public:
21   CPDFSDK_AppStream(CPDFSDK_Widget* widget, CPDF_Dictionary* dict);
22   ~CPDFSDK_AppStream();
23 
24   void SetAsPushButton();
25   void SetAsCheckBox();
26   void SetAsRadioButton();
27   void SetAsComboBox(absl::optional<WideString> sValue);
28   void SetAsListBox();
29   void SetAsTextField(absl::optional<WideString> sValue);
30 
31  private:
32   void AddImage(const ByteString& sAPType, CPDF_Stream* pImage);
33   void Write(const ByteString& sAPType,
34              const ByteString& sContents,
35              const ByteString& sAPState);
36   void Remove(ByteStringView sAPType);
37 
38   ByteString GetBackgroundAppStream() const;
39   ByteString GetBorderAppStream() const;
40 
41   UnownedPtr<CPDFSDK_Widget> const widget_;
42   RetainPtr<CPDF_Dictionary> const dict_;
43 };
44 
45 #endif  // FPDFSDK_CPDFSDK_APPSTREAM_H_
46