blob: 8a38a8696485fad0fb54c3d289cf320e0da43bc0 [file] [log] [blame]
Dan Sinclaircb2ea422017-07-19 15:24:49 -04001// 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
Tom Sepez6c62e0e2019-08-01 21:49:43 +00007#ifndef FPDFSDK_CPDFSDK_APPSTREAM_H_
8#define FPDFSDK_CPDFSDK_APPSTREAM_H_
Dan Sinclaircb2ea422017-07-19 15:24:49 -04009
Dan Sinclaircb2ea422017-07-19 15:24:49 -040010#include "core/fxcrt/fx_string.h"
Dan Sinclairaee0db02017-09-21 16:53:58 -040011#include "core/fxcrt/unowned_ptr.h"
Lei Zhang4f261ff2018-10-10 18:44:45 +000012#include "third_party/base/optional.h"
Dan Sinclaircb2ea422017-07-19 15:24:49 -040013
14class CPDFSDK_Widget;
15class CPDF_Dictionary;
16class CPDF_Stream;
17
Tom Sepez6c62e0e2019-08-01 21:49:43 +000018class CPDFSDK_AppStream {
Dan Sinclaircb2ea422017-07-19 15:24:49 -040019 public:
Tom Sepez6c62e0e2019-08-01 21:49:43 +000020 CPDFSDK_AppStream(CPDFSDK_Widget* widget, CPDF_Dictionary* dict);
21 ~CPDFSDK_AppStream();
Dan Sinclaircb2ea422017-07-19 15:24:49 -040022
23 void SetAsPushButton();
24 void SetAsCheckBox();
25 void SetAsRadioButton();
Lei Zhang4f261ff2018-10-10 18:44:45 +000026 void SetAsComboBox(Optional<WideString> sValue);
Dan Sinclaircb2ea422017-07-19 15:24:49 -040027 void SetAsListBox();
Lei Zhang4f261ff2018-10-10 18:44:45 +000028 void SetAsTextField(Optional<WideString> sValue);
Dan Sinclaircb2ea422017-07-19 15:24:49 -040029
30 private:
Ryan Harrison275e2602017-09-18 14:23:18 -040031 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);
Dan Sinclaircb2ea422017-07-19 15:24:49 -040036
Ryan Harrison275e2602017-09-18 14:23:18 -040037 ByteString GetBackgroundAppStream() const;
38 ByteString GetBorderAppStream() const;
Dan Sinclaircb2ea422017-07-19 15:24:49 -040039
Lei Zhang4f261ff2018-10-10 18:44:45 +000040 UnownedPtr<CPDFSDK_Widget> const widget_;
Tom Sepezb33a0112019-05-03 20:53:08 +000041 RetainPtr<CPDF_Dictionary> const dict_;
Dan Sinclaircb2ea422017-07-19 15:24:49 -040042};
43
Tom Sepez6c62e0e2019-08-01 21:49:43 +000044#endif // FPDFSDK_CPDFSDK_APPSTREAM_H_