summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow/cpwl_appstream.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-07-19 15:24:49 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-07-19 19:56:19 +0000
commitcb2ea42cc56eb6aaab3e498abf13e63742e64181 (patch)
treeb6e576eb901382cd302109e831d693f81913644a /fpdfsdk/pdfwindow/cpwl_appstream.h
parent67ccef73bf664b7cdb4c6eed7acbaa4163c22a80 (diff)
downloadpdfium-cb2ea42cc56eb6aaab3e498abf13e63742e64181.tar.xz
Create CPWL_AppStream.
This CL creates a CPWL_AppStream and consolidates app stream generation code from CPDFSDK_Widget, CPDFSDK_BAAnnot and CPWL_Utils. The remaining app stream code from CPWL_Utils will be cleaned up in a future CL. Change-Id: I20cfdec09a351bd509241d2c667a182fba84b0c1 Reviewed-on: https://pdfium-review.googlesource.com/8310 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'fpdfsdk/pdfwindow/cpwl_appstream.h')
-rw-r--r--fpdfsdk/pdfwindow/cpwl_appstream.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/fpdfsdk/pdfwindow/cpwl_appstream.h b/fpdfsdk/pdfwindow/cpwl_appstream.h
new file mode 100644
index 0000000000..56137864ec
--- /dev/null
+++ b/fpdfsdk/pdfwindow/cpwl_appstream.h
@@ -0,0 +1,43 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FPDFSDK_PDFWINDOW_CPWL_APPSTREAM_H_
+#define FPDFSDK_PDFWINDOW_CPWL_APPSTREAM_H_
+
+#include "core/fxcrt/cfx_unowned_ptr.h"
+#include "core/fxcrt/fx_string.h"
+
+class CPDFSDK_Widget;
+class CPDF_Dictionary;
+class CPDF_Stream;
+
+class CPWL_AppStream {
+ public:
+ CPWL_AppStream(CPDFSDK_Widget* widget, CPDF_Dictionary* dict);
+ ~CPWL_AppStream();
+
+ void SetAsPushButton();
+ void SetAsCheckBox();
+ void SetAsRadioButton();
+ void SetAsComboBox(const CFX_WideString* sValue);
+ void SetAsListBox();
+ void SetAsTextField(const CFX_WideString* sValue);
+
+ private:
+ void AddImage(const CFX_ByteString& sAPType, CPDF_Stream* pImage);
+ void Write(const CFX_ByteString& sAPType,
+ const CFX_ByteString& sContents,
+ const CFX_ByteString& sAPState);
+ void Remove(const CFX_ByteString& sAPType);
+
+ CFX_ByteString GetBackgroundAppStream() const;
+ CFX_ByteString GetBorderAppStream() const;
+
+ CFX_UnownedPtr<CPDFSDK_Widget> widget_;
+ CFX_UnownedPtr<CPDF_Dictionary> dict_;
+};
+
+#endif // FPDFSDK_PDFWINDOW_CPWL_APPSTREAM_H_