From cac704dd3e5c0e5900e898db4eff5a0948cef6fc Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 28 Jul 2016 12:59:09 -0700 Subject: Split fpdfdoc/include/fpdf_doc.h into individual classes. This CL splits the header file apart. The cpp files are not touched as part of this CL, they will be done as a followup. This de-duplicates the fpdf_doc.h BUG=pdfium:249 Review-Url: https://codereview.chromium.org/2183313004 --- BUILD.gn | 27 +- core/fpdfapi/cpdf_pagerendercontext.cpp | 4 +- core/fpdfapi/fpdf_parser/include/cpdf_document.h | 2 +- core/fpdfapi/fpdf_render/fpdf_render.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 2 +- core/fpdfdoc/cpdf_annot.cpp | 2 +- core/fpdfdoc/cpdf_annot.h | 70 -- core/fpdfdoc/cpdf_annotlist.cpp | 6 +- core/fpdfdoc/cpdf_annotlist.h | 64 -- core/fpdfdoc/cpdf_apsettings.h | 74 ++ core/fpdfdoc/cpdf_pagelabel.h | 26 + core/fpdfdoc/cpvt_generateap.cpp | 3 +- core/fpdfdoc/cpvt_generateap.h | 2 +- core/fpdfdoc/doc_action.cpp | 8 +- core/fpdfdoc/doc_basic.cpp | 6 +- core/fpdfdoc/doc_basic_unittest.cpp | 4 +- core/fpdfdoc/doc_bookmark.cpp | 6 +- core/fpdfdoc/doc_form.cpp | 4 +- core/fpdfdoc/doc_formcontrol.cpp | 5 +- core/fpdfdoc/doc_formfield.cpp | 46 +- core/fpdfdoc/doc_link.cpp | 4 +- core/fpdfdoc/doc_metadata.cpp | 3 +- core/fpdfdoc/doc_ocg.cpp | 3 +- core/fpdfdoc/doc_utils.cpp | 5 +- core/fpdfdoc/doc_viewerPreferences.cpp | 3 +- core/fpdfdoc/include/cpdf_aaction.h | 51 ++ core/fpdfdoc/include/cpdf_action.h | 59 ++ core/fpdfdoc/include/cpdf_actionfields.h | 27 + core/fpdfdoc/include/cpdf_annot.h | 73 ++ core/fpdfdoc/include/cpdf_annotlist.h | 64 ++ core/fpdfdoc/include/cpdf_bookmark.h | 33 + core/fpdfdoc/include/cpdf_bookmarktree.h | 26 + core/fpdfdoc/include/cpdf_defaultappearance.h | 50 ++ core/fpdfdoc/include/cpdf_dest.h | 32 + core/fpdfdoc/include/cpdf_docjsactions.h | 29 + core/fpdfdoc/include/cpdf_filespec.h | 35 + core/fpdfdoc/include/cpdf_formcontrol.h | 134 ++++ core/fpdfdoc/include/cpdf_formfield.h | 167 +++++ core/fpdfdoc/include/cpdf_iconfit.h | 30 + core/fpdfdoc/include/cpdf_interform.h | 155 +++++ core/fpdfdoc/include/cpdf_link.h | 31 + core/fpdfdoc/include/cpdf_linklist.h | 36 + core/fpdfdoc/include/cpdf_metadata.h | 26 + core/fpdfdoc/include/cpdf_nametree.h | 34 + core/fpdfdoc/include/cpdf_occontext.h | 42 ++ core/fpdfdoc/include/cpdf_viewerpreferences.h | 34 + core/fpdfdoc/include/fpdf_doc.h | 851 ----------------------- core/fpdfdoc/include/ipdf_formnotify.h | 32 + fpdfsdk/formfiller/cba_fontmap.cpp | 2 + fpdfsdk/fpdf_dataavail_embeddertest.cpp | 1 - fpdfsdk/fpdf_ext.cpp | 3 + fpdfsdk/fpdf_flatten.cpp | 1 + fpdfsdk/fpdfdoc.cpp | 2 + fpdfsdk/fpdfdoc_unittest.cpp | 1 - fpdfsdk/fpdfeditpage.cpp | 2 + fpdfsdk/fpdfformfill.cpp | 3 + fpdfsdk/fpdftext.cpp | 2 +- fpdfsdk/fpdfview.cpp | 4 + fpdfsdk/fsdk_actionhandler.cpp | 2 + fpdfsdk/fsdk_annothandler.cpp | 1 + fpdfsdk/fsdk_baseannot.cpp | 1 + fpdfsdk/fsdk_baseform.cpp | 2 + fpdfsdk/fsdk_mgr.cpp | 2 + fpdfsdk/fxedit/fxet_edit.cpp | 1 + fpdfsdk/include/fsdk_actionhandler.h | 1 - fpdfsdk/include/fsdk_baseannot.h | 5 +- fpdfsdk/include/fsdk_baseform.h | 4 +- fpdfsdk/include/fsdk_define.h | 5 +- fpdfsdk/include/fsdk_mgr.h | 2 + fpdfsdk/javascript/Document.cpp | 2 + fpdfsdk/javascript/Field.cpp | 1 + fpdfsdk/javascript/Icon.h | 6 +- fpdfsdk/javascript/PublicMethods.cpp | 1 + fpdfsdk/pdfwindow/PWL_Wnd.h | 2 +- pdfium.gyp | 31 +- public/fpdf_formfill.h | 14 +- xfa/fxfa/app/xfa_ffdoc.cpp | 3 +- 77 files changed, 1497 insertions(+), 1042 deletions(-) delete mode 100644 core/fpdfdoc/cpdf_annot.h delete mode 100644 core/fpdfdoc/cpdf_annotlist.h create mode 100644 core/fpdfdoc/cpdf_apsettings.h create mode 100644 core/fpdfdoc/cpdf_pagelabel.h create mode 100644 core/fpdfdoc/include/cpdf_aaction.h create mode 100644 core/fpdfdoc/include/cpdf_action.h create mode 100644 core/fpdfdoc/include/cpdf_actionfields.h create mode 100644 core/fpdfdoc/include/cpdf_annot.h create mode 100644 core/fpdfdoc/include/cpdf_annotlist.h create mode 100644 core/fpdfdoc/include/cpdf_bookmark.h create mode 100644 core/fpdfdoc/include/cpdf_bookmarktree.h create mode 100644 core/fpdfdoc/include/cpdf_defaultappearance.h create mode 100644 core/fpdfdoc/include/cpdf_dest.h create mode 100644 core/fpdfdoc/include/cpdf_docjsactions.h create mode 100644 core/fpdfdoc/include/cpdf_filespec.h create mode 100644 core/fpdfdoc/include/cpdf_formcontrol.h create mode 100644 core/fpdfdoc/include/cpdf_formfield.h create mode 100644 core/fpdfdoc/include/cpdf_iconfit.h create mode 100644 core/fpdfdoc/include/cpdf_interform.h create mode 100644 core/fpdfdoc/include/cpdf_link.h create mode 100644 core/fpdfdoc/include/cpdf_linklist.h create mode 100644 core/fpdfdoc/include/cpdf_metadata.h create mode 100644 core/fpdfdoc/include/cpdf_nametree.h create mode 100644 core/fpdfdoc/include/cpdf_occontext.h create mode 100644 core/fpdfdoc/include/cpdf_viewerpreferences.h delete mode 100644 core/fpdfdoc/include/fpdf_doc.h create mode 100644 core/fpdfdoc/include/ipdf_formnotify.h diff --git a/BUILD.gn b/BUILD.gn index b6ecdad8e5..cdbdf9aeef 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -199,9 +199,9 @@ static_library("fpdfdoc") { "core/fpdfdoc/clines.cpp", "core/fpdfdoc/clines.h", "core/fpdfdoc/cpdf_annot.cpp", - "core/fpdfdoc/cpdf_annot.h", "core/fpdfdoc/cpdf_annotlist.cpp", - "core/fpdfdoc/cpdf_annotlist.h", + "core/fpdfdoc/cpdf_apsettings.h", + "core/fpdfdoc/cpdf_pagelabel.h", "core/fpdfdoc/cpdf_variabletext.cpp", "core/fpdfdoc/cpvt_color.cpp", "core/fpdfdoc/cpvt_color.h", @@ -234,7 +234,28 @@ static_library("fpdfdoc") { "core/fpdfdoc/doc_utils.h", "core/fpdfdoc/doc_viewerPreferences.cpp", "core/fpdfdoc/doc_vt.cpp", + "core/fpdfdoc/include/cpdf_aaction.h", + "core/fpdfdoc/include/cpdf_action.h", + "core/fpdfdoc/include/cpdf_actionfields.h", + "core/fpdfdoc/include/cpdf_annot.h", + "core/fpdfdoc/include/cpdf_annotlist.h", + "core/fpdfdoc/include/cpdf_bookmark.h", + "core/fpdfdoc/include/cpdf_bookmarktree.h", + "core/fpdfdoc/include/cpdf_defaultappearance.h", + "core/fpdfdoc/include/cpdf_dest.h", + "core/fpdfdoc/include/cpdf_docjsactions.h", + "core/fpdfdoc/include/cpdf_filespec.h", + "core/fpdfdoc/include/cpdf_formcontrol.h", + "core/fpdfdoc/include/cpdf_formfield.h", + "core/fpdfdoc/include/cpdf_iconfit.h", + "core/fpdfdoc/include/cpdf_interform.h", + "core/fpdfdoc/include/cpdf_link.h", + "core/fpdfdoc/include/cpdf_linklist.h", + "core/fpdfdoc/include/cpdf_metadata.h", + "core/fpdfdoc/include/cpdf_nametree.h", + "core/fpdfdoc/include/cpdf_occontext.h", "core/fpdfdoc/include/cpdf_variabletext.h", + "core/fpdfdoc/include/cpdf_viewerpreferences.h", "core/fpdfdoc/include/cpvt_line.h", "core/fpdfdoc/include/cpvt_secprops.h", "core/fpdfdoc/include/cpvt_section.h", @@ -242,8 +263,8 @@ static_library("fpdfdoc") { "core/fpdfdoc/include/cpvt_wordplace.h", "core/fpdfdoc/include/cpvt_wordprops.h", "core/fpdfdoc/include/cpvt_wordrange.h", - "core/fpdfdoc/include/fpdf_doc.h", "core/fpdfdoc/include/fpdf_tagged.h", + "core/fpdfdoc/include/ipdf_formnotify.h", "core/fpdfdoc/ipvt_fontmap.h", "core/fpdfdoc/pdf_vt.h", "core/fpdfdoc/tagged_int.h", diff --git a/core/fpdfapi/cpdf_pagerendercontext.cpp b/core/fpdfapi/cpdf_pagerendercontext.cpp index 04ae3a8e33..a82a460835 100644 --- a/core/fpdfapi/cpdf_pagerendercontext.cpp +++ b/core/fpdfapi/cpdf_pagerendercontext.cpp @@ -9,8 +9,8 @@ #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" -#include "core/fpdfdoc/cpdf_annotlist.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_annotlist.h" +#include "core/fpdfdoc/include/cpdf_occontext.h" #include "core/fxge/include/fx_ge.h" CPDF_PageRenderContext::CPDF_PageRenderContext() {} diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h index 63141bf297..3cece1c0a8 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h @@ -11,7 +11,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_linklist.h" #include "core/fxcrt/include/fx_basic.h" class CFX_Font; diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 66beb5b04c..ef208b54fd 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -27,7 +27,7 @@ #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_occontext.h" #include "core/fxge/include/fx_ge.h" CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc) diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index de9d1099cf..fc0321b46b 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -22,7 +22,7 @@ #include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_occontext.h" #include "core/fxcodec/include/fx_codec.h" #include "core/fxcrt/include/fx_safe_types.h" #include "core/fxge/include/fx_ge.h" diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index 57e7bc0bbb..18b1e9d946 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfdoc/cpdf_annot.h" +#include "core/fpdfdoc/include/cpdf_annot.h" #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" diff --git a/core/fpdfdoc/cpdf_annot.h b/core/fpdfdoc/cpdf_annot.h deleted file mode 100644 index eab76a6376..0000000000 --- a/core/fpdfdoc/cpdf_annot.h +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2016 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 CORE_FPDFDOC_CPDF_ANNOT_H_ -#define CORE_FPDFDOC_CPDF_ANNOT_H_ - -#include -#include - -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxcrt/include/fx_string.h" -#include "core/fxcrt/include/fx_system.h" - -class CFX_RenderDevice; -class CPDF_Dictionary; -class CPDF_Document; -class CPDF_Form; -class CPDF_Page; -class CPDF_RenderContext; -class CPDF_RenderOptions; -class CPDF_Stream; - -#define ANNOTFLAG_INVISIBLE 0x0001 -#define ANNOTFLAG_HIDDEN 0x0002 -#define ANNOTFLAG_PRINT 0x0004 -#define ANNOTFLAG_NOZOOM 0x0008 -#define ANNOTFLAG_NOROTATE 0x0010 -#define ANNOTFLAG_NOVIEW 0x0020 -#define ANNOTFLAG_READONLY 0x0040 -#define ANNOTFLAG_LOCKED 0x0080 -#define ANNOTFLAG_TOGGLENOVIEW 0x0100 - -class CPDF_Annot { - public: - enum AppearanceMode { Normal, Rollover, Down }; - - CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument); - ~CPDF_Annot(); - - CFX_ByteString GetSubType() const; - uint32_t GetFlags() const; - void GetRect(CFX_FloatRect& rect) const; - const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } - CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } - FX_BOOL DrawAppearance(CPDF_Page* pPage, - CFX_RenderDevice* pDevice, - const CFX_Matrix* pUser2Device, - AppearanceMode mode, - const CPDF_RenderOptions* pOptions); - FX_BOOL DrawInContext(const CPDF_Page* pPage, - CPDF_RenderContext* pContext, - const CFX_Matrix* pUser2Device, - AppearanceMode mode); - void ClearCachedAP(); - void DrawBorder(CFX_RenderDevice* pDevice, - const CFX_Matrix* pUser2Device, - const CPDF_RenderOptions* pOptions); - CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); - - private: - CPDF_Dictionary* const m_pAnnotDict; - CPDF_Document* const m_pDocument; - const CFX_ByteString m_sSubtype; - std::map> m_APMap; -}; - -#endif // CORE_FPDFDOC_CPDF_ANNOT_H_ diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 8b8c0e98bb..1e0e99b476 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -4,14 +4,16 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfdoc/cpdf_annotlist.h" +#include "core/fpdfdoc/include/cpdf_annotlist.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" -#include "core/fpdfdoc/cpdf_annot.h" #include "core/fpdfdoc/cpvt_generateap.h" +#include "core/fpdfdoc/include/cpdf_annot.h" +#include "core/fpdfdoc/include/cpdf_interform.h" +#include "core/fpdfdoc/include/cpdf_occontext.h" CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) : m_pDocument(pPage->m_pDocument) { diff --git a/core/fpdfdoc/cpdf_annotlist.h b/core/fpdfdoc/cpdf_annotlist.h deleted file mode 100644 index afe85f33af..0000000000 --- a/core/fpdfdoc/cpdf_annotlist.h +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2016 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 CORE_FPDFDOC_CPDF_ANNOTLIST_H_ -#define CORE_FPDFDOC_CPDF_ANNOTLIST_H_ - -#include -#include - -#include "core/fxcrt/include/fx_coordinates.h" -#include "core/fxcrt/include/fx_system.h" - -class CFX_RenderDevice; -class CPDF_Annot; -class CPDF_Document; -class CPDF_Page; -class CPDF_RenderContext; -class CPDF_RenderOptions; - -class CPDF_AnnotList { - public: - explicit CPDF_AnnotList(CPDF_Page* pPage); - ~CPDF_AnnotList(); - - void DisplayAnnots(CPDF_Page* pPage, - CPDF_RenderContext* pContext, - FX_BOOL bPrinting, - CFX_Matrix* pMatrix, - FX_BOOL bShowWidget, - CPDF_RenderOptions* pOptions); - - void DisplayAnnots(CPDF_Page* pPage, - CFX_RenderDevice* pDevice, - CPDF_RenderContext* pContext, - FX_BOOL bPrinting, - CFX_Matrix* pMatrix, - uint32_t dwAnnotFlags, - CPDF_RenderOptions* pOptions, - FX_RECT* pClipRect); - - size_t Count() const { return m_AnnotList.size(); } - CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index].get(); } - const std::vector>& All() const { - return m_AnnotList; - } - - private: - void DisplayPass(CPDF_Page* pPage, - CFX_RenderDevice* pDevice, - CPDF_RenderContext* pContext, - FX_BOOL bPrinting, - CFX_Matrix* pMatrix, - FX_BOOL bWidget, - CPDF_RenderOptions* pOptions, - FX_RECT* clip_rect); - - CPDF_Document* const m_pDocument; - std::vector> m_AnnotList; -}; - -#endif // CORE_FPDFDOC_CPDF_ANNOTLIST_H_ diff --git a/core/fpdfdoc/cpdf_apsettings.h b/core/fpdfdoc/cpdf_apsettings.h new file mode 100644 index 0000000000..d2bca5c5ee --- /dev/null +++ b/core/fpdfdoc/cpdf_apsettings.h @@ -0,0 +1,74 @@ +// Copyright 2016 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 CORE_FPDFDOC_CPDF_APSETTINGS_H_ +#define CORE_FPDFDOC_CPDF_APSETTINGS_H_ + +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" +#include "core/fxge/include/fx_dib.h" +#include "core/fpdfdoc/include/cpdf_iconfit.h" + +class CPDF_Dictionary; +class CPDF_FormControl; +class CPDF_Stream; + +class CPDF_ApSettings { + public: + explicit CPDF_ApSettings(CPDF_Dictionary* pDict); + + bool HasMKEntry(const CFX_ByteString& csEntry) const; + int GetRotation() const; + + FX_ARGB GetBorderColor(int& iColorType) const { + return GetColor(iColorType, "BC"); + } + + FX_FLOAT GetOriginalBorderColor(int index) const { + return GetOriginalColor(index, "BC"); + } + + void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) const { + GetOriginalColor(iColorType, fc, "BC"); + } + + FX_ARGB GetBackgroundColor(int& iColorType) const { + return GetColor(iColorType, "BG"); + } + + FX_FLOAT GetOriginalBackgroundColor(int index) const { + return GetOriginalColor(index, "BG"); + } + + void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) const { + GetOriginalColor(iColorType, fc, "BG"); + } + + CFX_WideString GetNormalCaption() const { return GetCaption("CA"); } + CFX_WideString GetRolloverCaption() const { return GetCaption("RC"); } + CFX_WideString GetDownCaption() const { return GetCaption("AC"); } + CPDF_Stream* GetNormalIcon() const { return GetIcon("I"); } + CPDF_Stream* GetRolloverIcon() const { return GetIcon("RI"); } + CPDF_Stream* GetDownIcon() const { return GetIcon("IX"); } + CPDF_IconFit GetIconFit() const; + int GetTextPosition() const; + + private: + friend class CPDF_FormControl; + + FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry) const; + FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry) const; + void GetOriginalColor(int& iColorType, + FX_FLOAT fc[4], + const CFX_ByteString& csEntry) const; + + CFX_WideString GetCaption(const CFX_ByteString& csEntry) const; + CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const; + + CPDF_Dictionary* const m_pDict; +}; + +#endif // CORE_FPDFDOC_CPDF_APSETTINGS_H_ diff --git a/core/fpdfdoc/cpdf_pagelabel.h b/core/fpdfdoc/cpdf_pagelabel.h new file mode 100644 index 0000000000..16acf3b701 --- /dev/null +++ b/core/fpdfdoc/cpdf_pagelabel.h @@ -0,0 +1,26 @@ +// Copyright 2016 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 CORE_FPDFDOC_CPDF_PAGELABEL_H_ +#define CORE_FPDFDOC_CPDF_PAGELABEL_H_ + +#include "core/fxcrt/include/fx_string.h" + +class CPDF_Document; + +class CPDF_PageLabel { + public: + explicit CPDF_PageLabel(CPDF_Document* pDocument); + + CFX_WideString GetLabel(int nPage) const; + int32_t GetPageByLabel(const CFX_ByteStringC& bsLabel) const; + int32_t GetPageByLabel(const CFX_WideStringC& wsLabel) const; + + private: + CPDF_Document* const m_pDocument; +}; + +#endif // CORE_FPDFDOC_CPDF_PAGELABEL_H_ diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index db2ee6c01d..7eb6188c94 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -11,10 +11,11 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfdoc/cpvt_color.h" #include "core/fpdfdoc/cpvt_fontmap.h" +#include "core/fpdfdoc/include/cpdf_formfield.h" #include "core/fpdfdoc/include/cpvt_word.h" -#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fpdfdoc/pdf_vt.h" namespace { diff --git a/core/fpdfdoc/cpvt_generateap.h b/core/fpdfdoc/cpvt_generateap.h index 1258643d3e..fe120909da 100644 --- a/core/fpdfdoc/cpvt_generateap.h +++ b/core/fpdfdoc/cpvt_generateap.h @@ -9,8 +9,8 @@ #include "core/fpdfdoc/cpvt_color.h" #include "core/fpdfdoc/cpvt_dash.h" +#include "core/fpdfdoc/include/cpdf_defaultappearance.h" #include "core/fpdfdoc/include/cpdf_variabletext.h" -#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxcrt/include/fx_coordinates.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index c512d1afa9..30d4006b54 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -4,11 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfdoc/include/cpdf_action.h" + #include #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_aaction.h" +#include "core/fpdfdoc/include/cpdf_actionfields.h" +#include "core/fpdfdoc/include/cpdf_docjsactions.h" +#include "core/fpdfdoc/include/cpdf_filespec.h" +#include "core/fpdfdoc/include/cpdf_nametree.h" namespace { diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index 3fe182ae78..97acf2384f 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -6,8 +6,12 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfdoc/doc_utils.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/cpdf_pagelabel.h" +#include "core/fpdfdoc/include/cpdf_filespec.h" +#include "core/fpdfdoc/include/cpdf_nametree.h" +#include "core/fpdfdoc/include/ipdf_formnotify.h" namespace { diff --git a/core/fpdfdoc/doc_basic_unittest.cpp b/core/fpdfdoc/doc_basic_unittest.cpp index 5713a6debb..23e88385d1 100644 --- a/core/fpdfdoc/doc_basic_unittest.cpp +++ b/core/fpdfdoc/doc_basic_unittest.cpp @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/fpdfdoc/include/fpdf_doc.h" - #include #include +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfdoc/include/cpdf_filespec.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" diff --git a/core/fpdfdoc/doc_bookmark.cpp b/core/fpdfdoc/doc_bookmark.cpp index 2c6f0dddef..8a0054e98c 100644 --- a/core/fpdfdoc/doc_bookmark.cpp +++ b/core/fpdfdoc/doc_bookmark.cpp @@ -4,13 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfdoc/include/cpdf_bookmark.h" + #include #include #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_bookmarktree.h" +#include "core/fpdfdoc/include/cpdf_nametree.h" +#include "core/fxge/include/fx_dib.h" CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild( const CPDF_Bookmark& parent) const { diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index bad051ffb9..3dde448a24 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -12,8 +12,10 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfdoc/include/cpdf_filespec.h" +#include "core/fpdfdoc/include/cpdf_formcontrol.h" +#include "core/fpdfdoc/include/cpdf_interform.h" #include "core/fpdfdoc/doc_utils.h" -#include "core/fpdfdoc/include/fpdf_doc.h" #include "third_party/base/stl_util.h" namespace { diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp index 7e058ae310..932a006be5 100644 --- a/core/fpdfdoc/doc_formcontrol.cpp +++ b/core/fpdfdoc/doc_formcontrol.cpp @@ -4,14 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfdoc/include/cpdf_formcontrol.h" + #include #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_interform.h" namespace { diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp index 14497ef045..cb1b0a4566 100644 --- a/core/fpdfdoc/doc_formfield.cpp +++ b/core/fpdfdoc/doc_formfield.cpp @@ -4,18 +4,38 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfdoc/include/cpdf_formfield.h" + #include "core/fpdfapi/fpdf_parser/include/cfdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfdoc/cpvt_generateap.h" #include "core/fpdfdoc/doc_utils.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_formcontrol.h" +#include "core/fpdfdoc/include/cpdf_interform.h" namespace { +const int kFormListMultiSelect = 0x100; + +const int kFormComboEdit = 0x100; + +const int kFormFieldReadOnly = 0x01; +const int kFormFieldRequired = 0x02; +const int kFormFieldNoExport = 0x04; + +const int kFormRadioNoToggleOff = 0x100; +const int kFormRadioUnison = 0x200; + +const int kFormTextMultiLine = 0x100; +const int kFormTextPassword = 0x200; +const int kFormTextNoScroll = 0x400; +const int kFormTextComb = 0x800; + bool PDF_FormField_IsUnison(CPDF_FormField* pField) { if (pField->GetType() == CPDF_FormField::CheckBox) return true; @@ -45,22 +65,22 @@ void CPDF_FormField::SyncFieldFlags() { : 0; m_Flags = 0; if (flags & 1) { - m_Flags |= FORMFIELD_READONLY; + m_Flags |= kFormFieldReadOnly; } if (flags & 2) { - m_Flags |= FORMFIELD_REQUIRED; + m_Flags |= kFormFieldRequired; } if (flags & 4) { - m_Flags |= FORMFIELD_NOEXPORT; + m_Flags |= kFormFieldNoExport; } if (type_name == "Btn") { if (flags & 0x8000) { m_Type = RadioButton; if (flags & 0x4000) { - m_Flags |= FORMRADIO_NOTOGGLEOFF; + m_Flags |= kFormRadioNoToggleOff; } if (flags & 0x2000000) { - m_Flags |= FORMRADIO_UNISON; + m_Flags |= kFormRadioUnison; } } else if (flags & 0x10000) { m_Type = PushButton; @@ -75,16 +95,16 @@ void CPDF_FormField::SyncFieldFlags() { } else { m_Type = Text; if (flags & 0x1000) { - m_Flags |= FORMTEXT_MULTILINE; + m_Flags |= kFormTextMultiLine; } if (flags & 0x2000) { - m_Flags |= FORMTEXT_PASSWORD; + m_Flags |= kFormTextPassword; } if (flags & 0x800000) { - m_Flags |= FORMTEXT_NOSCROLL; + m_Flags |= kFormTextNoScroll; } if (flags & 0x100000) { - m_Flags |= FORMTEXT_COMB; + m_Flags |= kFormTextComb; } } LoadDA(); @@ -92,12 +112,12 @@ void CPDF_FormField::SyncFieldFlags() { if (flags & 0x20000) { m_Type = ComboBox; if (flags & 0x40000) { - m_Flags |= FORMCOMBO_EDIT; + m_Flags |= kFormComboEdit; } } else { m_Type = ListBox; if (flags & 0x200000) { - m_Flags |= FORMLIST_MULTISELECT; + m_Flags |= kFormListMultiSelect; } } LoadDA(); @@ -511,7 +531,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index, if (bSelected) { if (GetType() == ListBox) { SelectOption(index, TRUE); - if (!(m_Flags & FORMLIST_MULTISELECT)) { + if (!(m_Flags & kFormListMultiSelect)) { m_pDict->SetAtString("V", PDF_EncodeText(opt_value)); } else { CPDF_Array* pArray = new CPDF_Array; diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp index 5d21e1d9aa..aa4e761f6d 100644 --- a/core/fpdfdoc/doc_link.cpp +++ b/core/fpdfdoc/doc_link.cpp @@ -4,12 +4,14 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_link.h" #include #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfdoc/include/cpdf_linklist.h" +#include "core/fpdfdoc/include/cpdf_nametree.h" CPDF_LinkList::CPDF_LinkList() {} diff --git a/core/fpdfdoc/doc_metadata.cpp b/core/fpdfdoc/doc_metadata.cpp index f36250ab7a..6273a62bef 100644 --- a/core/fpdfdoc/doc_metadata.cpp +++ b/core/fpdfdoc/doc_metadata.cpp @@ -4,10 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfdoc/include/cpdf_metadata.h" + #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxcrt/include/fx_xml.h" CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) { diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp index 1251cb20e3..50bae65800 100644 --- a/core/fpdfdoc/doc_ocg.cpp +++ b/core/fpdfdoc/doc_ocg.cpp @@ -4,11 +4,12 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfdoc/include/cpdf_occontext.h" + #include "core/fpdfapi/fpdf_page/cpdf_contentmarkdata.h" #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfdoc/include/fpdf_doc.h" namespace { diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index 7f79a34245..284520d150 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -11,8 +11,11 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfdoc/doc_utils.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_defaultappearance.h" +#include "core/fpdfdoc/include/cpdf_formcontrol.h" +#include "core/fpdfdoc/include/cpdf_interform.h" #include "core/fxge/include/fx_font.h" namespace { diff --git a/core/fpdfdoc/doc_viewerPreferences.cpp b/core/fpdfdoc/doc_viewerPreferences.cpp index 1de8c92614..3fe638d4f5 100644 --- a/core/fpdfdoc/doc_viewerPreferences.cpp +++ b/core/fpdfdoc/doc_viewerPreferences.cpp @@ -4,8 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfdoc/include/cpdf_viewerpreferences.h" + #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfdoc/include/fpdf_doc.h" CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc) : m_pDoc(pDoc) {} diff --git a/core/fpdfdoc/include/cpdf_aaction.h b/core/fpdfdoc/include/cpdf_aaction.h new file mode 100644 index 0000000000..b3a55da23e --- /dev/null +++ b/core/fpdfdoc/include/cpdf_aaction.h @@ -0,0 +1,51 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_AACTION_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_AACTION_H_ + +#include "core/fpdfdoc/include/cpdf_action.h" + +class CPDF_Dictionary; + +class CPDF_AAction { + public: + enum AActionType { + CursorEnter = 0, + CursorExit, + ButtonDown, + ButtonUp, + GetFocus, + LoseFocus, + PageOpen, + PageClose, + PageVisible, + PageInvisible, + OpenPage, + ClosePage, + KeyStroke, + Format, + Validate, + Calculate, + CloseDocument, + SaveDocument, + DocumentSaved, + PrintDocument, + DocumentPrinted + }; + + CPDF_AAction() : m_pDict(nullptr) {} + explicit CPDF_AAction(CPDF_Dictionary* pDict) : m_pDict(pDict) {} + + FX_BOOL ActionExist(AActionType eType) const; + CPDF_Action GetAction(AActionType eType) const; + CPDF_Dictionary* GetDict() const { return m_pDict; } + + private: + CPDF_Dictionary* const m_pDict; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_AACTION_H_ diff --git a/core/fpdfdoc/include/cpdf_action.h b/core/fpdfdoc/include/cpdf_action.h new file mode 100644 index 0000000000..90e33015e7 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_action.h @@ -0,0 +1,59 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_ACTION_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_ACTION_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfdoc/include/cpdf_dest.h" +#include "core/fxcrt/include/fx_string.h" + +class CPDF_Document; + +class CPDF_Action { + public: + enum ActionType { + Unknown = 0, + GoTo, + GoToR, + GoToE, + Launch, + Thread, + URI, + Sound, + Movie, + Hide, + Named, + SubmitForm, + ResetForm, + ImportData, + JavaScript, + SetOCGState, + Rendition, + Trans, + GoTo3DView + }; + + CPDF_Action() : m_pDict(nullptr) {} + explicit CPDF_Action(CPDF_Dictionary* pDict) : m_pDict(pDict) {} + + CPDF_Dictionary* GetDict() const { return m_pDict; } + ActionType GetType() const; + CPDF_Dest GetDest(CPDF_Document* pDoc) const; + CFX_WideString GetFilePath() const; + CFX_ByteString GetURI(CPDF_Document* pDoc) const; + bool GetHideStatus() const { return m_pDict->GetBooleanBy("H", true); } + CFX_ByteString GetNamedAction() const { return m_pDict->GetStringBy("N"); } + uint32_t GetFlags() const { return m_pDict->GetIntegerBy("Flags"); } + CFX_WideString GetJavaScript() const; + size_t GetSubActionsCount() const; + CPDF_Action GetSubAction(size_t iIndex) const; + + private: + CPDF_Dictionary* const m_pDict; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_ACTION_H_ diff --git a/core/fpdfdoc/include/cpdf_actionfields.h b/core/fpdfdoc/include/cpdf_actionfields.h new file mode 100644 index 0000000000..ad7962b761 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_actionfields.h @@ -0,0 +1,27 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_ACTIONFIELDS_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_ACTIONFIELDS_H_ + +#include + +class CPDF_Action; +class CPDF_Object; + +class CPDF_ActionFields { + public: + explicit CPDF_ActionFields(const CPDF_Action* pAction) : m_pAction(pAction) {} + + size_t GetFieldsCount() const; + std::vector GetAllFields() const; + CPDF_Object* GetField(size_t iIndex) const; + + private: + const CPDF_Action* const m_pAction; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_ACTIONFIELDS_H_ diff --git a/core/fpdfdoc/include/cpdf_annot.h b/core/fpdfdoc/include/cpdf_annot.h new file mode 100644 index 0000000000..99efd98886 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_annot.h @@ -0,0 +1,73 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ + +#include +#include + +#include "core/fxcrt/include/fx_coordinates.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CFX_RenderDevice; +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_Form; +class CPDF_Page; +class CPDF_RenderContext; +class CPDF_RenderOptions; +class CPDF_Stream; + +#define ANNOTFLAG_INVISIBLE 0x0001 +#define ANNOTFLAG_HIDDEN 0x0002 +#define ANNOTFLAG_PRINT 0x0004 +#define ANNOTFLAG_NOZOOM 0x0008 +#define ANNOTFLAG_NOROTATE 0x0010 +#define ANNOTFLAG_NOVIEW 0x0020 +#define ANNOTFLAG_READONLY 0x0040 +#define ANNOTFLAG_LOCKED 0x0080 +#define ANNOTFLAG_TOGGLENOVIEW 0x0100 + +class CPDF_Annot { + public: + enum AppearanceMode { Normal, Rollover, Down }; + + CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument); + ~CPDF_Annot(); + + CFX_ByteString GetSubType() const; + uint32_t GetFlags() const; + void GetRect(CFX_FloatRect& rect) const; + const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } + CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } + FX_BOOL DrawAppearance(CPDF_Page* pPage, + CFX_RenderDevice* pDevice, + const CFX_Matrix* pUser2Device, + AppearanceMode mode, + const CPDF_RenderOptions* pOptions); + FX_BOOL DrawInContext(const CPDF_Page* pPage, + CPDF_RenderContext* pContext, + const CFX_Matrix* pUser2Device, + AppearanceMode mode); + void ClearCachedAP(); + void DrawBorder(CFX_RenderDevice* pDevice, + const CFX_Matrix* pUser2Device, + const CPDF_RenderOptions* pOptions); + CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); + + private: + CPDF_Dictionary* const m_pAnnotDict; + CPDF_Document* const m_pDocument; + const CFX_ByteString m_sSubtype; + std::map> m_APMap; +}; + +CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, + CPDF_Annot::AppearanceMode mode); + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ diff --git a/core/fpdfdoc/include/cpdf_annotlist.h b/core/fpdfdoc/include/cpdf_annotlist.h new file mode 100644 index 0000000000..f76ec64cd9 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_annotlist.h @@ -0,0 +1,64 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_ANNOTLIST_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_ANNOTLIST_H_ + +#include +#include + +#include "core/fxcrt/include/fx_coordinates.h" +#include "core/fxcrt/include/fx_system.h" + +class CFX_RenderDevice; +class CPDF_Annot; +class CPDF_Document; +class CPDF_Page; +class CPDF_RenderContext; +class CPDF_RenderOptions; + +class CPDF_AnnotList { + public: + explicit CPDF_AnnotList(CPDF_Page* pPage); + ~CPDF_AnnotList(); + + void DisplayAnnots(CPDF_Page* pPage, + CPDF_RenderContext* pContext, + FX_BOOL bPrinting, + CFX_Matrix* pMatrix, + FX_BOOL bShowWidget, + CPDF_RenderOptions* pOptions); + + void DisplayAnnots(CPDF_Page* pPage, + CFX_RenderDevice* pDevice, + CPDF_RenderContext* pContext, + FX_BOOL bPrinting, + CFX_Matrix* pMatrix, + uint32_t dwAnnotFlags, + CPDF_RenderOptions* pOptions, + FX_RECT* pClipRect); + + size_t Count() const { return m_AnnotList.size(); } + CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index].get(); } + const std::vector>& All() const { + return m_AnnotList; + } + + private: + void DisplayPass(CPDF_Page* pPage, + CFX_RenderDevice* pDevice, + CPDF_RenderContext* pContext, + FX_BOOL bPrinting, + CFX_Matrix* pMatrix, + FX_BOOL bWidget, + CPDF_RenderOptions* pOptions, + FX_RECT* clip_rect); + + CPDF_Document* const m_pDocument; + std::vector> m_AnnotList; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_ANNOTLIST_H_ diff --git a/core/fpdfdoc/include/cpdf_bookmark.h b/core/fpdfdoc/include/cpdf_bookmark.h new file mode 100644 index 0000000000..ba0b059572 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_bookmark.h @@ -0,0 +1,33 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_BOOKMARK_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_BOOKMARK_H_ + +#include "core/fpdfdoc/include/cpdf_action.h" +#include "core/fpdfdoc/include/cpdf_dest.h" +#include "core/fxcrt/include/fx_string.h" + +class CPDF_Dictionary; +class CPDF_Document; + +class CPDF_Bookmark { + public: + CPDF_Bookmark() : m_pDict(nullptr) {} + explicit CPDF_Bookmark(CPDF_Dictionary* pDict) : m_pDict(pDict) {} + + CPDF_Dictionary* GetDict() const { return m_pDict; } + uint32_t GetColorRef() const; + uint32_t GetFontStyle() const; + CFX_WideString GetTitle() const; + CPDF_Dest GetDest(CPDF_Document* pDocument) const; + CPDF_Action GetAction() const; + + private: + CPDF_Dictionary* m_pDict; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_BOOKMARK_H_ diff --git a/core/fpdfdoc/include/cpdf_bookmarktree.h b/core/fpdfdoc/include/cpdf_bookmarktree.h new file mode 100644 index 0000000000..f496053383 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_bookmarktree.h @@ -0,0 +1,26 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_BOOKMARKTREE_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_BOOKMARKTREE_H_ + +#include "core/fpdfdoc/include/cpdf_bookmark.h" + +class CPDF_Document; + +class CPDF_BookmarkTree { + public: + explicit CPDF_BookmarkTree(CPDF_Document* pDoc) : m_pDocument(pDoc) {} + + CPDF_Bookmark GetFirstChild(const CPDF_Bookmark& parent) const; + CPDF_Bookmark GetNextSibling(const CPDF_Bookmark& bookmark) const; + CPDF_Document* GetDocument() const { return m_pDocument; } + + private: + CPDF_Document* const m_pDocument; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_BOOKMARKTREE_H_ diff --git a/core/fpdfdoc/include/cpdf_defaultappearance.h b/core/fpdfdoc/include/cpdf_defaultappearance.h new file mode 100644 index 0000000000..c45d4eeffc --- /dev/null +++ b/core/fpdfdoc/include/cpdf_defaultappearance.h @@ -0,0 +1,50 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_DEFAULTAPPEARANCE_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_DEFAULTAPPEARANCE_H_ + +#include "core/fpdfdoc/include/cpdf_defaultappearance.h" +#include "core/fxcrt/include/fx_coordinates.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" +#include "core/fxge/include/fx_dib.h" + +enum class BorderStyle { SOLID, DASH, BEVELED, INSET, UNDERLINE }; + +class CPDF_DefaultAppearance { + public: + CPDF_DefaultAppearance() {} + explicit CPDF_DefaultAppearance(const CFX_ByteString& csDA) : m_csDA(csDA) {} + + CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) { + m_csDA = cDA.GetStr(); + } + + CFX_ByteString GetStr() const { return m_csDA; } + + FX_BOOL HasFont(); + CFX_ByteString GetFontString(); + void GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize); + + FX_BOOL HasColor(FX_BOOL bStrokingOperation = FALSE); + CFX_ByteString GetColorString(FX_BOOL bStrokingOperation = FALSE); + void GetColor(int& iColorType, + FX_FLOAT fc[4], + FX_BOOL bStrokingOperation = FALSE); + void GetColor(FX_ARGB& color, + int& iColorType, + FX_BOOL bStrokingOperation = FALSE); + + FX_BOOL HasTextMatrix(); + CFX_ByteString GetTextMatrixString(); + CFX_Matrix GetTextMatrix(); + + private: + CFX_ByteString m_csDA; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_DEFAULTAPPEARANCE_H_ diff --git a/core/fpdfdoc/include/cpdf_dest.h b/core/fpdfdoc/include/cpdf_dest.h new file mode 100644 index 0000000000..82d8a2b5cf --- /dev/null +++ b/core/fpdfdoc/include/cpdf_dest.h @@ -0,0 +1,32 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_DEST_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_DEST_H_ + +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_Document; +class CPDF_Object; + +class CPDF_Dest { + public: + CPDF_Dest() : m_pObj(nullptr) {} + explicit CPDF_Dest(CPDF_Object* pObj) : m_pObj(pObj) {} + + CPDF_Object* GetObject() const { return m_pObj; } + CFX_ByteString GetRemoteName(); + int GetPageIndex(CPDF_Document* pDoc); + uint32_t GetPageObjNum(); + int GetZoomMode(); + FX_FLOAT GetParam(int index); + + private: + CPDF_Object* m_pObj; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_DEST_H_ diff --git a/core/fpdfdoc/include/cpdf_docjsactions.h b/core/fpdfdoc/include/cpdf_docjsactions.h new file mode 100644 index 0000000000..137b6afd53 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_docjsactions.h @@ -0,0 +1,29 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_DOCJSACTIONS_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_DOCJSACTIONS_H_ + +#include "core/fpdfdoc/include/cpdf_action.h" +#include "core/fxcrt/include/fx_string.h" + +class CPDF_Document; + +class CPDF_DocJSActions { + public: + explicit CPDF_DocJSActions(CPDF_Document* pDoc); + + int CountJSActions() const; + CPDF_Action GetJSAction(int index, CFX_ByteString& csName) const; + CPDF_Action GetJSAction(const CFX_ByteString& csName) const; + int FindJSAction(const CFX_ByteString& csName) const; + CPDF_Document* GetDocument() const { return m_pDocument; } + + private: + CPDF_Document* const m_pDocument; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_DOCJSACTIONS_H_ diff --git a/core/fpdfdoc/include/cpdf_filespec.h b/core/fpdfdoc/include/cpdf_filespec.h new file mode 100644 index 0000000000..06badbaa5e --- /dev/null +++ b/core/fpdfdoc/include/cpdf_filespec.h @@ -0,0 +1,35 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_FILESPEC_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_FILESPEC_H_ + +#include "core/fxcrt/include/fx_string.h" + +class CPDF_Object; + +class CPDF_FileSpec { + public: + CPDF_FileSpec(); + explicit CPDF_FileSpec(CPDF_Object* pObj) : m_pObj(pObj) {} + + // Convert a platform dependent file name into pdf format. + static CFX_WideString EncodeFileName(const CFX_WideStringC& filepath); + + // Convert a pdf file name into platform dependent format. + static CFX_WideString DecodeFileName(const CFX_WideStringC& filepath); + + CPDF_Object* GetObj() const { return m_pObj; } + bool GetFileName(CFX_WideString* wsFileName) const; + + // Set this file spec to refer to a file name (not a url). + void SetFileName(const CFX_WideStringC& wsFileName); + + private: + CPDF_Object* m_pObj; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_FILESPEC_H_ diff --git a/core/fpdfdoc/include/cpdf_formcontrol.h b/core/fpdfdoc/include/cpdf_formcontrol.h new file mode 100644 index 0000000000..cf246bd878 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_formcontrol.h @@ -0,0 +1,134 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_FORMCONTROL_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_FORMCONTROL_H_ + +#include "core/fpdfdoc/cpdf_apsettings.h" +#include "core/fpdfdoc/include/cpdf_aaction.h" +#include "core/fpdfdoc/include/cpdf_action.h" +#include "core/fpdfdoc/include/cpdf_annot.h" +#include "core/fpdfdoc/include/cpdf_annotlist.h" +#include "core/fpdfdoc/include/cpdf_defaultappearance.h" +#include "core/fpdfdoc/include/cpdf_formfield.h" +#include "core/fpdfdoc/include/cpdf_iconfit.h" +#include "core/fpdfdoc/include/ipdf_formnotify.h" +#include "core/fxcrt/include/fx_coordinates.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxge/include/fx_dib.h" + +#define TEXTPOS_CAPTION 0 +#define TEXTPOS_ICON 1 +#define TEXTPOS_BELOW 2 +#define TEXTPOS_ABOVE 3 +#define TEXTPOS_RIGHT 4 +#define TEXTPOS_LEFT 5 +#define TEXTPOS_OVERLAID 6 + +#define COLORTYPE_TRANSPARENT 0 +#define COLORTYPE_GRAY 1 +#define COLORTYPE_RGB 2 +#define COLORTYPE_CMYK 3 + +class CFX_RenderDevice; +class CPDF_Dictionary; +class CPDF_Font; +class CPDF_FormField; +class CPDF_InterForm; +class CPDF_OCContext; +class CPDF_RenderOptions; +class CPDF_Stream; + +class CPDF_FormControl { + public: + enum HighlightingMode { None = 0, Invert, Outline, Push, Toggle }; + + CPDF_FormField::Type GetType() const { return m_pField->GetType(); } + CPDF_InterForm* GetInterForm() const { return m_pForm; } + CPDF_FormField* GetField() const { return m_pField; } + CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; } + CFX_FloatRect GetRect() const { return m_pWidgetDict->GetRectBy("Rect"); } + + void DrawControl(CFX_RenderDevice* pDevice, + CFX_Matrix* pMatrix, + CPDF_Page* pPage, + CPDF_Annot::AppearanceMode mode, + const CPDF_RenderOptions* pOptions = nullptr); + + CFX_ByteString GetCheckedAPState(); + CFX_WideString GetExportValue() const; + + bool IsChecked() const; + bool IsDefaultChecked() const; + + HighlightingMode GetHighlightingMode(); + bool HasMKEntry(const CFX_ByteString& csEntry) const; + int GetRotation(); + + FX_ARGB GetBorderColor(int& iColorType) { return GetColor(iColorType, "BC"); } + + FX_FLOAT GetOriginalBorderColor(int index) { + return GetOriginalColor(index, "BC"); + } + + void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) { + GetOriginalColor(iColorType, fc, "BC"); + } + + FX_ARGB GetBackgroundColor(int& iColorType) { + return GetColor(iColorType, "BG"); + } + + FX_FLOAT GetOriginalBackgroundColor(int index) { + return GetOriginalColor(index, "BG"); + } + + void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) { + GetOriginalColor(iColorType, fc, "BG"); + } + + CFX_WideString GetNormalCaption() { return GetCaption("CA"); } + CFX_WideString GetRolloverCaption() { return GetCaption("RC"); } + CFX_WideString GetDownCaption() { return GetCaption("AC"); } + + CPDF_Stream* GetNormalIcon() { return GetIcon("I"); } + CPDF_Stream* GetRolloverIcon() { return GetIcon("RI"); } + CPDF_Stream* GetDownIcon() { return GetIcon("IX"); } + CPDF_IconFit GetIconFit(); + + int GetTextPosition(); + CPDF_Action GetAction(); + CPDF_AAction GetAdditionalAction(); + CPDF_DefaultAppearance GetDefaultAppearance(); + + CPDF_Font* GetDefaultControlFont(); + int GetControlAlignment(); + + private: + friend class CPDF_InterForm; + friend class CPDF_FormField; + + CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict); + + CFX_ByteString GetOnStateName() const; + void SetOnStateName(const CFX_ByteString& csOn); + void CheckControl(FX_BOOL bChecked); + FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry); + FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry); + void GetOriginalColor(int& iColorType, + FX_FLOAT fc[4], + const CFX_ByteString& csEntry); + + CFX_WideString GetCaption(const CFX_ByteString& csEntry); + CPDF_Stream* GetIcon(const CFX_ByteString& csEntry); + CPDF_ApSettings GetMK() const; + + CPDF_FormField* const m_pField; + CPDF_Dictionary* const m_pWidgetDict; + CPDF_InterForm* const m_pForm; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_FORMCONTROL_H_ diff --git a/core/fpdfdoc/include/cpdf_formfield.h b/core/fpdfdoc/include/cpdf_formfield.h new file mode 100644 index 0000000000..3d9d88fb6b --- /dev/null +++ b/core/fpdfdoc/include/cpdf_formfield.h @@ -0,0 +1,167 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_FORMFIELD_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_FORMFIELD_H_ + +#include "core/fpdfdoc/include/cpdf_aaction.h" +#include "core/fpdfdoc/include/cpdf_formfield.h" +#include "core/fxcrt/include/fx_basic.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +#define FIELDTYPE_UNKNOWN 0 +#define FIELDTYPE_PUSHBUTTON 1 +#define FIELDTYPE_CHECKBOX 2 +#define FIELDTYPE_RADIOBUTTON 3 +#define FIELDTYPE_COMBOBOX 4 +#define FIELDTYPE_LISTBOX 5 +#define FIELDTYPE_TEXTFIELD 6 +#define FIELDTYPE_SIGNATURE 7 + +class CPDF_Dictionary; +class CPDF_Font; +class CPDF_FormControl; +class CPDF_InterForm; +class CPDF_String; + +CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, + const FX_CHAR* name, + int nLevel = 0); + +class CPDF_FormField { + public: + enum Type { + Unknown, + PushButton, + RadioButton, + CheckBox, + Text, + RichText, + File, + ListBox, + ComboBox, + Sign + }; + + CFX_WideString GetFullName() const; + + Type GetType() const { return m_Type; } + uint32_t GetFlags() const { return m_Flags; } + + CPDF_Dictionary* GetFieldDict() const { return m_pDict; } + void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } + + FX_BOOL ResetField(FX_BOOL bNotify = FALSE); + + int CountControls() const { return m_ControlList.GetSize(); } + + CPDF_FormControl* GetControl(int index) const { + return m_ControlList.GetAt(index); + } + + int GetControlIndex(const CPDF_FormControl* pControl) const; + int GetFieldType() const; + + CPDF_AAction GetAdditionalAction() const; + CFX_WideString GetAlternateName() const; + CFX_WideString GetMappingName() const; + + uint32_t GetFieldFlags() const; + CFX_ByteString GetDefaultStyle() const; + CFX_WideString GetRichTextString() const; + + CFX_WideString GetValue() const; + CFX_WideString GetDefaultValue() const; + FX_BOOL SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE); + + int GetMaxLen() const; + int CountSelectedItems() const; + int GetSelectedIndex(int index) const; + + FX_BOOL ClearSelection(FX_BOOL bNotify = FALSE); + FX_BOOL IsItemSelected(int index) const; + FX_BOOL SetItemSelection(int index, + FX_BOOL bSelected, + FX_BOOL bNotify = FALSE); + + FX_BOOL IsItemDefaultSelected(int index) const; + + int GetDefaultSelectedItem() const; + int CountOptions() const; + + CFX_WideString GetOptionLabel(int index) const; + CFX_WideString GetOptionValue(int index) const; + + int FindOption(CFX_WideString csOptLabel) const; + int FindOptionValue(const CFX_WideString& csOptValue) const; + + FX_BOOL CheckControl(int iControlIndex, bool bChecked, bool bNotify = false); + + int GetTopVisibleIndex() const; + int CountSelectedOptions() const; + + int GetSelectedOptionIndex(int index) const; + FX_BOOL IsOptionSelected(int iOptIndex) const; + + FX_BOOL SelectOption(int iOptIndex, + FX_BOOL bSelected, + FX_BOOL bNotify = FALSE); + + FX_BOOL ClearSelectedOptions(FX_BOOL bNotify = FALSE); + +#ifdef PDF_ENABLE_XFA + FX_BOOL ClearOptions(FX_BOOL bNotify = FALSE); + + int InsertOption(CFX_WideString csOptLabel, + int index = -1, + FX_BOOL bNotify = FALSE); +#endif // PDF_ENABLE_XFA + + FX_FLOAT GetFontSize() const { return m_FontSize; } + CPDF_Font* GetFont() const { return m_pFont; } + + private: + friend class CPDF_InterForm; + friend class CPDF_FormControl; + + CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict); + ~CPDF_FormField(); + + CFX_WideString GetValue(FX_BOOL bDefault) const; + FX_BOOL SetValue(const CFX_WideString& value, + FX_BOOL bDefault, + FX_BOOL bNotify); + + void SyncFieldFlags(); + int FindListSel(CPDF_String* str); + CFX_WideString GetOptionText(int index, int sub_index) const; + + void LoadDA(); + CFX_WideString GetCheckValue(FX_BOOL bDefault) const; + FX_BOOL SetCheckValue(const CFX_WideString& value, + FX_BOOL bDefault, + FX_BOOL bNotify); + + bool NotifyBeforeSelectionChange(const CFX_WideString& value); + void NotifyAfterSelectionChange(); + + bool NotifyBeforeValueChange(const CFX_WideString& value); + void NotifyAfterValueChange(); + + bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value); + void NotifyListOrComboBoxAfterChange(); + + CPDF_FormField::Type m_Type; + uint32_t m_Flags; + CPDF_InterForm* m_pForm; + CPDF_Dictionary* m_pDict; + CFX_ArrayTemplate m_ControlList; + FX_FLOAT m_FontSize; + CPDF_Font* m_pFont; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_FORMFIELD_H_ diff --git a/core/fpdfdoc/include/cpdf_iconfit.h b/core/fpdfdoc/include/cpdf_iconfit.h new file mode 100644 index 0000000000..a13730d8ce --- /dev/null +++ b/core/fpdfdoc/include/cpdf_iconfit.h @@ -0,0 +1,30 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_ICONFIT_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_ICONFIT_H_ + +#include "core/fxcrt/include/fx_system.h" + +class CPDF_Dictionary; + +class CPDF_IconFit { + public: + enum ScaleMethod { Always = 0, Bigger, Smaller, Never }; + + explicit CPDF_IconFit(const CPDF_Dictionary* pDict) : m_pDict(pDict) {} + + ScaleMethod GetScaleMethod(); + FX_BOOL IsProportionalScale(); + void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); + bool GetFittingBounds(); + const CPDF_Dictionary* GetDict() const { return m_pDict; } + + private: + const CPDF_Dictionary* const m_pDict; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_ICONFIT_H_ diff --git a/core/fpdfdoc/include/cpdf_interform.h b/core/fpdfdoc/include/cpdf_interform.h new file mode 100644 index 0000000000..f07172c42b --- /dev/null +++ b/core/fpdfdoc/include/cpdf_interform.h @@ -0,0 +1,155 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_INTERFORM_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_INTERFORM_H_ + +#include +#include +#include + +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfdoc/include/cpdf_defaultappearance.h" +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CFieldTree; +class CFDF_Document; +class CPDF_Document; +class CPDF_Dictionary; +class CPDF_Font; +class CPDF_FormControl; +class CPDF_FormField; +class CPDF_Object; +class CPDF_Page; +class IPDF_FormNotify; + +class CPDF_InterForm { + public: + explicit CPDF_InterForm(CPDF_Document* pDocument); + ~CPDF_InterForm(); + + static void SetUpdateAP(FX_BOOL bUpdateAP); + static FX_BOOL IsUpdateAPEnabled(); + static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict, + const FX_CHAR* csType, + int iMinLen = 2, + const FX_CHAR* csPrefix = ""); + static CPDF_Font* AddStandardFont(CPDF_Document* pDocument, + CFX_ByteString csFontName); + static CFX_ByteString GetNativeFont(uint8_t iCharSet, + void* pLogFont = nullptr); + static CFX_ByteString GetNativeFont(void* pLogFont = nullptr); + static uint8_t GetNativeCharSet(); + static CPDF_Font* AddNativeFont(uint8_t iCharSet, CPDF_Document* pDocument); + static CPDF_Font* AddNativeFont(CPDF_Document* pDocument); + + FX_BOOL ValidateFieldName(CFX_WideString& csNewFieldName, int iType); + FX_BOOL ValidateFieldName(const CPDF_FormField* pField, + CFX_WideString& csNewFieldName); + FX_BOOL ValidateFieldName(const CPDF_FormControl* pControl, + CFX_WideString& csNewFieldName); + + uint32_t CountFields(const CFX_WideString& csFieldName = L""); + CPDF_FormField* GetField(uint32_t index, + const CFX_WideString& csFieldName = L""); + CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const; + + CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage, + FX_FLOAT pdf_x, + FX_FLOAT pdf_y, + int* z_order) const; + CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const; + + CPDF_Document* GetDocument() const { return m_pDocument; } + CPDF_Dictionary* GetFormDict() const { return m_pFormDict; } + FX_BOOL NeedConstructAP() const; + int CountFieldsInCalculationOrder(); + CPDF_FormField* GetFieldInCalculationOrder(int index); + int FindFieldInCalculationOrder(const CPDF_FormField* pField); + + uint32_t CountFormFonts(); + CPDF_Font* GetFormFont(uint32_t index, CFX_ByteString& csNameTag); + CPDF_Font* GetFormFont(CFX_ByteString csNameTag); + CPDF_Font* GetFormFont(CFX_ByteString csFontName, CFX_ByteString& csNameTag); + CPDF_Font* GetNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); + CPDF_Font* GetNativeFormFont(CFX_ByteString& csNameTag); + FX_BOOL FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); + FX_BOOL FindFormFont(CFX_ByteString csFontName, + CPDF_Font*& pFont, + CFX_ByteString& csNameTag); + + FX_BOOL FindFormFont(CFX_WideString csFontName, + CPDF_Font*& pFont, + CFX_ByteString& csNameTag) { + return FindFormFont(PDF_EncodeText(csFontName), pFont, csNameTag); + } + + void AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); + CPDF_Font* AddNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); + CPDF_Font* AddNativeFormFont(CFX_ByteString& csNameTag); + + void RemoveFormFont(const CPDF_Font* pFont); + void RemoveFormFont(CFX_ByteString csNameTag); + + CPDF_DefaultAppearance GetDefaultAppearance(); + CPDF_Font* GetDefaultFormFont(); + int GetFormAlignment(); + + CPDF_FormField* CheckRequiredFields( + const std::vector* fields, + bool bIncludeOrExclude) const; + + CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, + bool bSimpleFileSpec = false) const; + CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, + const std::vector& fields, + bool bIncludeOrExclude = true, + bool bSimpleFileSpec = false) const; + FX_BOOL ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE); + + bool ResetForm(const std::vector& fields, + bool bIncludeOrExclude = true, + bool bNotify = false); + bool ResetForm(bool bNotify = false); + + void SetFormNotify(IPDF_FormNotify* pNotify); + FX_BOOL HasXFAForm() const; + void FixPageFields(const CPDF_Page* pPage); + + private: + friend class CPDF_FormControl; + friend class CPDF_FormField; + + void LoadField(CPDF_Dictionary* pFieldDict, int nLevel = 0); + CPDF_Object* GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name); + CPDF_FormField* AddTerminalField(CPDF_Dictionary* pFieldDict); + CPDF_FormControl* AddControl(CPDF_FormField* pField, + CPDF_Dictionary* pWidgetDict); + void FDF_ImportField(CPDF_Dictionary* pField, + const CFX_WideString& parent_name, + FX_BOOL bNotify = FALSE, + int nLevel = 0); + FX_BOOL ValidateFieldName(CFX_WideString& csNewFieldName, + int iType, + const CPDF_FormField* pExcludedField, + const CPDF_FormControl* pExcludedControl); + int CompareFieldName(const CFX_WideString& name1, + const CFX_WideString& name2); + int CompareFieldName(const CFX_ByteString& name1, + const CFX_ByteString& name2); + + static FX_BOOL s_bUpdateAP; + + CPDF_Document* const m_pDocument; + CPDF_Dictionary* m_pFormDict; + std::map m_ControlMap; + std::unique_ptr m_pFieldTree; + CFX_ByteString m_bsEncoding; + IPDF_FormNotify* m_pFormNotify; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_INTERFORM_H_ diff --git a/core/fpdfdoc/include/cpdf_link.h b/core/fpdfdoc/include/cpdf_link.h new file mode 100644 index 0000000000..a3be3ccc90 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_link.h @@ -0,0 +1,31 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_LINK_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_LINK_H_ + +#include "core/fpdfdoc/include/cpdf_action.h" +#include "core/fpdfdoc/include/cpdf_dest.h" +#include "core/fxcrt/include/fx_coordinates.h" + +class CPDF_Dictionary; + +class CPDF_Link { + public: + CPDF_Link() : m_pDict(nullptr) {} + explicit CPDF_Link(CPDF_Dictionary* pDict) : m_pDict(pDict) {} + + CPDF_Dictionary* GetDict() const { return m_pDict; } + + CFX_FloatRect GetRect(); + CPDF_Dest GetDest(CPDF_Document* pDoc); + CPDF_Action GetAction(); + + private: + CPDF_Dictionary* m_pDict; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_LINK_H_ diff --git a/core/fpdfdoc/include/cpdf_linklist.h b/core/fpdfdoc/include/cpdf_linklist.h new file mode 100644 index 0000000000..dd9f5517d4 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_linklist.h @@ -0,0 +1,36 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_LINKLIST_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_LINKLIST_H_ + +#include +#include + +#include "core/fpdfdoc/include/cpdf_link.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_Page; +class CPDF_Dictionary; + +class CPDF_LinkList { + public: + CPDF_LinkList(); + ~CPDF_LinkList(); + + CPDF_Link GetLinkAtPoint(CPDF_Page* pPage, + FX_FLOAT pdf_x, + FX_FLOAT pdf_y, + int* z_order); + + private: + const std::vector* GetPageLinks(CPDF_Page* pPage); + void LoadPageLinks(CPDF_Page* pPage, std::vector* pList); + + std::map> m_PageMap; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_LINKLIST_H_ diff --git a/core/fpdfdoc/include/cpdf_metadata.h b/core/fpdfdoc/include/cpdf_metadata.h new file mode 100644 index 0000000000..31497dd33c --- /dev/null +++ b/core/fpdfdoc/include/cpdf_metadata.h @@ -0,0 +1,26 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_METADATA_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_METADATA_H_ + +#include + +class CPDF_Document; +class CXML_Element; + +class CPDF_Metadata { + public: + explicit CPDF_Metadata(CPDF_Document* pDoc); + ~CPDF_Metadata(); + + const CXML_Element* GetRoot() const; + + private: + std::unique_ptr m_pXmlElement; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_METADATA_H_ diff --git a/core/fpdfdoc/include/cpdf_nametree.h b/core/fpdfdoc/include/cpdf_nametree.h new file mode 100644 index 0000000000..39a520ddfa --- /dev/null +++ b/core/fpdfdoc/include/cpdf_nametree.h @@ -0,0 +1,34 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_NAMETREE_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_NAMETREE_H_ + +#include "core/fxcrt/include/fx_string.h" + +class CPDF_Array; +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_Object; + +class CPDF_NameTree { + public: + explicit CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {} + CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteString& category); + + CPDF_Object* LookupValue(int nIndex, CFX_ByteString& csName) const; + CPDF_Object* LookupValue(const CFX_ByteString& csName) const; + CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const CFX_ByteString& sName); + + int GetIndex(const CFX_ByteString& csName) const; + size_t GetCount() const; + CPDF_Dictionary* GetRoot() const { return m_pRoot; } + + private: + CPDF_Dictionary* m_pRoot; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_NAMETREE_H_ diff --git a/core/fpdfdoc/include/cpdf_occontext.h b/core/fpdfdoc/include/cpdf_occontext.h new file mode 100644 index 0000000000..38e81705e5 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_occontext.h @@ -0,0 +1,42 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_OCCONTEXT_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_OCCONTEXT_H_ + +#include + +#include "core/fxcrt/include/fx_string.h" + +class CPDF_Array; +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_PageObject; + +class CPDF_OCContext { + public: + enum UsageType { View = 0, Design, Print, Export }; + + CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType); + ~CPDF_OCContext(); + + bool CheckOCGVisible(const CPDF_Dictionary* pOCGDict); + bool CheckObjectVisible(const CPDF_PageObject* pObj); + + private: + bool LoadOCGStateFromConfig(const CFX_ByteString& csConfig, + const CPDF_Dictionary* pOCGDict) const; + bool LoadOCGState(const CPDF_Dictionary* pOCGDict) const; + bool GetOCGVisible(const CPDF_Dictionary* pOCGDict); + bool GetOCGVE(CPDF_Array* pExpression, int nLevel); + bool LoadOCMDState(const CPDF_Dictionary* pOCMDDict); + + CPDF_Document* const m_pDocument; + const UsageType m_eUsageType; + std::unordered_map m_OCGStates; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_OCCONTEXT_H_ diff --git a/core/fpdfdoc/include/cpdf_viewerpreferences.h b/core/fpdfdoc/include/cpdf_viewerpreferences.h new file mode 100644 index 0000000000..d93c261183 --- /dev/null +++ b/core/fpdfdoc/include/cpdf_viewerpreferences.h @@ -0,0 +1,34 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_CPDF_VIEWERPREFERENCES_H_ +#define CORE_FPDFDOC_INCLUDE_CPDF_VIEWERPREFERENCES_H_ + +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" + +class CPDF_Array; +class CPDF_Dictionary; +class CPDF_Document; + +class CPDF_ViewerPreferences { + public: + explicit CPDF_ViewerPreferences(CPDF_Document* pDoc); + ~CPDF_ViewerPreferences(); + + FX_BOOL IsDirectionR2L() const; + FX_BOOL PrintScaling() const; + int32_t NumCopies() const; + CPDF_Array* PrintPageRange() const; + CFX_ByteString Duplex() const; + + private: + CPDF_Dictionary* GetViewerPreferences() const; + + CPDF_Document* const m_pDoc; +}; + +#endif // CORE_FPDFDOC_INCLUDE_CPDF_VIEWERPREFERENCES_H_ diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h deleted file mode 100644 index edcec239f6..0000000000 --- a/core/fpdfdoc/include/fpdf_doc.h +++ /dev/null @@ -1,851 +0,0 @@ -// Copyright 2014 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 CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ -#define CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ - -#include -#include -#include -#include - -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" -#include "core/fpdfdoc/cpdf_annot.h" -#include "core/fpdfdoc/cpdf_annotlist.h" -#include "core/fxge/include/fx_dib.h" - -class CFDF_Document; -class CFieldTree; -class CFX_RenderDevice; -class CPDF_AAction; -class CPDF_Action; -class CPDF_ActionFields; -class CPDF_ApSettings; -class CPDF_Bookmark; -class CPDF_BookmarkTree; -class CPDF_DefaultAppearance; -class CPDF_Dest; -class CPDF_DocJSActions; -class CPDF_Document; -class CPDF_FileSpec; -class CPDF_Font; -class CPDF_Form; -class CPDF_FormControl; -class CPDF_FormField; -class CPDF_IconFit; -class CPDF_Link; -class CPDF_Metadata; -class CPDF_OCContext; -class CPDF_Page; -class CPDF_PageObject; -class CPDF_RenderContext; -class CPDF_RenderOptions; -class CXML_Element; -class IPDF_FormNotify; - -enum class BorderStyle { SOLID, DASH, BEVELED, INSET, UNDERLINE }; - -class CPDF_NameTree { - public: - explicit CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {} - CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteString& category); - - CPDF_Object* LookupValue(int nIndex, CFX_ByteString& csName) const; - CPDF_Object* LookupValue(const CFX_ByteString& csName) const; - CPDF_Array* LookupNamedDest(CPDF_Document* pDoc, const CFX_ByteString& sName); - int GetIndex(const CFX_ByteString& csName) const; - size_t GetCount() const; - CPDF_Dictionary* GetRoot() const { return m_pRoot; } - - protected: - CPDF_Dictionary* m_pRoot; -}; - -class CPDF_BookmarkTree { - public: - explicit CPDF_BookmarkTree(CPDF_Document* pDoc) : m_pDocument(pDoc) {} - - CPDF_Bookmark GetFirstChild(const CPDF_Bookmark& parent) const; - CPDF_Bookmark GetNextSibling(const CPDF_Bookmark& bookmark) const; - CPDF_Document* GetDocument() const { return m_pDocument; } - - protected: - CPDF_Document* const m_pDocument; -}; - -#define PDFBOOKMARK_ITALIC 1 -#define PDFBOOKMARK_BOLD 2 -class CPDF_Bookmark { - public: - CPDF_Bookmark() : m_pDict(nullptr) {} - explicit CPDF_Bookmark(CPDF_Dictionary* pDict) : m_pDict(pDict) {} - - CPDF_Dictionary* GetDict() const { return m_pDict; } - uint32_t GetColorRef() const; - uint32_t GetFontStyle() const; - CFX_WideString GetTitle() const; - CPDF_Dest GetDest(CPDF_Document* pDocument) const; - CPDF_Action GetAction() const; - - protected: - CPDF_Dictionary* m_pDict; -}; - -#define PDFZOOM_XYZ 1 -#define PDFZOOM_FITPAGE 2 -#define PDFZOOM_FITHORZ 3 -#define PDFZOOM_FITVERT 4 -#define PDFZOOM_FITRECT 5 -#define PDFZOOM_FITBBOX 6 -#define PDFZOOM_FITBHORZ 7 -#define PDFZOOM_FITBVERT 8 -class CPDF_Dest { - public: - CPDF_Dest() : m_pObj(nullptr) {} - explicit CPDF_Dest(CPDF_Object* pObj) : m_pObj(pObj) {} - - CPDF_Object* GetObject() const { return m_pObj; } - CFX_ByteString GetRemoteName(); - int GetPageIndex(CPDF_Document* pDoc); - uint32_t GetPageObjNum(); - int GetZoomMode(); - FX_FLOAT GetParam(int index); - - protected: - CPDF_Object* m_pObj; -}; - -class CPDF_OCContext { - public: - enum UsageType { View = 0, Design, Print, Export }; - - CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType); - ~CPDF_OCContext(); - - bool CheckOCGVisible(const CPDF_Dictionary* pOCGDict); - bool CheckObjectVisible(const CPDF_PageObject* pObj); - - protected: - bool LoadOCGStateFromConfig(const CFX_ByteString& csConfig, - const CPDF_Dictionary* pOCGDict) const; - bool LoadOCGState(const CPDF_Dictionary* pOCGDict) const; - bool GetOCGVisible(const CPDF_Dictionary* pOCGDict); - bool GetOCGVE(CPDF_Array* pExpression, int nLevel); - bool LoadOCMDState(const CPDF_Dictionary* pOCMDDict); - - CPDF_Document* const m_pDocument; - const UsageType m_eUsageType; - std::unordered_map m_OCGStates; -}; - -class CPDF_ActionFields { - public: - explicit CPDF_ActionFields(const CPDF_Action* pAction) : m_pAction(pAction) {} - - size_t GetFieldsCount() const; - std::vector GetAllFields() const; - CPDF_Object* GetField(size_t iIndex) const; - - protected: - const CPDF_Action* const m_pAction; -}; - -#define PDFNAMED_NEXTPAGE 1 -#define PDFNAMED_PREVPAGE 2 -#define PDFNAMED_FIRSTPAGE 3 -#define PDFNAMED_LASTPAGE 4 -#define PDFJS_MAXLENGTH 64 -class CPDF_Action { - public: - enum ActionType { - Unknown = 0, - GoTo, - GoToR, - GoToE, - Launch, - Thread, - URI, - Sound, - Movie, - Hide, - Named, - SubmitForm, - ResetForm, - ImportData, - JavaScript, - SetOCGState, - Rendition, - Trans, - GoTo3DView - }; - - CPDF_Action() : m_pDict(nullptr) {} - explicit CPDF_Action(CPDF_Dictionary* pDict) : m_pDict(pDict) {} - - CPDF_Dictionary* GetDict() const { return m_pDict; } - ActionType GetType() const; - CPDF_Dest GetDest(CPDF_Document* pDoc) const; - CFX_WideString GetFilePath() const; - CFX_ByteString GetURI(CPDF_Document* pDoc) const; - bool GetHideStatus() const { return m_pDict->GetBooleanBy("H", true); } - CFX_ByteString GetNamedAction() const { return m_pDict->GetStringBy("N"); } - uint32_t GetFlags() const { return m_pDict->GetIntegerBy("Flags"); } - CFX_WideString GetJavaScript() const; - size_t GetSubActionsCount() const; - CPDF_Action GetSubAction(size_t iIndex) const; - - protected: - CPDF_Dictionary* const m_pDict; -}; - -class CPDF_AAction { - public: - enum AActionType { - CursorEnter = 0, - CursorExit, - ButtonDown, - ButtonUp, - GetFocus, - LoseFocus, - PageOpen, - PageClose, - PageVisible, - PageInvisible, - OpenPage, - ClosePage, - KeyStroke, - Format, - Validate, - Calculate, - CloseDocument, - SaveDocument, - DocumentSaved, - PrintDocument, - DocumentPrinted - }; - - CPDF_AAction() : m_pDict(nullptr) {} - explicit CPDF_AAction(CPDF_Dictionary* pDict) : m_pDict(pDict) {} - - FX_BOOL ActionExist(AActionType eType) const; - CPDF_Action GetAction(AActionType eType) const; - CPDF_Dictionary* GetDict() const { return m_pDict; } - - protected: - CPDF_Dictionary* const m_pDict; -}; - -class CPDF_DocJSActions { - public: - explicit CPDF_DocJSActions(CPDF_Document* pDoc); - - int CountJSActions() const; - CPDF_Action GetJSAction(int index, CFX_ByteString& csName) const; - CPDF_Action GetJSAction(const CFX_ByteString& csName) const; - int FindJSAction(const CFX_ByteString& csName) const; - CPDF_Document* GetDocument() const { return m_pDocument; } - - protected: - CPDF_Document* const m_pDocument; -}; - -class CPDF_FileSpec { - public: - CPDF_FileSpec(); - explicit CPDF_FileSpec(CPDF_Object* pObj) : m_pObj(pObj) {} - - // Convert a platform dependent file name into pdf format. - static CFX_WideString EncodeFileName(const CFX_WideStringC& filepath); - - // Convert a pdf file name into platform dependent format. - static CFX_WideString DecodeFileName(const CFX_WideStringC& filepath); - - CPDF_Object* GetObj() const { return m_pObj; } - bool GetFileName(CFX_WideString* wsFileName) const; - - // Set this file spec to refer to a file name (not a url). - void SetFileName(const CFX_WideStringC& wsFileName); - - protected: - CPDF_Object* m_pObj; -}; - -class CPDF_LinkList { - public: - CPDF_LinkList(); - ~CPDF_LinkList(); - - CPDF_Link GetLinkAtPoint(CPDF_Page* pPage, - FX_FLOAT pdf_x, - FX_FLOAT pdf_y, - int* z_order); - - private: - const std::vector* GetPageLinks(CPDF_Page* pPage); - void LoadPageLinks(CPDF_Page* pPage, std::vector* pList); - - std::map> m_PageMap; -}; - -class CPDF_Link { - public: - CPDF_Link() : m_pDict(nullptr) {} - explicit CPDF_Link(CPDF_Dictionary* pDict) : m_pDict(pDict) {} - - CPDF_Dictionary* GetDict() const { return m_pDict; } - - CFX_FloatRect GetRect(); - CPDF_Dest GetDest(CPDF_Document* pDoc); - CPDF_Action GetAction(); - - protected: - CPDF_Dictionary* m_pDict; -}; - -#define COLORTYPE_TRANSPARENT 0 -#define COLORTYPE_GRAY 1 -#define COLORTYPE_RGB 2 -#define COLORTYPE_CMYK 3 -class CPDF_DefaultAppearance { - public: - CPDF_DefaultAppearance() {} - explicit CPDF_DefaultAppearance(const CFX_ByteString& csDA) : m_csDA(csDA) {} - - CPDF_DefaultAppearance(const CPDF_DefaultAppearance& cDA) { - m_csDA = cDA.GetStr(); - } - - CFX_ByteString GetStr() const { return m_csDA; } - FX_BOOL HasFont(); - CFX_ByteString GetFontString(); - void GetFont(CFX_ByteString& csFontNameTag, FX_FLOAT& fFontSize); - FX_BOOL HasColor(FX_BOOL bStrokingOperation = FALSE); - CFX_ByteString GetColorString(FX_BOOL bStrokingOperation = FALSE); - void GetColor(int& iColorType, - FX_FLOAT fc[4], - FX_BOOL bStrokingOperation = FALSE); - void GetColor(FX_ARGB& color, - int& iColorType, - FX_BOOL bStrokingOperation = FALSE); - FX_BOOL HasTextMatrix(); - CFX_ByteString GetTextMatrixString(); - CFX_Matrix GetTextMatrix(); - - protected: - CFX_ByteString m_csDA; -}; - -#define FIELDTYPE_UNKNOWN 0 -#define FIELDTYPE_PUSHBUTTON 1 -#define FIELDTYPE_CHECKBOX 2 -#define FIELDTYPE_RADIOBUTTON 3 -#define FIELDTYPE_COMBOBOX 4 -#define FIELDTYPE_LISTBOX 5 -#define FIELDTYPE_TEXTFIELD 6 -#define FIELDTYPE_SIGNATURE 7 - -class CPDF_InterForm { - public: - explicit CPDF_InterForm(CPDF_Document* pDocument); - ~CPDF_InterForm(); - - static void SetUpdateAP(FX_BOOL bUpdateAP); - static FX_BOOL IsUpdateAPEnabled(); - static CFX_ByteString GenerateNewResourceName(const CPDF_Dictionary* pResDict, - const FX_CHAR* csType, - int iMinLen = 2, - const FX_CHAR* csPrefix = ""); - static CPDF_Font* AddStandardFont(CPDF_Document* pDocument, - CFX_ByteString csFontName); - static CFX_ByteString GetNativeFont(uint8_t iCharSet, - void* pLogFont = nullptr); - static CFX_ByteString GetNativeFont(void* pLogFont = nullptr); - static uint8_t GetNativeCharSet(); - static CPDF_Font* AddNativeFont(uint8_t iCharSet, CPDF_Document* pDocument); - static CPDF_Font* AddNativeFont(CPDF_Document* pDocument); - - FX_BOOL ValidateFieldName(CFX_WideString& csNewFieldName, int iType); - FX_BOOL ValidateFieldName(const CPDF_FormField* pField, - CFX_WideString& csNewFieldName); - FX_BOOL ValidateFieldName(const CPDF_FormControl* pControl, - CFX_WideString& csNewFieldName); - - uint32_t CountFields(const CFX_WideString& csFieldName = L""); - CPDF_FormField* GetField(uint32_t index, - const CFX_WideString& csFieldName = L""); - CPDF_FormField* GetFieldByDict(CPDF_Dictionary* pFieldDict) const; - - CPDF_FormControl* GetControlAtPoint(CPDF_Page* pPage, - FX_FLOAT pdf_x, - FX_FLOAT pdf_y, - int* z_order) const; - CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const; - - CPDF_Document* GetDocument() const { return m_pDocument; } - CPDF_Dictionary* GetFormDict() const { return m_pFormDict; } - FX_BOOL NeedConstructAP() const; - int CountFieldsInCalculationOrder(); - CPDF_FormField* GetFieldInCalculationOrder(int index); - int FindFieldInCalculationOrder(const CPDF_FormField* pField); - - uint32_t CountFormFonts(); - CPDF_Font* GetFormFont(uint32_t index, CFX_ByteString& csNameTag); - CPDF_Font* GetFormFont(CFX_ByteString csNameTag); - CPDF_Font* GetFormFont(CFX_ByteString csFontName, CFX_ByteString& csNameTag); - CPDF_Font* GetNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); - CPDF_Font* GetNativeFormFont(CFX_ByteString& csNameTag); - FX_BOOL FindFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); - FX_BOOL FindFormFont(CFX_ByteString csFontName, - CPDF_Font*& pFont, - CFX_ByteString& csNameTag); - - FX_BOOL FindFormFont(CFX_WideString csFontName, - CPDF_Font*& pFont, - CFX_ByteString& csNameTag) { - return FindFormFont(PDF_EncodeText(csFontName), pFont, csNameTag); - } - - void AddFormFont(const CPDF_Font* pFont, CFX_ByteString& csNameTag); - CPDF_Font* AddNativeFormFont(uint8_t iCharSet, CFX_ByteString& csNameTag); - CPDF_Font* AddNativeFormFont(CFX_ByteString& csNameTag); - - void RemoveFormFont(const CPDF_Font* pFont); - void RemoveFormFont(CFX_ByteString csNameTag); - - CPDF_DefaultAppearance GetDefaultAppearance(); - CPDF_Font* GetDefaultFormFont(); - int GetFormAlignment(); - - CPDF_FormField* CheckRequiredFields( - const std::vector* fields, - bool bIncludeOrExclude) const; - - CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, - bool bSimpleFileSpec = false) const; - CFDF_Document* ExportToFDF(const CFX_WideStringC& pdf_path, - const std::vector& fields, - bool bIncludeOrExclude = true, - bool bSimpleFileSpec = false) const; - FX_BOOL ImportFromFDF(const CFDF_Document* pFDFDoc, FX_BOOL bNotify = FALSE); - - bool ResetForm(const std::vector& fields, - bool bIncludeOrExclude = true, - bool bNotify = false); - bool ResetForm(bool bNotify = false); - - void SetFormNotify(IPDF_FormNotify* pNotify); - FX_BOOL HasXFAForm() const; - void FixPageFields(const CPDF_Page* pPage); - - protected: - static FX_BOOL s_bUpdateAP; - - void LoadField(CPDF_Dictionary* pFieldDict, int nLevel = 0); - CPDF_Object* GetFieldAttr(CPDF_Dictionary* pFieldDict, const FX_CHAR* name); - CPDF_FormField* AddTerminalField(CPDF_Dictionary* pFieldDict); - CPDF_FormControl* AddControl(CPDF_FormField* pField, - CPDF_Dictionary* pWidgetDict); - void FDF_ImportField(CPDF_Dictionary* pField, - const CFX_WideString& parent_name, - FX_BOOL bNotify = FALSE, - int nLevel = 0); - FX_BOOL ValidateFieldName(CFX_WideString& csNewFieldName, - int iType, - const CPDF_FormField* pExcludedField, - const CPDF_FormControl* pExcludedControl); - int CompareFieldName(const CFX_WideString& name1, - const CFX_WideString& name2); - int CompareFieldName(const CFX_ByteString& name1, - const CFX_ByteString& name2); - - CPDF_Document* const m_pDocument; - CPDF_Dictionary* m_pFormDict; - std::map m_ControlMap; - std::unique_ptr m_pFieldTree; - CFX_ByteString m_bsEncoding; - IPDF_FormNotify* m_pFormNotify; - - friend class CPDF_FormControl; - friend class CPDF_FormField; -}; - -#define FORMFIELD_READONLY 0x01 -#define FORMFIELD_REQUIRED 0x02 -#define FORMFIELD_NOEXPORT 0x04 -#define FORMRADIO_NOTOGGLEOFF 0x100 -#define FORMRADIO_UNISON 0x200 -#define FORMTEXT_MULTILINE 0x100 -#define FORMTEXT_PASSWORD 0x200 -#define FORMTEXT_NOSCROLL 0x400 -#define FORMTEXT_COMB 0x800 -#define FORMCOMBO_EDIT 0x100 -#define FORMLIST_MULTISELECT 0x100 - -class CPDF_FormField { - public: - enum Type { - Unknown, - PushButton, - RadioButton, - CheckBox, - Text, - RichText, - File, - ListBox, - ComboBox, - Sign - }; - - CFX_WideString GetFullName() const; - - Type GetType() const { return m_Type; } - uint32_t GetFlags() const { return m_Flags; } - - CPDF_Dictionary* GetFieldDict() const { return m_pDict; } - void SetFieldDict(CPDF_Dictionary* pDict) { m_pDict = pDict; } - - FX_BOOL ResetField(FX_BOOL bNotify = FALSE); - - int CountControls() const { return m_ControlList.GetSize(); } - - CPDF_FormControl* GetControl(int index) const { - return m_ControlList.GetAt(index); - } - - int GetControlIndex(const CPDF_FormControl* pControl) const; - int GetFieldType() const; - - CPDF_AAction GetAdditionalAction() const; - CFX_WideString GetAlternateName() const; - CFX_WideString GetMappingName() const; - - uint32_t GetFieldFlags() const; - CFX_ByteString GetDefaultStyle() const; - CFX_WideString GetRichTextString() const; - - CFX_WideString GetValue() const; - CFX_WideString GetDefaultValue() const; - FX_BOOL SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE); - - int GetMaxLen() const; - int CountSelectedItems() const; - int GetSelectedIndex(int index) const; - - FX_BOOL ClearSelection(FX_BOOL bNotify = FALSE); - FX_BOOL IsItemSelected(int index) const; - FX_BOOL SetItemSelection(int index, - FX_BOOL bSelected, - FX_BOOL bNotify = FALSE); - - FX_BOOL IsItemDefaultSelected(int index) const; - - int GetDefaultSelectedItem() const; - int CountOptions() const; - - CFX_WideString GetOptionLabel(int index) const; - CFX_WideString GetOptionValue(int index) const; - - int FindOption(CFX_WideString csOptLabel) const; - int FindOptionValue(const CFX_WideString& csOptValue) const; - - FX_BOOL CheckControl(int iControlIndex, bool bChecked, bool bNotify = false); - - int GetTopVisibleIndex() const; - int CountSelectedOptions() const; - - int GetSelectedOptionIndex(int index) const; - FX_BOOL IsOptionSelected(int iOptIndex) const; - - FX_BOOL SelectOption(int iOptIndex, - FX_BOOL bSelected, - FX_BOOL bNotify = FALSE); - - FX_BOOL ClearSelectedOptions(FX_BOOL bNotify = FALSE); - -#ifdef PDF_ENABLE_XFA - FX_BOOL ClearOptions(FX_BOOL bNotify = FALSE); - - int InsertOption(CFX_WideString csOptLabel, - int index = -1, - FX_BOOL bNotify = FALSE); -#endif // PDF_ENABLE_XFA - - FX_FLOAT GetFontSize() const { return m_FontSize; } - CPDF_Font* GetFont() const { return m_pFont; } - - protected: - CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict); - ~CPDF_FormField(); - - CFX_WideString GetValue(FX_BOOL bDefault) const; - FX_BOOL SetValue(const CFX_WideString& value, - FX_BOOL bDefault, - FX_BOOL bNotify); - - void SyncFieldFlags(); - int FindListSel(CPDF_String* str); - CFX_WideString GetOptionText(int index, int sub_index) const; - - void LoadDA(); - CFX_WideString GetCheckValue(FX_BOOL bDefault) const; - FX_BOOL SetCheckValue(const CFX_WideString& value, - FX_BOOL bDefault, - FX_BOOL bNotify); - - bool NotifyBeforeSelectionChange(const CFX_WideString& value); - void NotifyAfterSelectionChange(); - - bool NotifyBeforeValueChange(const CFX_WideString& value); - void NotifyAfterValueChange(); - - bool NotifyListOrComboBoxBeforeChange(const CFX_WideString& value); - void NotifyListOrComboBoxAfterChange(); - - CPDF_FormField::Type m_Type; - uint32_t m_Flags; - CPDF_InterForm* m_pForm; - CPDF_Dictionary* m_pDict; - CFX_ArrayTemplate m_ControlList; - FX_FLOAT m_FontSize; - CPDF_Font* m_pFont; - - friend class CPDF_InterForm; - friend class CPDF_FormControl; -}; - -CPDF_Object* FPDF_GetFieldAttr(CPDF_Dictionary* pFieldDict, - const FX_CHAR* name, - int nLevel = 0); -class CPDF_IconFit { - public: - enum ScaleMethod { Always = 0, Bigger, Smaller, Never }; - - explicit CPDF_IconFit(const CPDF_Dictionary* pDict) : m_pDict(pDict) {} - - ScaleMethod GetScaleMethod(); - FX_BOOL IsProportionalScale(); - void GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom); - bool GetFittingBounds(); - const CPDF_Dictionary* GetDict() const { return m_pDict; } - - protected: - const CPDF_Dictionary* const m_pDict; -}; - -#define TEXTPOS_CAPTION 0 -#define TEXTPOS_ICON 1 -#define TEXTPOS_BELOW 2 -#define TEXTPOS_ABOVE 3 -#define TEXTPOS_RIGHT 4 -#define TEXTPOS_LEFT 5 -#define TEXTPOS_OVERLAID 6 - -class CPDF_FormControl { - public: - enum HighlightingMode { None = 0, Invert, Outline, Push, Toggle }; - - CPDF_FormField::Type GetType() const { return m_pField->GetType(); } - CPDF_InterForm* GetInterForm() const { return m_pForm; } - CPDF_FormField* GetField() const { return m_pField; } - CPDF_Dictionary* GetWidget() const { return m_pWidgetDict; } - CFX_FloatRect GetRect() const { return m_pWidgetDict->GetRectBy("Rect"); } - - void DrawControl(CFX_RenderDevice* pDevice, - CFX_Matrix* pMatrix, - CPDF_Page* pPage, - CPDF_Annot::AppearanceMode mode, - const CPDF_RenderOptions* pOptions = nullptr); - - CFX_ByteString GetCheckedAPState(); - CFX_WideString GetExportValue() const; - - bool IsChecked() const; - bool IsDefaultChecked() const; - - HighlightingMode GetHighlightingMode(); - bool HasMKEntry(const CFX_ByteString& csEntry) const; - int GetRotation(); - - FX_ARGB GetBorderColor(int& iColorType) { return GetColor(iColorType, "BC"); } - - FX_FLOAT GetOriginalBorderColor(int index) { - return GetOriginalColor(index, "BC"); - } - - void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) { - GetOriginalColor(iColorType, fc, "BC"); - } - - FX_ARGB GetBackgroundColor(int& iColorType) { - return GetColor(iColorType, "BG"); - } - - FX_FLOAT GetOriginalBackgroundColor(int index) { - return GetOriginalColor(index, "BG"); - } - - void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) { - GetOriginalColor(iColorType, fc, "BG"); - } - - CFX_WideString GetNormalCaption() { return GetCaption("CA"); } - CFX_WideString GetRolloverCaption() { return GetCaption("RC"); } - CFX_WideString GetDownCaption() { return GetCaption("AC"); } - - CPDF_Stream* GetNormalIcon() { return GetIcon("I"); } - CPDF_Stream* GetRolloverIcon() { return GetIcon("RI"); } - CPDF_Stream* GetDownIcon() { return GetIcon("IX"); } - CPDF_IconFit GetIconFit(); - - int GetTextPosition(); - CPDF_Action GetAction(); - CPDF_AAction GetAdditionalAction(); - CPDF_DefaultAppearance GetDefaultAppearance(); - - CPDF_Font* GetDefaultControlFont(); - int GetControlAlignment(); - - protected: - CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict); - - CFX_ByteString GetOnStateName() const; - void SetOnStateName(const CFX_ByteString& csOn); - void CheckControl(FX_BOOL bChecked); - FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry); - FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry); - void GetOriginalColor(int& iColorType, - FX_FLOAT fc[4], - const CFX_ByteString& csEntry); - - CFX_WideString GetCaption(const CFX_ByteString& csEntry); - CPDF_Stream* GetIcon(const CFX_ByteString& csEntry); - CPDF_ApSettings GetMK() const; - - CPDF_FormField* const m_pField; - CPDF_Dictionary* const m_pWidgetDict; - CPDF_InterForm* const m_pForm; - - friend class CPDF_InterForm; - friend class CPDF_FormField; -}; - -class IPDF_FormNotify { - public: - virtual ~IPDF_FormNotify(); - - virtual int BeforeValueChange(CPDF_FormField* pField, - const CFX_WideString& csValue); - virtual void AfterValueChange(CPDF_FormField* pField); - virtual int BeforeSelectionChange(CPDF_FormField* pField, - const CFX_WideString& csValue); - virtual void AfterSelectionChange(CPDF_FormField* pField); - virtual void AfterCheckedStatusChange(CPDF_FormField* pField); - virtual int BeforeFormReset(CPDF_InterForm* pForm); - virtual void AfterFormReset(CPDF_InterForm* pForm); - virtual int BeforeFormImportData(CPDF_InterForm* pForm); - virtual void AfterFormImportData(CPDF_InterForm* pForm); -}; - -class CPDF_PageLabel { - public: - explicit CPDF_PageLabel(CPDF_Document* pDocument); - - CFX_WideString GetLabel(int nPage) const; - int32_t GetPageByLabel(const CFX_ByteStringC& bsLabel) const; - int32_t GetPageByLabel(const CFX_WideStringC& wsLabel) const; - - protected: - CPDF_Document* const m_pDocument; -}; - -class CPDF_Metadata { - public: - explicit CPDF_Metadata(CPDF_Document* pDoc); - ~CPDF_Metadata(); - - const CXML_Element* GetRoot() const; - - private: - std::unique_ptr m_pXmlElement; -}; - -class CPDF_ViewerPreferences { - public: - explicit CPDF_ViewerPreferences(CPDF_Document* pDoc); - ~CPDF_ViewerPreferences(); - - FX_BOOL IsDirectionR2L() const; - FX_BOOL PrintScaling() const; - int32_t NumCopies() const; - CPDF_Array* PrintPageRange() const; - CFX_ByteString Duplex() const; - - protected: - CPDF_Dictionary* GetViewerPreferences() const; - - CPDF_Document* const m_pDoc; -}; - -class CPDF_ApSettings { - public: - explicit CPDF_ApSettings(CPDF_Dictionary* pDict); - - bool HasMKEntry(const CFX_ByteString& csEntry) const; - int GetRotation() const; - - FX_ARGB GetBorderColor(int& iColorType) const { - return GetColor(iColorType, "BC"); - } - - FX_FLOAT GetOriginalBorderColor(int index) const { - return GetOriginalColor(index, "BC"); - } - - void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) const { - GetOriginalColor(iColorType, fc, "BC"); - } - - FX_ARGB GetBackgroundColor(int& iColorType) const { - return GetColor(iColorType, "BG"); - } - - FX_FLOAT GetOriginalBackgroundColor(int index) const { - return GetOriginalColor(index, "BG"); - } - - void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) const { - GetOriginalColor(iColorType, fc, "BG"); - } - - CFX_WideString GetNormalCaption() const { return GetCaption("CA"); } - CFX_WideString GetRolloverCaption() const { return GetCaption("RC"); } - CFX_WideString GetDownCaption() const { return GetCaption("AC"); } - CPDF_Stream* GetNormalIcon() const { return GetIcon("I"); } - CPDF_Stream* GetRolloverIcon() const { return GetIcon("RI"); } - CPDF_Stream* GetDownIcon() const { return GetIcon("IX"); } - CPDF_IconFit GetIconFit() const; - int GetTextPosition() const; - - protected: - friend class CPDF_FormControl; - - FX_ARGB GetColor(int& iColorType, const CFX_ByteString& csEntry) const; - FX_FLOAT GetOriginalColor(int index, const CFX_ByteString& csEntry) const; - void GetOriginalColor(int& iColorType, - FX_FLOAT fc[4], - const CFX_ByteString& csEntry) const; - - CFX_WideString GetCaption(const CFX_ByteString& csEntry) const; - CPDF_Stream* GetIcon(const CFX_ByteString& csEntry) const; - - CPDF_Dictionary* const m_pDict; -}; - -CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, - CPDF_Annot::AppearanceMode mode); - -#endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ diff --git a/core/fpdfdoc/include/ipdf_formnotify.h b/core/fpdfdoc/include/ipdf_formnotify.h new file mode 100644 index 0000000000..65be2df3d7 --- /dev/null +++ b/core/fpdfdoc/include/ipdf_formnotify.h @@ -0,0 +1,32 @@ +// Copyright 2016 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 CORE_FPDFDOC_INCLUDE_IPDF_FORMNOTIFY_H_ +#define CORE_FPDFDOC_INCLUDE_IPDF_FORMNOTIFY_H_ + +#include "core/fxcrt/include/fx_string.h" + +class CPDF_FormField; +class CPDF_InterForm; + +class IPDF_FormNotify { + public: + virtual ~IPDF_FormNotify(); + + virtual int BeforeValueChange(CPDF_FormField* pField, + const CFX_WideString& csValue); + virtual void AfterValueChange(CPDF_FormField* pField); + virtual int BeforeSelectionChange(CPDF_FormField* pField, + const CFX_WideString& csValue); + virtual void AfterSelectionChange(CPDF_FormField* pField); + virtual void AfterCheckedStatusChange(CPDF_FormField* pField); + virtual int BeforeFormReset(CPDF_InterForm* pForm); + virtual void AfterFormReset(CPDF_InterForm* pForm); + virtual int BeforeFormImportData(CPDF_InterForm* pForm); + virtual void AfterFormImportData(CPDF_InterForm* pForm); +}; + +#endif // CORE_FPDFDOC_INCLUDE_IPDF_FORMNOTIFY_H_ diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index b8c8865d44..563078dd54 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -11,6 +11,8 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfdoc/include/cpdf_formfield.h" #include "fpdfsdk/include/fsdk_baseannot.h" CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot, diff --git a/fpdfsdk/fpdf_dataavail_embeddertest.cpp b/fpdfsdk/fpdf_dataavail_embeddertest.cpp index 222fdc4be2..70537779fe 100644 --- a/fpdfsdk/fpdf_dataavail_embeddertest.cpp +++ b/fpdfsdk/fpdf_dataavail_embeddertest.cpp @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "public/fpdf_doc.h" #include "public/fpdfview.h" #include "testing/embedder_test.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp index bb2c9ff0a5..0f679eab3c 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -11,6 +11,9 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" +#include "core/fpdfdoc/include/cpdf_annot.h" +#include "core/fpdfdoc/include/cpdf_interform.h" +#include "core/fpdfdoc/include/cpdf_metadata.h" #include "core/fxcrt/include/fx_basic.h" #include "core/fxcrt/include/fx_memory.h" #include "core/fxcrt/include/fx_xml.h" diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 7d2d23a921..5b97341765 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -15,6 +15,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfdoc/include/cpdf_annot.h" #include "fpdfsdk/include/fsdk_define.h" typedef CFX_ArrayTemplate CPDF_ObjectArray; diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp index 0cf222d796..de80c4c773 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -11,6 +11,8 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfdoc/include/cpdf_bookmark.h" +#include "core/fpdfdoc/include/cpdf_bookmarktree.h" #include "fpdfsdk/include/fsdk_define.h" #include "third_party/base/stl_util.h" diff --git a/fpdfsdk/fpdfdoc_unittest.cpp b/fpdfsdk/fpdfdoc_unittest.cpp index 2bd2e586aa..896c7d0c72 100644 --- a/fpdfsdk/fpdfdoc_unittest.cpp +++ b/fpdfsdk/fpdfdoc_unittest.cpp @@ -13,7 +13,6 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" -#include "core/fpdfdoc/include/fpdf_doc.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 439f73a7ae..0d0dac4964 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -19,6 +19,8 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfdoc/include/cpdf_annot.h" +#include "core/fpdfdoc/include/cpdf_annotlist.h" #include "fpdfsdk/include/fsdk_define.h" #include "public/fpdf_formfill.h" #include "third_party/base/stl_util.h" diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index 35f53c48b3..be652d028f 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -12,6 +12,9 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" +#include "core/fpdfdoc/include/cpdf_formcontrol.h" +#include "core/fpdfdoc/include/cpdf_formfield.h" +#include "core/fpdfdoc/include/cpdf_interform.h" #include "core/fxge/include/fx_ge.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp index 1596fd2584..104d307070 100644 --- a/fpdfsdk/fpdftext.cpp +++ b/fpdfsdk/fpdftext.cpp @@ -7,7 +7,7 @@ #include "public/fpdf_text.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_viewerpreferences.h" #include "core/fpdftext/include/cpdf_linkextract.h" #include "core/fpdftext/include/cpdf_textpage.h" #include "core/fpdftext/include/cpdf_textpagefind.h" diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 6a70df5367..b82714c8e5 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -11,10 +11,14 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/fpdfapi/include/cpdf_pagerendercontext.h" +#include "core/fpdfdoc/include/cpdf_annotlist.h" +#include "core/fpdfdoc/include/cpdf_nametree.h" +#include "core/fpdfdoc/include/cpdf_viewerpreferences.h" #include "core/fxcodec/include/fx_codec.h" #include "core/fxcrt/include/fx_memory.h" #include "core/fxcrt/include/fx_safe_types.h" diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp index 499bdcb2e3..27f0d34066 100644 --- a/fpdfsdk/fsdk_actionhandler.cpp +++ b/fpdfsdk/fsdk_actionhandler.cpp @@ -9,6 +9,8 @@ #include #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfdoc/include/cpdf_formfield.h" +#include "core/fpdfdoc/include/cpdf_interform.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/javascript/ijs_context.h" diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp index f7dd531f35..45bfcbad73 100644 --- a/fpdfsdk/fsdk_annothandler.cpp +++ b/fpdfsdk/fsdk_annothandler.cpp @@ -11,6 +11,7 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfdoc/include/cpdf_interform.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp index 2ef28716d0..4d0cc59073 100644 --- a/fpdfsdk/fsdk_baseannot.cpp +++ b/fpdfsdk/fsdk_baseannot.cpp @@ -10,6 +10,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fxcrt/include/fx_ext.h" #include "fpdfsdk/include/fsdk_baseannot.h" #include "fpdfsdk/include/fsdk_define.h" diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp index afbd95870d..287c5cf17e 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -16,6 +16,8 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfdoc/include/cpdf_actionfields.h" +#include "core/fpdfdoc/include/cpdf_interform.h" #include "core/fxge/include/fx_ge.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" #include "fpdfsdk/fxedit/include/fxet_edit.h" diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp index 8587de1e80..cf17d8f6f2 100644 --- a/fpdfsdk/fsdk_mgr.cpp +++ b/fpdfsdk/fsdk_mgr.cpp @@ -12,6 +12,8 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfdoc/include/cpdf_docjsactions.h" +#include "core/fpdfdoc/include/cpdf_interform.h" #include "core/fxcrt/include/cfx_retain_ptr.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" #include "fpdfsdk/include/fsdk_define.h" diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 123106b8a2..bafe3d0db5 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -13,6 +13,7 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" #include "core/fpdfdoc/include/cpvt_section.h" diff --git a/fpdfsdk/include/fsdk_actionhandler.h b/fpdfsdk/include/fsdk_actionhandler.h index 45ff5571a5..e8f1a0deb9 100644 --- a/fpdfsdk/include/fsdk_actionhandler.h +++ b/fpdfsdk/include/fsdk_actionhandler.h @@ -10,7 +10,6 @@ #include #include -#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxcrt/include/fx_string.h" #include "fpdfsdk/include/fsdk_baseform.h" diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h index 95d49ae272..a4f72ab28b 100644 --- a/fpdfsdk/include/fsdk_baseannot.h +++ b/fpdfsdk/include/fsdk_baseannot.h @@ -13,14 +13,15 @@ #include #endif -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_aaction.h" +#include "core/fpdfdoc/include/cpdf_annot.h" +#include "core/fpdfdoc/include/cpdf_defaultappearance.h" #include "core/fxcrt/include/fx_basic.h" #include "fpdfsdk/cfx_systemhandler.h" #include "fpdfsdk/include/fsdk_common.h" #include "fpdfsdk/include/fsdk_define.h" class CPDFSDK_PageView; -class CPDF_Annot; class CPDF_Page; class CFX_Matrix; class CPDF_RenderOptions; diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index f6df689984..91603aa41f 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -10,7 +10,7 @@ #include #include -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/ipdf_formnotify.h" #include "core/fxcrt/include/fx_basic.h" #include "core/fxge/include/fx_dib.h" #include "fpdfsdk/include/fsdk_baseannot.h" @@ -26,7 +26,9 @@ class CPDFSDK_Document; class CPDFSDK_InterForm; class CPDFSDK_PageView; class CPDF_Action; +class CPDF_FormControl; class CPDF_FormField; +class CPDF_InterForm; struct CPWL_Color; #ifdef PDF_ENABLE_XFA diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index fe221c9d7d..909cbbd9d2 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -8,7 +8,7 @@ #define FPDFSDK_INCLUDE_FSDK_DEFINE_H_ #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fxge/include/fx_dib.h" #include "public/fpdfview.h" #ifdef PDF_ENABLE_XFA @@ -31,6 +31,9 @@ ((uint32_t)rgb & 0x0000FF00) | (((uint32_t)rgb & 0x00FF0000) >> 16)) typedef unsigned int FX_UINT; + +class CPDF_Annot; +class CPDF_Page; class CPDF_PageRenderContext; class IFSDK_PAUSE_Adapter; diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index 16aef4af4e..b87c982cc1 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -13,6 +13,7 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfdoc/include/cpdf_occontext.h" #include "fpdfsdk/cfx_systemhandler.h" #include "fpdfsdk/include/fsdk_actionhandler.h" #include "fpdfsdk/include/fsdk_annothandler.h" @@ -25,6 +26,7 @@ class CFFL_IFormFiller; class CFX_SystemHandler; +class CPDF_AnnotList; class CPDFSDK_ActionHandler; class CPDFSDK_Annot; class CPDFSDK_InterForm; diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index ace805f3b5..56b0b8479f 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -11,6 +11,8 @@ #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfdoc/include/cpdf_interform.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/javascript/Field.h" #include "fpdfsdk/javascript/Icon.h" diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 9b109f7b1b..38309cfac5 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -13,6 +13,7 @@ #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" +#include "core/fpdfdoc/include/cpdf_interform.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/javascript/Document.h" #include "fpdfsdk/javascript/Icon.h" diff --git a/fpdfsdk/javascript/Icon.h b/fpdfsdk/javascript/Icon.h index bd125d8299..f8fa70e076 100644 --- a/fpdfsdk/javascript/Icon.h +++ b/fpdfsdk/javascript/Icon.h @@ -9,9 +9,11 @@ #include "fpdfsdk/javascript/JS_Define.h" +class CPDF_Stream; + class Icon : public CJS_EmbedObj { public: - Icon(CJS_Object* pJSObject); + explicit Icon(CJS_Object* pJSObject); ~Icon() override; FX_BOOL name(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); @@ -27,7 +29,7 @@ class Icon : public CJS_EmbedObj { class CJS_Icon : public CJS_Object { public: - CJS_Icon(v8::Local pObject) : CJS_Object(pObject) {} + explicit CJS_Icon(v8::Local pObject) : CJS_Object(pObject) {} ~CJS_Icon() override {} DECLARE_JS_CLASS(); diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index fa7b5d4d36..34819c75eb 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -9,6 +9,7 @@ #include #include +#include "core/fpdfdoc/include/cpdf_interform.h" #include "core/fxcrt/include/fx_ext.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/javascript/Field.h" diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index 2e780c6d65..3dfaf5afda 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -9,7 +9,7 @@ #include -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfdoc/include/cpdf_formcontrol.h" #include "core/fxcrt/include/fx_basic.h" #include "fpdfsdk/cfx_systemhandler.h" diff --git a/pdfium.gyp b/pdfium.gyp index b351ed9d21..b6abb14057 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -180,13 +180,11 @@ 'sources': [ 'core/fpdfdoc/clines.cpp', 'core/fpdfdoc/clines.h', - 'core/fpdfdoc/include/fpdf_doc.h', - 'core/fpdfdoc/include/fpdf_tagged.h', - 'core/fpdfdoc/cpdf_variabletext.cpp', + 'core/fpdfdoc/cpdf_apsettings.h', 'core/fpdfdoc/cpdf_annot.cpp', - 'core/fpdfdoc/cpdf_annot.h', 'core/fpdfdoc/cpdf_annotlist.cpp', - 'core/fpdfdoc/cpdf_annotlist.h', + 'core/fpdfdoc/cpdf_pagelabel.h', + 'core/fpdfdoc/cpdf_variabletext.cpp', 'core/fpdfdoc/cpvt_color.cpp', 'core/fpdfdoc/cpvt_color.h', 'core/fpdfdoc/cpvt_dash.h', @@ -218,7 +216,28 @@ 'core/fpdfdoc/doc_utils.h', 'core/fpdfdoc/doc_viewerPreferences.cpp', 'core/fpdfdoc/doc_vt.cpp', + 'core/fpdfdoc/include/cpdf_aaction.h', + 'core/fpdfdoc/include/cpdf_action.h', + 'core/fpdfdoc/include/cpdf_actionfields.h', + 'core/fpdfdoc/include/cpdf_annot.h', + 'core/fpdfdoc/include/cpdf_annotlist.h', + 'core/fpdfdoc/include/cpdf_bookmark.h', + 'core/fpdfdoc/include/cpdf_bookmarktree.h', + 'core/fpdfdoc/include/cpdf_defaultappearance.h', + 'core/fpdfdoc/include/cpdf_dest.h', + 'core/fpdfdoc/include/cpdf_docjsactions.h', + 'core/fpdfdoc/include/cpdf_filespec.h', + 'core/fpdfdoc/include/cpdf_formcontrol.h', + 'core/fpdfdoc/include/cpdf_formfield.h', + 'core/fpdfdoc/include/cpdf_iconfit.h', + 'core/fpdfdoc/include/cpdf_interform.h', + 'core/fpdfdoc/include/cpdf_link.h', + 'core/fpdfdoc/include/cpdf_linklist.h', + 'core/fpdfdoc/include/cpdf_metadata.h', + 'core/fpdfdoc/include/cpdf_nametree.h', + 'core/fpdfdoc/include/cpdf_occontext.h', 'core/fpdfdoc/include/cpdf_variabletext.h', + 'core/fpdfdoc/include/cpdf_viewerpreferences.h', 'core/fpdfdoc/include/cpvt_line.h', 'core/fpdfdoc/include/cpvt_secprops.h', 'core/fpdfdoc/include/cpvt_section.h', @@ -226,7 +245,9 @@ 'core/fpdfdoc/include/cpvt_wordplace.h', 'core/fpdfdoc/include/cpvt_wordprops.h', 'core/fpdfdoc/include/cpvt_wordrange.h', + 'core/fpdfdoc/include/fpdf_tagged.h', 'core/fpdfdoc/include/ipvt_fontmap.h', + 'core/fpdfdoc/include/ipdf_formnotify.h', 'core/fpdfdoc/pdf_vt.h', 'core/fpdfdoc/tagged_int.h', ], diff --git a/public/fpdf_formfill.h b/public/fpdf_formfill.h index 90d6663137..79e9c26961 100644 --- a/public/fpdf_formfill.h +++ b/public/fpdf_formfill.h @@ -684,10 +684,20 @@ typedef struct _FPDF_FORMFILLINFO { * Parameters: * pThis - Pointer to the interface structure itself. * nPageIndex - The index of the PDF page. - * zoomMode - The zoom mode for viewing page.See Macros - *"PDFZOOM_XXX" defined in "fpdfdoc.h". + * zoomMode - The zoom mode for viewing page. See below. * fPosArray - The float array which carries the position info. * sizeofArray - The size of float array. + * + * PDFZoom values: + * - XYZ = 1 + * - FITPAGE = 2 + * - FITHORZ = 3 + * - FITVERT = 4 + * - FITRECT = 5 + * - FITBBOX = 6 + * - FITBHORZ = 7 + * - FITBVERT = 8 + * * Return value: * None. * Comments: diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index a0e00d3e37..4e69db4eea 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -10,7 +10,8 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfdoc/include/fpdf_doc.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfdoc/include/cpdf_nametree.h" #include "core/fxcrt/include/fx_ext.h" #include "core/fxcrt/include/fx_memory.h" #include "xfa/fde/xml/fde_xml_imp.h" -- cgit v1.2.3