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