From e530fb7976922c4934812f8721e7550ced17786b Mon Sep 17 00:00:00 2001 From: dsinclair Date: Wed, 6 Apr 2016 12:09:37 -0700 Subject: Move remaining fpdfdoc files This CL moves the last two fpdfdoc files from core/include/fpdfdoc to core/fpdfdoc/include. Review URL: https://codereview.chromium.org/1864163002 --- BUILD.gn | 4 +- core/fpdfdoc/cpvt_generateap.cpp | 2 +- core/fpdfdoc/doc_action.cpp | 2 +- core/fpdfdoc/doc_annot.cpp | 2 +- core/fpdfdoc/doc_basic.cpp | 2 +- core/fpdfdoc/doc_basic_unittest.cpp | 2 +- core/fpdfdoc/doc_bookmark.cpp | 2 +- core/fpdfdoc/doc_form.cpp | 2 +- core/fpdfdoc/doc_formcontrol.cpp | 2 +- core/fpdfdoc/doc_formfield.cpp | 2 +- core/fpdfdoc/doc_link.cpp | 2 +- core/fpdfdoc/doc_metadata.cpp | 2 +- core/fpdfdoc/doc_ocg.cpp | 2 +- core/fpdfdoc/doc_tagged.cpp | 2 +- core/fpdfdoc/doc_utils.cpp | 2 +- core/fpdfdoc/doc_viewerPreferences.cpp | 2 +- core/fpdfdoc/doc_vt.cpp | 2 +- core/fpdfdoc/include/fpdf_doc.h | 1053 +++++++++++++++++++++++++++++++ core/fpdfdoc/include/fpdf_tagged.h | 104 ++++ core/fpdfdoc/tagged_int.h | 2 +- core/include/fpdfdoc/fpdf_doc.h | 1055 -------------------------------- core/include/fpdfdoc/fpdf_tagged.h | 104 ---- fpdfsdk/DEPS | 1 + fpdfsdk/fpdfdoc_unittest.cpp | 2 +- fpdfsdk/fpdftext.cpp | 2 +- fpdfsdk/include/fsdk_actionhandler.h | 2 +- fpdfsdk/include/fsdk_baseannot.h | 2 +- fpdfsdk/include/fsdk_baseform.h | 2 +- fpdfsdk/include/fsdk_define.h | 2 +- fpdfsdk/pdfwindow/PWL_Wnd.h | 2 +- pdfium.gyp | 4 +- xfa/fxfa/app/DEPS | 1 + xfa/fxfa/app/xfa_ffdoc.cpp | 2 +- 33 files changed, 1188 insertions(+), 1188 deletions(-) create mode 100644 core/fpdfdoc/include/fpdf_doc.h create mode 100644 core/fpdfdoc/include/fpdf_tagged.h delete mode 100644 core/include/fpdfdoc/fpdf_doc.h delete mode 100644 core/include/fpdfdoc/fpdf_tagged.h diff --git a/BUILD.gn b/BUILD.gn index 196426f957..8007012a48 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -232,11 +232,11 @@ 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/ipvt_fontmap.h", "core/fpdfdoc/pdf_vt.h", "core/fpdfdoc/tagged_int.h", - "core/include/fpdfdoc/fpdf_doc.h", - "core/include/fpdfdoc/fpdf_tagged.h", ] configs += [ ":pdfium_config" ] } diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index f323d9a858..ee99becaee 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -14,8 +14,8 @@ #include "core/fpdfdoc/cpvt_color.h" #include "core/fpdfdoc/cpvt_fontmap.h" #include "core/fpdfdoc/include/cpvt_word.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fpdfdoc/pdf_vt.h" -#include "core/include/fpdfdoc/fpdf_doc.h" namespace { diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index 9a43b58e98..c3ab552606 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.h" namespace { diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp index 0e3d2a56bd..d1942eccd0 100644 --- a/core/fpdfdoc/doc_annot.cpp +++ b/core/fpdfdoc/doc_annot.cpp @@ -13,8 +13,8 @@ #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" #include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/fpdfdoc/cpvt_generateap.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxge/include/fx_ge.h" -#include "core/include/fpdfdoc/fpdf_doc.h" CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) : m_pDocument(pPage->m_pDocument) { diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index 744475e505..9318387f7f 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -7,7 +7,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfdoc/doc_utils.h" -#include "core/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.h" namespace { diff --git a/core/fpdfdoc/doc_basic_unittest.cpp b/core/fpdfdoc/doc_basic_unittest.cpp index 0ab70c9304..5713a6debb 100644 --- a/core/fpdfdoc/doc_basic_unittest.cpp +++ b/core/fpdfdoc/doc_basic_unittest.cpp @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include #include diff --git a/core/fpdfdoc/doc_bookmark.cpp b/core/fpdfdoc/doc_bookmark.cpp index 35a04043fe..18e6174621 100644 --- a/core/fpdfdoc/doc_bookmark.cpp +++ b/core/fpdfdoc/doc_bookmark.cpp @@ -10,7 +10,7 @@ #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/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.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 aa4b5c9f30..80c09714a2 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -13,7 +13,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" #include "core/fpdfdoc/doc_utils.h" -#include "core/include/fpdfdoc/fpdf_doc.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 0a0a8c9a03..6435cfd76c 100644 --- a/core/fpdfdoc/doc_formcontrol.cpp +++ b/core/fpdfdoc/doc_formcontrol.cpp @@ -11,7 +11,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" #include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" -#include "core/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.h" CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, CPDF_Dictionary* pWidgetDict) { diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp index 931f9e18d9..1adc92ae4f 100644 --- a/core/fpdfdoc/doc_formfield.cpp +++ b/core/fpdfdoc/doc_formfield.cpp @@ -12,7 +12,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" #include "core/fpdfdoc/cpvt_generateap.h" #include "core/fpdfdoc/doc_utils.h" -#include "core/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.h" FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) { FX_BOOL bUnison = FALSE; diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp index d86bf203e4..8f8d0d158c 100644 --- a/core/fpdfdoc/doc_link.cpp +++ b/core/fpdfdoc/doc_link.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include diff --git a/core/fpdfdoc/doc_metadata.cpp b/core/fpdfdoc/doc_metadata.cpp index c466193055..f36250ab7a 100644 --- a/core/fpdfdoc/doc_metadata.cpp +++ b/core/fpdfdoc/doc_metadata.cpp @@ -7,8 +7,8 @@ #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" -#include "core/include/fpdfdoc/fpdf_doc.h" CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) { CPDF_Dictionary* pRoot = pDoc->GetRoot(); diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp index 7464936b62..02b6eb115e 100644 --- a/core/fpdfdoc/doc_ocg.cpp +++ b/core/fpdfdoc/doc_ocg.cpp @@ -6,7 +6,7 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.h" static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject, const CPDF_Dictionary* pGroupDict) { diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp index 2a3554c499..94c143d51c 100644 --- a/core/fpdfdoc/doc_tagged.cpp +++ b/core/fpdfdoc/doc_tagged.cpp @@ -12,8 +12,8 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" #include "core/fpdfdoc/doc_utils.h" +#include "core/fpdfdoc/include/fpdf_tagged.h" #include "core/fpdfdoc/tagged_int.h" -#include "core/include/fpdfdoc/fpdf_tagged.h" const int nMaxRecursion = 32; static FX_BOOL IsTagged(const CPDF_Document* pDoc) { diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index 0d91b20e8a..7e7fa8110f 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -12,8 +12,8 @@ #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include "core/fpdfdoc/doc_utils.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxge/include/fx_font.h" -#include "core/include/fpdfdoc/fpdf_doc.h" namespace { diff --git a/core/fpdfdoc/doc_viewerPreferences.cpp b/core/fpdfdoc/doc_viewerPreferences.cpp index 035d192395..a355635bf0 100644 --- a/core/fpdfdoc/doc_viewerPreferences.cpp +++ b/core/fpdfdoc/doc_viewerPreferences.cpp @@ -5,7 +5,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.h" CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc) : m_pDoc(pDoc) {} diff --git a/core/fpdfdoc/doc_vt.cpp b/core/fpdfdoc/doc_vt.cpp index fa3d3a2dc2..b728c68af6 100644 --- a/core/fpdfdoc/doc_vt.cpp +++ b/core/fpdfdoc/doc_vt.cpp @@ -9,8 +9,8 @@ #include "core/fpdfdoc/cpvt_wordinfo.h" #include "core/fpdfdoc/csection.h" #include "core/fpdfdoc/include/cpdf_variabletext.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fpdfdoc/pdf_vt.h" -#include "core/include/fpdfdoc/fpdf_doc.h" CLine::CLine() {} CLine::~CLine() {} diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h new file mode 100644 index 0000000000..e33b60165b --- /dev/null +++ b/core/fpdfdoc/include/fpdf_doc.h @@ -0,0 +1,1053 @@ +// 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 "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h" +#include "core/fxge/include/fx_dib.h" + +class CFDF_Document; +class CFieldTree; +class CPDF_AAction; +class CPDF_Action; +class CPDF_ActionFields; +class CPDF_Annot; +class CPDF_AnnotList; +class CPDF_ApSettings; +class CPDF_Bookmark; +class CPDF_BookmarkTree; +class CPDF_DefaultAppearance; +class CPDF_Dest; +class CPDF_Document; +class CPDF_DocJSActions; +class CPDF_FileSpec; +class CPDF_FormControl; +class CPDF_FormField; +class CPDF_FormNotify; +class CPDF_IconFit; +class CPDF_InterForm; +class CPDF_Link; +class CPDF_Metadata; +class CPDF_OCContext; +class CPDF_Page; +class CPDF_Font; +class CPDF_Form; +class CPDF_RenderOptions; +class CPDF_RenderContext; +class CPDF_ViewerPreferences; +class CXML_Element; +class CFX_RenderDevice; + +class CPDF_NameTree { + public: + explicit CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {} + CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteStringC& 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_ByteStringC& sName); + int GetIndex(const CFX_ByteString& csName) const; + int 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 IPDF_OCContext { + public: + enum UsageType { View = 0, Design, Print, Export }; + + explicit CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType = View); + ~CPDF_OCContext() override; + + // IPDF_OCContext: + FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCGDict) override; + + CPDF_Document* GetDocument() const { return m_pDocument; } + UsageType GetUsageType() const { return m_eUsageType; } + + void ResetOCContext(); + + protected: + FX_BOOL LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, + const CPDF_Dictionary* pOCGDict, + FX_BOOL& bValidConfig) const; + FX_BOOL LoadOCGState(const CPDF_Dictionary* pOCGDict) const; + FX_BOOL GetOCGVisible(const CPDF_Dictionary* pOCGDict); + FX_BOOL GetOCGVE(CPDF_Array* pExpression, + FX_BOOL bFromConfig, + int nLevel = 0); + FX_BOOL LoadOCMDState(const CPDF_Dictionary* pOCMDDict, FX_BOOL bFromConfig); + + CPDF_Document* m_pDocument; + UsageType m_eUsageType; + std::map m_OCGStates; +}; + +class CPDF_ActionFields { + public: + explicit CPDF_ActionFields(const CPDF_Action* pAction) : m_pAction(pAction) {} + + uint32_t GetFieldsCount() const; + std::vector GetAllFields() const; + CPDF_Object* GetField(uint32_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; } + CFX_ByteString GetTypeName() const { return m_pDict->GetStringBy("S"); } + ActionType GetType() const; + CPDF_Dest GetDest(CPDF_Document* pDoc) const; + CFX_WideString GetFilePath() const; + FX_BOOL GetNewWindow() const { return m_pDict->GetBooleanBy("NewWindow"); } + CFX_ByteString GetURI(CPDF_Document* pDoc) const; + FX_BOOL GetMouseMap() const { return m_pDict->GetBooleanBy("IsMap"); } + FX_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; + CPDF_Dictionary* GetAnnot() const; + int32_t GetOperationType() const; + CPDF_Stream* GetSoundStream() const { return m_pDict->GetStreamBy("Sound"); } + FX_FLOAT GetVolume() const { return m_pDict->GetNumberBy("Volume"); } + FX_BOOL IsSynchronous() const { return m_pDict->GetBooleanBy("Synchronous"); } + FX_BOOL IsRepeat() const { return m_pDict->GetBooleanBy("Repeat"); } + FX_BOOL IsMixPlay() const { return m_pDict->GetBooleanBy("Mix"); } + uint32_t GetSubActionsCount() const; + CPDF_Action GetSubAction(uint32_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 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 CFX_PrivateData { + public: + enum AppearanceMode { Normal, Rollover, Down }; + + CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList); + ~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_AnnotList* const m_pList; + const CFX_ByteString m_sSubtype; + std::map m_APMap; +}; + +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) { + DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, + bShowWidget ? 3 : 1, pOptions, nullptr); + } + + 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]; } + const std::vector& All() const { return m_AnnotList; } + CPDF_Document* GetDocument() const { return m_pDocument; } + + protected: + 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; +}; + +#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 CFX_PrivateData { + public: + CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bUpdateAP); + ~CPDF_InterForm(); + + static void EnableUpdateAP(FX_BOOL bUpdateAP); + + static FX_BOOL UpdatingAPEnabled(); + + 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(); + + void NeedConstructAP(FX_BOOL bNeedAP); + + 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); + + inline 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); + + CPDF_FormNotify* GetFormNotify() const { return m_pFormNotify; } + + void SetFormNotify(const CPDF_FormNotify* pNotify); + + FX_BOOL IsUpdated() { return m_bUpdated; } + + void ClearUpdatedFlag() { m_bUpdated = FALSE; } + + FX_BOOL HasXFAForm() const; + + void FixPageFields(const CPDF_Page* pPage); + + protected: + static FX_BOOL m_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(const 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; + + FX_BOOL m_bGenerateAP; + + CPDF_Dictionary* m_pFormDict; + + std::map m_ControlMap; + + std::unique_ptr m_pFieldTree; + + CFX_ByteString m_bsEncoding; + + CPDF_FormNotify* m_pFormNotify; + + FX_BOOL m_bUpdated; + 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(); + + 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() { return m_ControlList.GetSize(); } + + CPDF_FormControl* GetControl(int index) { return m_ControlList.GetAt(index); } + + int GetControlIndex(const CPDF_FormControl* pControl); + + int GetFieldType(); + + CPDF_AAction GetAdditionalAction(); + + CFX_WideString GetAlternateName(); + + CFX_WideString GetMappingName(); + + uint32_t GetFieldFlags(); + + CFX_ByteString GetDefaultStyle(); + + CFX_WideString GetRichTextString(); + + CFX_WideString GetValue(); + + CFX_WideString GetDefaultValue(); + + FX_BOOL SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE); + + int GetMaxLen(); + + int CountSelectedItems(); + + int GetSelectedIndex(int index); + + FX_BOOL ClearSelection(FX_BOOL bNotify = FALSE); + + FX_BOOL IsItemSelected(int index); + + FX_BOOL SetItemSelection(int index, + FX_BOOL bSelected, + FX_BOOL bNotify = FALSE); + + FX_BOOL IsItemDefaultSelected(int index); + + int GetDefaultSelectedItem(); + + int CountOptions(); + + CFX_WideString GetOptionLabel(int index); + + CFX_WideString GetOptionValue(int index); + + int FindOption(CFX_WideString csOptLabel); + + int FindOptionValue(const CFX_WideString& csOptValue); + + FX_BOOL CheckControl(int iControlIndex, bool bChecked, bool bNotify = false); + + int GetTopVisibleIndex(); + + int CountSelectedOptions(); + + int GetSelectedOptionIndex(int index); + + FX_BOOL IsOptionSelected(int iOptIndex); + + 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() { return m_FontSize; } + + CPDF_Font* GetFont() { return m_pFont; } + + protected: + CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict); + ~CPDF_FormField(); + + CFX_WideString GetValue(FX_BOOL bDefault); + + 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); + + void LoadDA(); + + void UpdateAP(CPDF_FormControl* pControl); + + CFX_WideString GetCheckValue(FX_BOOL bDefault); + + FX_BOOL SetCheckValue(const CFX_WideString& value, + FX_BOOL bDefault, + FX_BOOL bNotify); + + 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); + FX_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; + + 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(); + + bool IsChecked() const; + bool IsDefaultChecked() const; + + HighlightingMode GetHighlightingMode(); + bool HasMKEntry(CFX_ByteString csEntry) const; + int GetRotation(); + + inline 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, CFX_ByteString csEntry); + + FX_FLOAT GetOriginalColor(int index, CFX_ByteString csEntry); + + void GetOriginalColor(int& iColorType, + FX_FLOAT fc[4], + CFX_ByteString csEntry); + + CFX_WideString GetCaption(CFX_ByteString csEntry); + + CPDF_Stream* GetIcon(CFX_ByteString csEntry); + + CPDF_ApSettings GetMK() const; + + CPDF_InterForm* m_pForm; + + CPDF_FormField* m_pField; + + CPDF_Dictionary* m_pWidgetDict; + friend class CPDF_InterForm; + friend class CPDF_FormField; +}; + +class CPDF_FormNotify { + public: + virtual ~CPDF_FormNotify() {} + + virtual int BeforeValueChange(CPDF_FormField* pField, + const CFX_WideString& csValue) { + return 0; + } + virtual void AfterValueChange(CPDF_FormField* pField) {} + virtual int BeforeSelectionChange(CPDF_FormField* pField, + const CFX_WideString& csValue) { + return 0; + } + virtual void AfterSelectionChange(CPDF_FormField* pField) {} + virtual void AfterCheckedStatusChange(CPDF_FormField* pField) {} + virtual int BeforeFormReset(CPDF_InterForm* pForm) { return 0; } + virtual void AfterFormReset(CPDF_InterForm* pForm) {} + virtual int BeforeFormImportData(CPDF_InterForm* pForm) { return 0; } + virtual void AfterFormImportData(CPDF_InterForm* pForm) {} +}; + +class CPDF_PageLabel { + public: + explicit CPDF_PageLabel(CPDF_Document* pDocument) : m_pDocument(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_Document* const m_pDoc; +}; + +class CPDF_ApSettings { + public: + explicit CPDF_ApSettings(CPDF_Dictionary* pDict); + + bool HasMKEntry(const CFX_ByteStringC& 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_ByteStringC& csEntry) const; + + FX_FLOAT GetOriginalColor(int index, const CFX_ByteStringC& csEntry) const; + + void GetOriginalColor(int& iColorType, + FX_FLOAT fc[4], + const CFX_ByteStringC& csEntry) const; + + CFX_WideString GetCaption(const CFX_ByteStringC& csEntry) const; + + CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry) const; + + CPDF_Dictionary* const m_pDict; +}; + +CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath); + +#endif // CORE_FPDFDOC_INCLUDE_FPDF_DOC_H_ diff --git a/core/fpdfdoc/include/fpdf_tagged.h b/core/fpdfdoc/include/fpdf_tagged.h new file mode 100644 index 0000000000..807f178229 --- /dev/null +++ b/core/fpdfdoc/include/fpdf_tagged.h @@ -0,0 +1,104 @@ +// 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_TAGGED_H_ +#define CORE_FPDFDOC_INCLUDE_FPDF_TAGGED_H_ + +#include "core/fxge/include/fx_dib.h" + +class CPDF_Document; +class CPDF_StructElement; +class CPDF_StructTree; +struct CPDF_StructKid; + +class CPDF_StructTree { + public: + static CPDF_StructTree* LoadDoc(const CPDF_Document* pDoc); + + static CPDF_StructTree* LoadPage(const CPDF_Document* pDoc, + const CPDF_Dictionary* pPageDict); + + virtual ~CPDF_StructTree() {} + + virtual int CountTopElements() const = 0; + + virtual CPDF_StructElement* GetTopElement(int i) const = 0; +}; +struct CPDF_StructKid { + enum { Invalid, Element, PageContent, StreamContent, Object } m_Type; + + union { + struct { + CPDF_StructElement* m_pElement; + + CPDF_Dictionary* m_pDict; + } m_Element; + struct { + uint32_t m_PageObjNum; + + uint32_t m_ContentId; + } m_PageContent; + struct { + uint32_t m_PageObjNum; + + uint32_t m_ContentId; + + uint32_t m_RefObjNum; + } m_StreamContent; + struct { + uint32_t m_PageObjNum; + + uint32_t m_RefObjNum; + } m_Object; + }; +}; +class CPDF_StructElement { + public: + virtual ~CPDF_StructElement() {} + + virtual CPDF_StructTree* GetTree() const = 0; + + virtual const CFX_ByteString& GetType() const = 0; + + virtual CPDF_StructElement* GetParent() const = 0; + + virtual CPDF_Dictionary* GetDict() const = 0; + + virtual int CountKids() const = 0; + + virtual const CPDF_StructKid& GetKid(int index) const = 0; + + virtual CPDF_Object* GetAttr(const CFX_ByteStringC& owner, + const CFX_ByteStringC& name, + FX_BOOL bInheritable = FALSE, + FX_FLOAT fLevel = 0.0F) = 0; + + virtual CFX_ByteString GetName(const CFX_ByteStringC& owner, + const CFX_ByteStringC& name, + const CFX_ByteStringC& default_value, + FX_BOOL bInheritable = FALSE, + int subindex = -1) = 0; + + virtual FX_ARGB GetColor(const CFX_ByteStringC& owner, + const CFX_ByteStringC& name, + FX_ARGB default_value, + FX_BOOL bInheritable = FALSE, + int subindex = -1) = 0; + + virtual FX_FLOAT GetNumber(const CFX_ByteStringC& owner, + const CFX_ByteStringC& name, + FX_FLOAT default_value, + FX_BOOL bInheritable = FALSE, + int subindex = -1) = 0; + + virtual int GetInteger(const CFX_ByteStringC& owner, + const CFX_ByteStringC& name, + int default_value, + FX_BOOL bInheritable = FALSE, + int subindex = -1) = 0; +}; + +#endif // CORE_FPDFDOC_INCLUDE_FPDF_TAGGED_H_ diff --git a/core/fpdfdoc/tagged_int.h b/core/fpdfdoc/tagged_int.h index 4877069bf6..f6e845a7af 100644 --- a/core/fpdfdoc/tagged_int.h +++ b/core/fpdfdoc/tagged_int.h @@ -9,7 +9,7 @@ #include -#include "core/include/fpdfdoc/fpdf_tagged.h" +#include "core/fpdfdoc/include/fpdf_tagged.h" class CPDF_StructElementImpl; diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h deleted file mode 100644 index 9cd6d1c408..0000000000 --- a/core/include/fpdfdoc/fpdf_doc.h +++ /dev/null @@ -1,1055 +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_INCLUDE_FPDFDOC_FPDF_DOC_H_ -#define CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ - -#include -#include -#include - -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" -#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h" -#include "core/fxge/include/fx_dib.h" - -class CFDF_Document; -class CFieldTree; -class CPDF_AAction; -class CPDF_Action; -class CPDF_ActionFields; -class CPDF_Annot; -class CPDF_AnnotList; -class CPDF_ApSettings; -class CPDF_Bookmark; -class CPDF_BookmarkTree; -class CPDF_DefaultAppearance; -class CPDF_Dest; -class CPDF_Document; -class CPDF_DocJSActions; -class CPDF_FileSpec; -class CPDF_FormControl; -class CPDF_FormField; -class CPDF_FormNotify; -class CPDF_IconFit; -class CPDF_InterForm; -class CPDF_Link; -class CPDF_Metadata; -class CPDF_OCContext; -class CPDF_Page; -class CPDF_Font; -class CPDF_Form; -class CPDF_RenderOptions; -class CPDF_RenderContext; -class CPDF_ViewerPreferences; -class CXML_Element; -class CFX_RenderDevice; - -class CPDF_NameTree { - public: - explicit CPDF_NameTree(CPDF_Dictionary* pRoot) : m_pRoot(pRoot) {} - CPDF_NameTree(CPDF_Document* pDoc, const CFX_ByteStringC& 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_ByteStringC& sName); - int GetIndex(const CFX_ByteString& csName) const; - int 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 IPDF_OCContext { - public: - enum UsageType { View = 0, Design, Print, Export }; - - explicit CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType = View); - ~CPDF_OCContext() override; - - // IPDF_OCContext: - FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCGDict) override; - - CPDF_Document* GetDocument() const { return m_pDocument; } - UsageType GetUsageType() const { return m_eUsageType; } - - void ResetOCContext(); - - protected: - FX_BOOL LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig, - const CPDF_Dictionary* pOCGDict, - FX_BOOL& bValidConfig) const; - FX_BOOL LoadOCGState(const CPDF_Dictionary* pOCGDict) const; - FX_BOOL GetOCGVisible(const CPDF_Dictionary* pOCGDict); - FX_BOOL GetOCGVE(CPDF_Array* pExpression, - FX_BOOL bFromConfig, - int nLevel = 0); - FX_BOOL LoadOCMDState(const CPDF_Dictionary* pOCMDDict, FX_BOOL bFromConfig); - - CPDF_Document* m_pDocument; - UsageType m_eUsageType; - std::map m_OCGStates; -}; - -class CPDF_ActionFields { - public: - explicit CPDF_ActionFields(const CPDF_Action* pAction) : m_pAction(pAction) {} - - uint32_t GetFieldsCount() const; - std::vector GetAllFields() const; - CPDF_Object* GetField(uint32_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; } - CFX_ByteString GetTypeName() const { return m_pDict->GetStringBy("S"); } - ActionType GetType() const; - CPDF_Dest GetDest(CPDF_Document* pDoc) const; - CFX_WideString GetFilePath() const; - FX_BOOL GetNewWindow() const { return m_pDict->GetBooleanBy("NewWindow"); } - CFX_ByteString GetURI(CPDF_Document* pDoc) const; - FX_BOOL GetMouseMap() const { return m_pDict->GetBooleanBy("IsMap"); } - FX_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; - CPDF_Dictionary* GetAnnot() const; - int32_t GetOperationType() const; - CPDF_Stream* GetSoundStream() const { return m_pDict->GetStreamBy("Sound"); } - FX_FLOAT GetVolume() const { return m_pDict->GetNumberBy("Volume"); } - FX_BOOL IsSynchronous() const { return m_pDict->GetBooleanBy("Synchronous"); } - FX_BOOL IsRepeat() const { return m_pDict->GetBooleanBy("Repeat"); } - FX_BOOL IsMixPlay() const { return m_pDict->GetBooleanBy("Mix"); } - uint32_t GetSubActionsCount() const; - CPDF_Action GetSubAction(uint32_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 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 CFX_PrivateData { - public: - enum AppearanceMode { Normal, Rollover, Down }; - - CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList); - ~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_AnnotList* const m_pList; - const CFX_ByteString m_sSubtype; - std::map m_APMap; -}; - -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) { - DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, - bShowWidget ? 3 : 1, pOptions, nullptr); - } - - 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]; } - const std::vector& All() const { return m_AnnotList; } - CPDF_Document* GetDocument() const { return m_pDocument; } - - protected: - 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; -}; - -#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 CFX_PrivateData { - public: - CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bUpdateAP); - ~CPDF_InterForm(); - - static void EnableUpdateAP(FX_BOOL bUpdateAP); - - static FX_BOOL UpdatingAPEnabled(); - - 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(); - - void NeedConstructAP(FX_BOOL bNeedAP); - - 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); - - inline 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); - - CPDF_FormNotify* GetFormNotify() const { return m_pFormNotify; } - - void SetFormNotify(const CPDF_FormNotify* pNotify); - - FX_BOOL IsUpdated() { return m_bUpdated; } - - void ClearUpdatedFlag() { m_bUpdated = FALSE; } - - FX_BOOL HasXFAForm() const; - - void FixPageFields(const CPDF_Page* pPage); - - protected: - static FX_BOOL m_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(const 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; - - FX_BOOL m_bGenerateAP; - - CPDF_Dictionary* m_pFormDict; - - std::map m_ControlMap; - - std::unique_ptr m_pFieldTree; - - CFX_ByteString m_bsEncoding; - - CPDF_FormNotify* m_pFormNotify; - - FX_BOOL m_bUpdated; - 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(); - - 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() { return m_ControlList.GetSize(); } - - CPDF_FormControl* GetControl(int index) { return m_ControlList.GetAt(index); } - - int GetControlIndex(const CPDF_FormControl* pControl); - - int GetFieldType(); - - CPDF_AAction GetAdditionalAction(); - - CFX_WideString GetAlternateName(); - - CFX_WideString GetMappingName(); - - uint32_t GetFieldFlags(); - - CFX_ByteString GetDefaultStyle(); - - CFX_WideString GetRichTextString(); - - CFX_WideString GetValue(); - - CFX_WideString GetDefaultValue(); - - FX_BOOL SetValue(const CFX_WideString& value, FX_BOOL bNotify = FALSE); - - int GetMaxLen(); - - int CountSelectedItems(); - - int GetSelectedIndex(int index); - - FX_BOOL ClearSelection(FX_BOOL bNotify = FALSE); - - FX_BOOL IsItemSelected(int index); - - FX_BOOL SetItemSelection(int index, - FX_BOOL bSelected, - FX_BOOL bNotify = FALSE); - - FX_BOOL IsItemDefaultSelected(int index); - - int GetDefaultSelectedItem(); - - int CountOptions(); - - CFX_WideString GetOptionLabel(int index); - - CFX_WideString GetOptionValue(int index); - - int FindOption(CFX_WideString csOptLabel); - - int FindOptionValue(const CFX_WideString& csOptValue); - - FX_BOOL CheckControl(int iControlIndex, - bool bChecked, - bool bNotify = false); - - int GetTopVisibleIndex(); - - int CountSelectedOptions(); - - int GetSelectedOptionIndex(int index); - - FX_BOOL IsOptionSelected(int iOptIndex); - - 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() { return m_FontSize; } - - CPDF_Font* GetFont() { return m_pFont; } - - protected: - CPDF_FormField(CPDF_InterForm* pForm, CPDF_Dictionary* pDict); - ~CPDF_FormField(); - - CFX_WideString GetValue(FX_BOOL bDefault); - - 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); - - void LoadDA(); - - void UpdateAP(CPDF_FormControl* pControl); - - CFX_WideString GetCheckValue(FX_BOOL bDefault); - - FX_BOOL SetCheckValue(const CFX_WideString& value, - FX_BOOL bDefault, - FX_BOOL bNotify); - - 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); - FX_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; - - 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(); - - bool IsChecked() const; - bool IsDefaultChecked() const; - - HighlightingMode GetHighlightingMode(); - bool HasMKEntry(CFX_ByteString csEntry) const; - int GetRotation(); - - inline 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, CFX_ByteString csEntry); - - FX_FLOAT GetOriginalColor(int index, CFX_ByteString csEntry); - - void GetOriginalColor(int& iColorType, - FX_FLOAT fc[4], - CFX_ByteString csEntry); - - CFX_WideString GetCaption(CFX_ByteString csEntry); - - CPDF_Stream* GetIcon(CFX_ByteString csEntry); - - CPDF_ApSettings GetMK() const; - - CPDF_InterForm* m_pForm; - - CPDF_FormField* m_pField; - - CPDF_Dictionary* m_pWidgetDict; - friend class CPDF_InterForm; - friend class CPDF_FormField; -}; - -class CPDF_FormNotify { - public: - virtual ~CPDF_FormNotify() {} - - virtual int BeforeValueChange(CPDF_FormField* pField, - const CFX_WideString& csValue) { - return 0; - } - virtual void AfterValueChange(CPDF_FormField* pField) {} - virtual int BeforeSelectionChange(CPDF_FormField* pField, - const CFX_WideString& csValue) { - return 0; - } - virtual void AfterSelectionChange(CPDF_FormField* pField) {} - virtual void AfterCheckedStatusChange(CPDF_FormField* pField) {} - virtual int BeforeFormReset(CPDF_InterForm* pForm) { return 0; } - virtual void AfterFormReset(CPDF_InterForm* pForm) {} - virtual int BeforeFormImportData(CPDF_InterForm* pForm) { return 0; } - virtual void AfterFormImportData(CPDF_InterForm* pForm) {} -}; - -class CPDF_PageLabel { - public: - explicit CPDF_PageLabel(CPDF_Document* pDocument) : m_pDocument(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_Document* const m_pDoc; -}; - -class CPDF_ApSettings { - public: - explicit CPDF_ApSettings(CPDF_Dictionary* pDict); - - bool HasMKEntry(const CFX_ByteStringC& 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_ByteStringC& csEntry) const; - - FX_FLOAT GetOriginalColor(int index, const CFX_ByteStringC& csEntry) const; - - void GetOriginalColor(int& iColorType, - FX_FLOAT fc[4], - const CFX_ByteStringC& csEntry) const; - - CFX_WideString GetCaption(const CFX_ByteStringC& csEntry) const; - - CPDF_Stream* GetIcon(const CFX_ByteStringC& csEntry) const; - - CPDF_Dictionary* const m_pDict; -}; - -CFX_WideString FILESPEC_EncodeFileName(const CFX_WideStringC& filepath); - -#endif // CORE_INCLUDE_FPDFDOC_FPDF_DOC_H_ diff --git a/core/include/fpdfdoc/fpdf_tagged.h b/core/include/fpdfdoc/fpdf_tagged.h deleted file mode 100644 index 46d9fe2137..0000000000 --- a/core/include/fpdfdoc/fpdf_tagged.h +++ /dev/null @@ -1,104 +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_INCLUDE_FPDFDOC_FPDF_TAGGED_H_ -#define CORE_INCLUDE_FPDFDOC_FPDF_TAGGED_H_ - -#include "core/fxge/include/fx_dib.h" - -class CPDF_Document; -class CPDF_StructElement; -class CPDF_StructTree; -struct CPDF_StructKid; - -class CPDF_StructTree { - public: - static CPDF_StructTree* LoadDoc(const CPDF_Document* pDoc); - - static CPDF_StructTree* LoadPage(const CPDF_Document* pDoc, - const CPDF_Dictionary* pPageDict); - - virtual ~CPDF_StructTree() {} - - virtual int CountTopElements() const = 0; - - virtual CPDF_StructElement* GetTopElement(int i) const = 0; -}; -struct CPDF_StructKid { - enum { Invalid, Element, PageContent, StreamContent, Object } m_Type; - - union { - struct { - CPDF_StructElement* m_pElement; - - CPDF_Dictionary* m_pDict; - } m_Element; - struct { - uint32_t m_PageObjNum; - - uint32_t m_ContentId; - } m_PageContent; - struct { - uint32_t m_PageObjNum; - - uint32_t m_ContentId; - - uint32_t m_RefObjNum; - } m_StreamContent; - struct { - uint32_t m_PageObjNum; - - uint32_t m_RefObjNum; - } m_Object; - }; -}; -class CPDF_StructElement { - public: - virtual ~CPDF_StructElement() {} - - virtual CPDF_StructTree* GetTree() const = 0; - - virtual const CFX_ByteString& GetType() const = 0; - - virtual CPDF_StructElement* GetParent() const = 0; - - virtual CPDF_Dictionary* GetDict() const = 0; - - virtual int CountKids() const = 0; - - virtual const CPDF_StructKid& GetKid(int index) const = 0; - - virtual CPDF_Object* GetAttr(const CFX_ByteStringC& owner, - const CFX_ByteStringC& name, - FX_BOOL bInheritable = FALSE, - FX_FLOAT fLevel = 0.0F) = 0; - - virtual CFX_ByteString GetName(const CFX_ByteStringC& owner, - const CFX_ByteStringC& name, - const CFX_ByteStringC& default_value, - FX_BOOL bInheritable = FALSE, - int subindex = -1) = 0; - - virtual FX_ARGB GetColor(const CFX_ByteStringC& owner, - const CFX_ByteStringC& name, - FX_ARGB default_value, - FX_BOOL bInheritable = FALSE, - int subindex = -1) = 0; - - virtual FX_FLOAT GetNumber(const CFX_ByteStringC& owner, - const CFX_ByteStringC& name, - FX_FLOAT default_value, - FX_BOOL bInheritable = FALSE, - int subindex = -1) = 0; - - virtual int GetInteger(const CFX_ByteStringC& owner, - const CFX_ByteStringC& name, - int default_value, - FX_BOOL bInheritable = FALSE, - int subindex = -1) = 0; -}; - -#endif // CORE_INCLUDE_FPDFDOC_FPDF_TAGGED_H_ diff --git a/fpdfsdk/DEPS b/fpdfsdk/DEPS index 99e35b4151..9fa01ac925 100644 --- a/fpdfsdk/DEPS +++ b/fpdfsdk/DEPS @@ -6,6 +6,7 @@ include_rules = [ '+core/fpdfapi/fpdf_page/include', '+core/fpdfapi/fpdf_parser/include', '+core/fpdfapi/fpdf_render/include', + '+core/fpdfdoc/include', '+core/fxcrt/include', '+core/fxge/include', '+public', diff --git a/fpdfsdk/fpdfdoc_unittest.cpp b/fpdfsdk/fpdfdoc_unittest.cpp index e9c58b24ee..d36b1cc34e 100644 --- a/fpdfsdk/fpdfdoc_unittest.cpp +++ b/fpdfsdk/fpdfdoc_unittest.cpp @@ -13,7 +13,7 @@ #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/include/fpdfdoc/fpdf_doc.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" diff --git a/fpdfsdk/fpdftext.cpp b/fpdfsdk/fpdftext.cpp index 3faf26aceb..0d0e86f12d 100644 --- a/fpdfsdk/fpdftext.cpp +++ b/fpdfsdk/fpdftext.cpp @@ -7,10 +7,10 @@ #include "public/fpdf_text.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fpdftext/include/ipdf_linkextract.h" #include "core/fpdftext/include/ipdf_textpage.h" #include "core/fpdftext/include/ipdf_textpagefind.h" -#include "core/include/fpdfdoc/fpdf_doc.h" #include "fpdfsdk/include/fsdk_define.h" #ifdef PDF_ENABLE_XFA diff --git a/fpdfsdk/include/fsdk_actionhandler.h b/fpdfsdk/include/fsdk_actionhandler.h index a8022b0695..bf2ebd3eba 100644 --- a/fpdfsdk/include/fsdk_actionhandler.h +++ b/fpdfsdk/include/fsdk_actionhandler.h @@ -10,8 +10,8 @@ #include #include +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxcrt/include/fx_string.h" -#include "core/include/fpdfdoc/fpdf_doc.h" #include "fpdfsdk/include/fsdk_baseform.h" class CPDFSDK_Annot; diff --git a/fpdfsdk/include/fsdk_baseannot.h b/fpdfsdk/include/fsdk_baseannot.h index a8f4a67381..4756bdbdba 100644 --- a/fpdfsdk/include/fsdk_baseannot.h +++ b/fpdfsdk/include/fsdk_baseannot.h @@ -13,8 +13,8 @@ #include #endif +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxcrt/include/fx_basic.h" -#include "core/include/fpdfdoc/fpdf_doc.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fx_systemhandler.h" diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h index 2ee130feb3..084347f53b 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -10,9 +10,9 @@ #include #include +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxcrt/include/fx_basic.h" #include "core/fxge/include/fx_dib.h" -#include "core/include/fpdfdoc/fpdf_doc.h" #include "fpdfsdk/include/fsdk_baseannot.h" #ifdef PDF_ENABLE_XFA diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index d5f752c49b..f3ed2da00f 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -8,9 +8,9 @@ #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_ge.h" #include "core/fxge/include/fx_ge_win32.h" -#include "core/include/fpdfdoc/fpdf_doc.h" #include "public/fpdfview.h" #ifdef PDF_ENABLE_XFA diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index f05b1e6784..7cad1cc664 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -9,8 +9,8 @@ #include +#include "core/fpdfdoc/include/fpdf_doc.h" #include "core/fxcrt/include/fx_basic.h" -#include "core/include/fpdfdoc/fpdf_doc.h" #include "fpdfsdk/include/fx_systemhandler.h" class CPWL_MsgControl; diff --git a/pdfium.gyp b/pdfium.gyp index 91e31fd652..1815f9d6f3 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -219,8 +219,8 @@ 'target_name': 'fpdfdoc', 'type': 'static_library', 'sources': [ - 'core/include/fpdfdoc/fpdf_doc.h', - 'core/include/fpdfdoc/fpdf_tagged.h', + 'core/fpdfdoc/include/fpdf_doc.h', + 'core/fpdfdoc/include/fpdf_tagged.h', 'core/fpdfdoc/cpdf_variabletext.cpp', 'core/fpdfdoc/cpvt_color.cpp', 'core/fpdfdoc/cpvt_color.h', diff --git a/xfa/fxfa/app/DEPS b/xfa/fxfa/app/DEPS index a1911963de..7c067f228f 100644 --- a/xfa/fxfa/app/DEPS +++ b/xfa/fxfa/app/DEPS @@ -3,4 +3,5 @@ include_rules = [ '+core/fpdfapi/fpdf_font/include', '+core/fpdfapi/fpdf_page/include', '+core/fpdfapi/fpdf_parser/include', + '+core/fpdfdoc/include', ] diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index acbddb4cf0..5baebb152a 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -8,9 +8,9 @@ #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/fxcrt/include/fx_ext.h" #include "core/fxcrt/include/fx_memory.h" -#include "core/include/fpdfdoc/fpdf_doc.h" #include "xfa/fde/xml/fde_xml_imp.h" #include "xfa/fgas/crt/fgas_algorithm.h" #include "xfa/fwl/core/ifwl_notedriver.h" -- cgit v1.2.3