From aa403d3f68a966e24a6d8e8c109970930f096afb Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 15 Mar 2016 14:57:22 -0400 Subject: core/include/fdpfapi cleanup Part I. This Cl moves a bunch of the files from core/include/fpdfapi to their correct location outside the core/include tree. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1805603002 . --- BUILD.gn | 54 +++-- core/fpdfapi/fpdf_basic_module.cpp | 4 +- core/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp | 2 +- core/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp | 2 +- core/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp | 2 +- core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp | 2 +- core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp | 2 +- core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp | 11 +- core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp | 18 +- core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 11 +- core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp | 14 +- core/fpdfapi/fpdf_edit/include/cpdf_creator.h | 98 ++++++++ core/fpdfapi/fpdf_font/fpdf_font.cpp | 14 +- core/fpdfapi/fpdf_font/fpdf_font_charset.cpp | 2 +- core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 8 +- core/fpdfapi/fpdf_page/fpdf_page.cpp | 9 +- core/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 10 +- core/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 13 +- core/fpdfapi/fpdf_page/fpdf_page_func.cpp | 7 +- core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 8 +- core/fpdfapi/fpdf_page/fpdf_page_image.cpp | 4 +- core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 17 +- core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 20 +- core/fpdfapi/fpdf_page/fpdf_page_path.cpp | 1 - core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 6 +- core/fpdfapi/fpdf_parser/cfdf_document.cpp | 6 +- core/fpdfapi/fpdf_parser/cpdf_array.cpp | 12 +- core/fpdfapi/fpdf_parser/cpdf_boolean.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_boolean.h | 35 +++ core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp | 17 +- core/fpdfapi/fpdf_parser/cpdf_data_avail.h | 4 +- core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp | 18 +- core/fpdfapi/fpdf_parser/cpdf_document.cpp | 13 +- core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp | 8 +- core/fpdfapi/fpdf_parser/cpdf_hint_tables.h | 2 +- .../fpdf_parser/cpdf_indirect_object_holder.cpp | 7 +- core/fpdfapi/fpdf_parser/cpdf_name.cpp | 4 +- core/fpdfapi/fpdf_parser/cpdf_null.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_null.h | 21 ++ core/fpdfapi/fpdf_parser/cpdf_number.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_object.cpp | 12 +- core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp | 20 +- core/fpdfapi/fpdf_parser/cpdf_parser.cpp | 18 +- core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_reference.cpp | 4 +- core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp | 2 +- .../fpdf_parser/cpdf_simple_parser_unittest.cpp | 2 +- .../fpdf_parser/cpdf_standard_crypto_handler.cpp | 6 +- .../fpdf_parser/cpdf_standard_crypto_handler.h | 2 +- .../fpdf_parser/cpdf_standard_security_handler.cpp | 8 +- .../fpdf_parser/cpdf_standard_security_handler.h | 2 +- core/fpdfapi/fpdf_parser/cpdf_stream.cpp | 8 +- core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp | 5 +- core/fpdfapi/fpdf_parser/cpdf_string.cpp | 4 +- core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp | 24 +- .../fpdf_parser/cpdf_syntax_parser_unittest.cpp | 2 +- core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | 8 +- .../fpdf_parser_decode_embeddertest.cpp | 2 +- .../fpdf_parser/fpdf_parser_decode_unittest.cpp | 2 +- core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp | 16 +- core/fpdfapi/fpdf_parser/include/cfdf_document.h | 36 +++ core/fpdfapi/fpdf_parser/include/cpdf_array.h | 65 +++++ core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h | 99 ++++++++ core/fpdfapi/fpdf_parser/include/cpdf_document.h | 137 +++++++++++ .../include/cpdf_indirect_object_holder.h | 44 ++++ core/fpdfapi/fpdf_parser/include/cpdf_name.h | 35 +++ core/fpdfapi/fpdf_parser/include/cpdf_number.h | 44 ++++ core/fpdfapi/fpdf_parser/include/cpdf_object.h | 161 +++++++++++++ core/fpdfapi/fpdf_parser/include/cpdf_parser.h | 173 ++++++++++++++ core/fpdfapi/fpdf_parser/include/cpdf_reference.h | 51 ++++ .../fpdf_parser/include/cpdf_simple_parser.h | 35 +++ core/fpdfapi/fpdf_parser/include/cpdf_stream.h | 61 +++++ core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h | 46 ++++ core/fpdfapi/fpdf_parser/include/cpdf_string.h | 40 ++++ .../fpdf_parser/include/fpdf_parser_decode.h | 76 ++++++ core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h | 80 +++++++ core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h | 45 ++++ core/fpdfapi/fpdf_parser/ipdf_occontext.cpp | 25 ++ core/fpdfapi/fpdf_parser/ipdf_occontext.h | 23 ++ core/fpdfapi/fpdf_parser/ipdf_security_handler.h | 36 +++ core/fpdfapi/fpdf_render/cpdf_pagerendercache.h | 77 ++++++ core/fpdfapi/fpdf_render/fpdf_render.cpp | 28 +-- core/fpdfapi/fpdf_render/fpdf_render_cache.cpp | 7 +- core/fpdfapi/fpdf_render/fpdf_render_image.cpp | 12 +- core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp | 10 +- core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp | 7 +- core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 7 +- .../fpdf_render/include/cpdf_progressiverenderer.h | 62 +++++ .../fpdf_render/include/cpdf_rendercontext.h | 68 ++++++ .../fpdf_render/include/cpdf_renderoptions.h | 52 ++++ .../fpdf_render/include/cpdf_textrenderer.h | 77 ++++++ core/fpdfapi/fpdf_render/render_int.h | 7 +- core/fpdfapi/include/cpdf_modulemgr.h | 70 ++++++ core/fpdfapi/ipdf_pagemodule.h | 28 +++ core/fpdfapi/ipdf_rendermodule.h | 29 +++ core/fpdfdoc/doc_action.cpp | 4 +- core/fpdfdoc/doc_annot.cpp | 10 +- core/fpdfdoc/doc_ap.cpp | 6 +- core/fpdfdoc/doc_basic.cpp | 4 +- core/fpdfdoc/doc_basic_unittest.cpp | 4 +- core/fpdfdoc/doc_bookmark.cpp | 7 +- core/fpdfdoc/doc_form.cpp | 9 +- core/fpdfdoc/doc_formcontrol.cpp | 7 +- core/fpdfdoc/doc_formfield.cpp | 12 +- core/fpdfdoc/doc_link.cpp | 3 +- core/fpdfdoc/doc_metadata.cpp | 4 +- core/fpdfdoc/doc_ocg.cpp | 4 +- core/fpdfdoc/doc_tagged.cpp | 8 +- core/fpdfdoc/doc_utils.cpp | 6 +- core/fpdfdoc/doc_utils.h | 2 +- core/fpdfdoc/doc_viewerPreferences.cpp | 2 +- core/fpdftext/fpdf_text_int.cpp | 5 +- core/fxcodec/jbig2/JBig2_BitStream.cpp | 4 +- core/fxcodec/jbig2/JBig2_Context.cpp | 4 +- core/fxcodec/jbig2/JBig2_Context.h | 2 +- core/fxge/skia/DEPS | 3 + core/include/fpdfapi/cfdf_document.h | 36 --- core/include/fpdfapi/cpdf_array.h | 65 ----- core/include/fpdfapi/cpdf_boolean.h | 35 --- core/include/fpdfapi/cpdf_dictionary.h | 99 -------- core/include/fpdfapi/cpdf_document.h | 137 ----------- core/include/fpdfapi/cpdf_indirect_object_holder.h | 44 ---- core/include/fpdfapi/cpdf_name.h | 35 --- core/include/fpdfapi/cpdf_null.h | 21 -- core/include/fpdfapi/cpdf_number.h | 44 ---- core/include/fpdfapi/cpdf_object.h | 161 ------------- core/include/fpdfapi/cpdf_parser.h | 173 -------------- core/include/fpdfapi/cpdf_reference.h | 51 ---- core/include/fpdfapi/cpdf_simple_parser.h | 35 --- core/include/fpdfapi/cpdf_stream.h | 61 ----- core/include/fpdfapi/cpdf_stream_acc.h | 46 ---- core/include/fpdfapi/cpdf_string.h | 40 ---- core/include/fpdfapi/fpdf_module.h | 101 -------- core/include/fpdfapi/fpdf_parser_decode.h | 76 ------ core/include/fpdfapi/fpdf_render.h | 263 --------------------- core/include/fpdfapi/fpdf_resource.h | 4 +- core/include/fpdfapi/fpdf_serial.h | 105 -------- core/include/fpdfapi/ipdf_crypto_handler.h | 45 ---- core/include/fpdfapi/ipdf_data_avail.h | 80 ------- core/include/fpdfapi/ipdf_security_handler.h | 36 --- core/include/fpdfdoc/fpdf_doc.h | 12 +- fpdfsdk/DEPS | 4 + fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp | 4 +- fpdfsdk/formfiller/FFL_FormFiller.cpp | 1 + fpdfsdk/formfiller/FFL_IFormFiller.cpp | 3 +- fpdfsdk/fpdf_dataavail.cpp | 4 +- fpdfsdk/fpdf_ext.cpp | 5 +- fpdfsdk/fpdf_flatten.cpp | 7 +- fpdfsdk/fpdf_progressive.cpp | 1 + fpdfsdk/fpdf_transformpage.cpp | 9 +- fpdfsdk/fpdfdoc.cpp | 5 +- fpdfsdk/fpdfdoc_unittest.cpp | 12 +- fpdfsdk/fpdfeditimg.cpp | 1 + fpdfsdk/fpdfeditpage.cpp | 9 +- fpdfsdk/fpdfformfill.cpp | 4 +- fpdfsdk/fpdfppo.cpp | 12 +- fpdfsdk/fpdfsave.cpp | 10 +- fpdfsdk/fpdfview.cpp | 7 +- fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp | 6 +- fpdfsdk/fpdfxfa/fpdfxfa_page.cpp | 6 +- fpdfsdk/fsdk_actionhandler.cpp | 2 +- fpdfsdk/fsdk_annothandler.cpp | 3 +- fpdfsdk/fsdk_baseannot.cpp | 6 +- fpdfsdk/fsdk_baseform.cpp | 7 +- fpdfsdk/fsdk_mgr.cpp | 5 +- fpdfsdk/fsdk_rendercontext.cpp | 2 + fpdfsdk/fxedit/fxet_ap.cpp | 2 +- fpdfsdk/fxedit/fxet_pageobjs.cpp | 4 +- fpdfsdk/include/fpdfxfa/fpdfxfa_page.h | 7 + fpdfsdk/include/fsdk_define.h | 4 +- fpdfsdk/include/fsdk_mgr.h | 2 +- fpdfsdk/include/fsdk_rendercontext.h | 1 + fpdfsdk/javascript/Document.cpp | 3 +- fpdfsdk/javascript/Field.cpp | 3 +- fpdfsdk/pdfwindow/PWL_Caret.cpp | 2 + fpdfsdk/pdfwindow/PWL_ComboBox.cpp | 1 + fpdfsdk/pdfwindow/PWL_Edit.cpp | 2 + fpdfsdk/pdfwindow/PWL_FontMap.cpp | 5 +- fpdfsdk/pdfwindow/PWL_Icon.cpp | 4 +- fpdfsdk/pdfwindow/PWL_ListCtrl.cpp | 1 + fpdfsdk/pdfwindow/PWL_Note.cpp | 1 + fpdfsdk/pdfwindow/PWL_ScrollBar.cpp | 2 + fpdfsdk/pdfwindow/PWL_Signature.cpp | 1 + fpdfsdk/pdfwindow/PWL_Utils.cpp | 1 + pdfium.gyp | 60 +++-- samples/DEPS | 1 + xfa/fxfa/app/DEPS | 1 + xfa/fxfa/app/xfa_ffapp.h | 4 +- xfa/fxfa/app/xfa_ffdoc.cpp | 4 +- xfa/fxfa/app/xfa_fontmgr.cpp | 4 +- 190 files changed, 2449 insertions(+), 2215 deletions(-) create mode 100644 core/fpdfapi/fpdf_edit/include/cpdf_creator.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_boolean.h create mode 100644 core/fpdfapi/fpdf_parser/cpdf_null.h create mode 100644 core/fpdfapi/fpdf_parser/include/cfdf_document.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_array.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_document.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_name.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_number.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_object.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_parser.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_reference.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_stream.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h create mode 100644 core/fpdfapi/fpdf_parser/include/cpdf_string.h create mode 100644 core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h create mode 100644 core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h create mode 100644 core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h create mode 100644 core/fpdfapi/fpdf_parser/ipdf_occontext.cpp create mode 100644 core/fpdfapi/fpdf_parser/ipdf_occontext.h create mode 100644 core/fpdfapi/fpdf_parser/ipdf_security_handler.h create mode 100644 core/fpdfapi/fpdf_render/cpdf_pagerendercache.h create mode 100644 core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h create mode 100644 core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h create mode 100644 core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h create mode 100644 core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h create mode 100644 core/fpdfapi/include/cpdf_modulemgr.h create mode 100644 core/fpdfapi/ipdf_pagemodule.h create mode 100644 core/fpdfapi/ipdf_rendermodule.h create mode 100644 core/fxge/skia/DEPS delete mode 100644 core/include/fpdfapi/cfdf_document.h delete mode 100644 core/include/fpdfapi/cpdf_array.h delete mode 100644 core/include/fpdfapi/cpdf_boolean.h delete mode 100644 core/include/fpdfapi/cpdf_dictionary.h delete mode 100644 core/include/fpdfapi/cpdf_document.h delete mode 100644 core/include/fpdfapi/cpdf_indirect_object_holder.h delete mode 100644 core/include/fpdfapi/cpdf_name.h delete mode 100644 core/include/fpdfapi/cpdf_null.h delete mode 100644 core/include/fpdfapi/cpdf_number.h delete mode 100644 core/include/fpdfapi/cpdf_object.h delete mode 100644 core/include/fpdfapi/cpdf_parser.h delete mode 100644 core/include/fpdfapi/cpdf_reference.h delete mode 100644 core/include/fpdfapi/cpdf_simple_parser.h delete mode 100644 core/include/fpdfapi/cpdf_stream.h delete mode 100644 core/include/fpdfapi/cpdf_stream_acc.h delete mode 100644 core/include/fpdfapi/cpdf_string.h delete mode 100644 core/include/fpdfapi/fpdf_module.h delete mode 100644 core/include/fpdfapi/fpdf_parser_decode.h delete mode 100644 core/include/fpdfapi/fpdf_render.h delete mode 100644 core/include/fpdfapi/fpdf_serial.h delete mode 100644 core/include/fpdfapi/ipdf_crypto_handler.h delete mode 100644 core/include/fpdfapi/ipdf_data_avail.h delete mode 100644 core/include/fpdfapi/ipdf_security_handler.h diff --git a/BUILD.gn b/BUILD.gn index 250dcfe111..bfb1b1265a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -306,6 +306,7 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp", "core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp", "core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp", + "core/fpdfapi/fpdf_edit/include/cpdf_creator.h", "core/fpdfapi/fpdf_font/font_int.h", "core/fpdfapi/fpdf_font/fpdf_font.cpp", "core/fpdfapi/fpdf_font/fpdf_font_charset.cpp", @@ -326,6 +327,7 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_parser/cfdf_document.cpp", "core/fpdfapi/fpdf_parser/cpdf_array.cpp", "core/fpdfapi/fpdf_parser/cpdf_boolean.cpp", + "core/fpdfapi/fpdf_parser/cpdf_boolean.h", "core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp", "core/fpdfapi/fpdf_parser/cpdf_data_avail.h", "core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp", @@ -335,6 +337,7 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp", "core/fpdfapi/fpdf_parser/cpdf_name.cpp", "core/fpdfapi/fpdf_parser/cpdf_null.cpp", + "core/fpdfapi/fpdf_parser/cpdf_null.h", "core/fpdfapi/fpdf_parser/cpdf_number.cpp", "core/fpdfapi/fpdf_parser/cpdf_object.cpp", "core/fpdfapi/fpdf_parser/cpdf_parser.cpp", @@ -352,39 +355,44 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp", "core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp", "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h", + "core/fpdfapi/fpdf_parser/include/cfdf_document.h", + "core/fpdfapi/fpdf_parser/include/cpdf_array.h", + "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h", + "core/fpdfapi/fpdf_parser/include/cpdf_document.h", + "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h", + "core/fpdfapi/fpdf_parser/include/cpdf_name.h", + "core/fpdfapi/fpdf_parser/include/cpdf_number.h", + "core/fpdfapi/fpdf_parser/include/cpdf_object.h", + "core/fpdfapi/fpdf_parser/include/cpdf_parser.h", + "core/fpdfapi/fpdf_parser/include/cpdf_reference.h", + "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h", + "core/fpdfapi/fpdf_parser/include/cpdf_stream.h", + "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h", + "core/fpdfapi/fpdf_parser/include/cpdf_string.h", + "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h", + "core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h", + "core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h", + "core/fpdfapi/fpdf_parser/ipdf_occontext.cpp", + "core/fpdfapi/fpdf_parser/ipdf_occontext.h", + "core/fpdfapi/fpdf_parser/ipdf_security_handler.h", + "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h", "core/fpdfapi/fpdf_render/fpdf_render.cpp", "core/fpdfapi/fpdf_render/fpdf_render_cache.cpp", "core/fpdfapi/fpdf_render/fpdf_render_image.cpp", "core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp", "core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp", "core/fpdfapi/fpdf_render/fpdf_render_text.cpp", + "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h", + "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h", + "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h", + "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h", "core/fpdfapi/fpdf_render/render_int.h", - "core/include/fpdfapi/cfdf_document.h", - "core/include/fpdfapi/cpdf_array.h", - "core/include/fpdfapi/cpdf_boolean.h", - "core/include/fpdfapi/cpdf_dictionary.h", - "core/include/fpdfapi/cpdf_document.h", - "core/include/fpdfapi/cpdf_indirect_object_holder.h", - "core/include/fpdfapi/cpdf_name.h", - "core/include/fpdfapi/cpdf_null.h", - "core/include/fpdfapi/cpdf_number.h", - "core/include/fpdfapi/cpdf_object.h", - "core/include/fpdfapi/cpdf_parser.h", - "core/include/fpdfapi/cpdf_reference.h", - "core/include/fpdfapi/cpdf_simple_parser.h", - "core/include/fpdfapi/cpdf_stream.h", - "core/include/fpdfapi/cpdf_stream_acc.h", - "core/include/fpdfapi/cpdf_string.h", - "core/include/fpdfapi/fpdf_module.h", + "core/fpdfapi/include/cpdf_modulemgr.h", + "core/fpdfapi/ipdf_pagemodule.h", + "core/fpdfapi/ipdf_rendermodule.h", "core/include/fpdfapi/fpdf_page.h", "core/include/fpdfapi/fpdf_pageobj.h", - "core/include/fpdfapi/fpdf_parser_decode.h", - "core/include/fpdfapi/fpdf_render.h", "core/include/fpdfapi/fpdf_resource.h", - "core/include/fpdfapi/fpdf_serial.h", - "core/include/fpdfapi/ipdf_crypto_handler.h", - "core/include/fpdfapi/ipdf_data_avail.h", - "core/include/fpdfapi/ipdf_security_handler.h", ] configs += [ ":pdfium_config" ] } diff --git a/core/fpdfapi/fpdf_basic_module.cpp b/core/fpdfapi/fpdf_basic_module.cpp index cf843cc4d9..b77d998ed8 100644 --- a/core/fpdfapi/fpdf_basic_module.cpp +++ b/core/fpdfapi/fpdf_basic_module.cpp @@ -4,7 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" + +#include "core/fpdfapi/ipdf_rendermodule.h" #include "core/include/fxcodec/fx_codec.h" namespace { diff --git a/core/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp b/core/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp index a7d1b17986..51c5b1e365 100644 --- a/core/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp +++ b/core/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_resource.h" #include "core/include/fxcrt/fx_basic.h" // For FX_ArraySize(). diff --git a/core/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp b/core/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp index 4b34235a64..cf29fe7c8e 100644 --- a/core/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp +++ b/core/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_resource.h" #include "core/include/fxcrt/fx_basic.h" // For FX_ArraySize(). diff --git a/core/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp b/core/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp index 93c9be6d55..a2146230fe 100644 --- a/core/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp +++ b/core/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_resource.h" #include "core/include/fxcrt/fx_basic.h" // For FX_ArraySize(). diff --git a/core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp b/core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp index e5072104d6..d6932156e5 100644 --- a/core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp +++ b/core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp @@ -8,7 +8,7 @@ #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_resource.h" #include "core/include/fxcrt/fx_basic.h" // For FX_ArraySize(). diff --git a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp index eed376db71..d54620d701 100644 --- a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp +++ b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp @@ -7,7 +7,7 @@ #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_resource.h" void FPDFAPI_FindEmbeddedCMap(const char* name, diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index ad77455949..6010a04369 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -4,14 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/include/fpdfapi/fpdf_page.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" -#include "core/include/fpdfapi/fpdf_serial.h" CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& ar, CFX_Matrix& matrix) { ar << matrix.a << " " << matrix.b << " " << matrix.c << " " << matrix.d << " " diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 2dc2e3eb8e..da3c18fc3f 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -8,17 +8,17 @@ #include +#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" #include "core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h" #include "core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_parser.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" -#include "core/include/fpdfapi/fpdf_serial.h" -#include "core/include/fpdfapi/ipdf_crypto_handler.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h" #include "core/include/fxcrt/fx_ext.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 48e42e2a1f..121498ccd2 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -7,11 +7,12 @@ #include #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" +#include "core/fpdfapi/ipdf_rendermodule.h" #include "core/include/fpdfapi/fpdf_page.h" CPDF_Document::CPDF_Document() : CPDF_IndirectObjectHolder(NULL) { diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp index f3e6a439c2..fec596cdb2 100644 --- a/core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp +++ b/core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp @@ -5,15 +5,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "core/fpdfapi/fpdf_page/pageint.h" +#include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/fpdf_render/render_int.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_boolean.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_page.h" -#include "core/include/fpdfapi/fpdf_render.h" #include "core/include/fxcodec/fx_codec.h" CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) { diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h new file mode 100644 index 0000000000..5b5671b7e9 --- /dev/null +++ b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h @@ -0,0 +1,98 @@ +// 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_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ +#define CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ + +#include "core/include/fpdfapi/fpdf_page.h" +#include "core/include/fpdfapi/fpdf_pageobj.h" + +class CPDF_Parser; +class CPDF_XRefStream; +class IPDF_CryptoHandler; + +#define FPDFCREATE_INCREMENTAL 1 +#define FPDFCREATE_NO_ORIGINAL 2 +#define FPDFCREATE_PROGRESSIVE 4 +#define FPDFCREATE_OBJECTSTREAM 8 + +CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj); + +class CPDF_Creator { + public: + CPDF_Creator(CPDF_Document* pDoc); + ~CPDF_Creator(); + + void RemoveSecurity(); + bool Create(IFX_StreamWrite* pFile, FX_DWORD flags = 0); + int32_t Continue(IFX_Pause* pPause = NULL); + FX_BOOL SetFileVersion(int32_t fileVersion = 17); + + private: + friend class CPDF_ObjectStream; + friend class CPDF_XRefStream; + + bool Create(FX_DWORD flags); + void ResetStandardSecurity(); + void Clear(); + + void InitOldObjNumOffsets(); + void InitNewObjNumOffsets(); + void InitID(FX_BOOL bDefault = TRUE); + + void AppendNewObjNum(FX_DWORD objbum); + int32_t AppendObjectNumberToXRef(FX_DWORD objnum); + + int32_t WriteDoc_Stage1(IFX_Pause* pPause); + int32_t WriteDoc_Stage2(IFX_Pause* pPause); + int32_t WriteDoc_Stage3(IFX_Pause* pPause); + int32_t WriteDoc_Stage4(IFX_Pause* pPause); + + int32_t WriteOldIndirectObject(FX_DWORD objnum); + int32_t WriteOldObjs(IFX_Pause* pPause); + int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause); + int32_t WriteIndirectObj(const CPDF_Object* pObj); + int32_t WriteDirectObj(FX_DWORD objnum, + const CPDF_Object* pObj, + FX_BOOL bEncrypt = TRUE); + int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); + int32_t WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj); + int32_t WriteIndirectObjectToStream(FX_DWORD objnum, + const uint8_t* pBuffer, + FX_DWORD dwSize); + + int32_t WriteStream(const CPDF_Object* pStream, + FX_DWORD objnum, + IPDF_CryptoHandler* pCrypto); + + CPDF_Document* m_pDocument; + CPDF_Parser* m_pParser; + FX_BOOL m_bCompress; + FX_BOOL m_bSecurityChanged; + CPDF_Dictionary* m_pEncryptDict; + FX_DWORD m_dwEnryptObjNum; + FX_BOOL m_bEncryptCloned; + FX_BOOL m_bStandardSecurity; + IPDF_CryptoHandler* m_pCryptoHandler; + FX_BOOL m_bNewCrypto; + FX_BOOL m_bEncryptMetadata; + CPDF_Object* m_pMetadata; + CPDF_XRefStream* m_pXRefStream; + int32_t m_ObjectStreamSize; + FX_DWORD m_dwLastObjNum; + CFX_FileBufferArchive m_File; + FX_FILESIZE m_Offset; + int32_t m_iStage; + FX_DWORD m_dwFlags; + FX_POSITION m_Pos; + FX_FILESIZE m_XrefStart; + CFX_FileSizeListArray m_ObjectOffset; + CFX_DWordArray m_NewObjNumArray; + CPDF_Array* m_pIDArray; + int32_t m_FileVersion; +}; + +#endif // CORE_FPDFAPI_FPDF_EDIT_INCLUDE_CPDF_CREATOR_H_ diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp index 98411ef0f1..b1db0ebe09 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp @@ -7,13 +7,13 @@ #include "core/fpdfapi/fpdf_font/font_int.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_simple_parser.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" #include "core/include/fpdfapi/fpdf_resource.h" diff --git a/core/fpdfapi/fpdf_font/fpdf_font_charset.cpp b/core/fpdfapi/fpdf_font/fpdf_font_charset.cpp index a4167914d1..40ec22107b 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_charset.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_charset.cpp @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/include/fpdfapi/fpdf_page.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" #include "core/include/fpdfapi/fpdf_resource.h" #include "core/include/fxge/fx_freetype.h" diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 91fb9fc2ae..321fc593fe 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -8,10 +8,10 @@ #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" #include "core/fpdfapi/fpdf_font/ttgsubtable.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_simple_parser.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_resource.h" #include "core/include/fxcrt/fx_ext.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page.cpp b/core/fpdfapi/fpdf_page/fpdf_page.cpp index 5d4a584349..2cec0928dd 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page.cpp @@ -8,10 +8,11 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" +#include "core/fpdfapi/ipdf_rendermodule.h" #include "core/include/fpdfapi/fpdf_page.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp index f557669a77..040821bc06 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -10,11 +10,11 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fxcodec/fx_codec.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp index 76ecdccae3..9da5d1fe00 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -8,12 +8,15 @@ #include "core/fdrm/crypto/include/fx_crypt.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" +#include "core/fpdfapi/ipdf_pagemodule.h" #include "core/include/fpdfapi/fpdf_page.h" +namespace { + class CPDF_PageModule : public IPDF_PageModule { public: CPDF_PageModule() @@ -48,6 +51,8 @@ class CPDF_PageModule : public IPDF_PageModule { CPDF_PatternCS m_StockPatternCS; }; +} // namespace + CPDF_ColorSpace* CPDF_PageModule::GetStockCS(int family) { if (family == PDFCS_DEVICEGRAY) { return &m_StockGrayCS; diff --git a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp index fd37e1d3e4..00ca2d8d18 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -12,10 +12,9 @@ #include #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_simple_parser.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fxcrt/fx_safe_types.h" #include "third_party/base/numerics/safe_conversions_impl.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp index 76753d2965..99156411f6 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -8,14 +8,12 @@ #include +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_render/render_int.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "core/include/fpdfapi/fpdf_render.h" #include "third_party/base/stl_util.h" namespace { diff --git a/core/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/fpdfapi/fpdf_page/fpdf_page_image.cpp index a88d2b30bd..cd89725de2 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_image.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_image.cpp @@ -6,8 +6,8 @@ #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index e4cdaba9d0..69ff8da21f 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -8,16 +8,15 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/include/fpdfapi/fpdf_page.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" -#include "core/include/fpdfapi/fpdf_serial.h" namespace { diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 13c56b4718..36be007b68 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -8,18 +8,18 @@ #include +#include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" +#include "core/fpdfapi/fpdf_parser/cpdf_null.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_boolean.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_null.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_page.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" #include "core/include/fxcodec/fx_codec.h" #include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_safe_types.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_path.cpp b/core/fpdfapi/fpdf_page/fpdf_page_path.cpp index c2b6f13ca0..07c6ae1a80 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_path.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_path.cpp @@ -6,7 +6,6 @@ #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index 6bb64292a3..7e22661624 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -8,9 +8,9 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/include/fpdfapi/fpdf_page.h" namespace { diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp index fd144a10a9..dec8fbdfaf 100644 --- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp @@ -4,11 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cfdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cfdf_document.h" +#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.h" #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/fpdf_serial.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" CFDF_Document::CFDF_Document() : CPDF_IndirectObjectHolder(NULL) { m_pRootDict = NULL; diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp index 3b21a45ae2..acd39a9390 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp @@ -4,13 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" CPDF_Array::CPDF_Array() {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_boolean.cpp b/core/fpdfapi/fpdf_parser/cpdf_boolean.cpp index 75f2203954..cd7ed32a96 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_boolean.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_boolean.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_boolean.h" +#include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" CPDF_Boolean::CPDF_Boolean() : m_bValue(false) {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_boolean.h b/core/fpdfapi/fpdf_parser/cpdf_boolean.h new file mode 100644 index 0000000000..9a35153a20 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_boolean.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_FPDFAPI_FPDF_PARSER_CPDF_BOOLEAN_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_BOOLEAN_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDF_Boolean : public CPDF_Object { + public: + CPDF_Boolean(); + explicit CPDF_Boolean(FX_BOOL value); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; + CFX_ByteString GetString() const override; + int GetInteger() const override; + void SetString(const CFX_ByteString& str) override; + bool IsBoolean() const override; + CPDF_Boolean* AsBoolean() override; + const CPDF_Boolean* AsBoolean() const override; + + protected: + ~CPDF_Boolean() override; + + FX_BOOL m_bValue; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_BOOLEAN_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp index 93916cba8b..1f7f70fa91 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp @@ -4,15 +4,18 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h" + #include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_safe_types.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h index 2a6995914c..c30093dd58 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.h +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.h @@ -9,8 +9,8 @@ #include "core/fpdfapi/fpdf_parser/cpdf_hint_tables.h" #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" -#include "core/include/fpdfapi/cpdf_parser.h" -#include "core/include/fpdfapi/ipdf_data_avail.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h" #include "core/include/fxcrt/fx_basic.h" class CPDF_Dictionary; diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp index 864cd59744..0155c43bb8 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp @@ -4,15 +4,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_dictionary.h" - -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_boolean.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" + +#include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" #include "third_party/base/stl_util.h" CPDF_Dictionary::CPDF_Dictionary() {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index c6bdcddfbe..6a6e40f1c6 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -4,16 +4,17 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" #include "core/fpdfapi/fpdf_render/render_int.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_parser.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" +#include "core/fpdfapi/ipdf_rendermodule.h" #include "core/include/fxge/fx_font.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp index 1dc015f34f..166c68d51a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.cpp @@ -7,10 +7,10 @@ #include "core/fpdfapi/fpdf_parser/cpdf_hint_tables.h" #include "core/fpdfapi/fpdf_parser/cpdf_data_avail.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "core/include/fxcrt/fx_safe_types.h" namespace { diff --git a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h index a9a89b48bf..325f57611f 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h +++ b/core/fpdfapi/fpdf_parser/cpdf_hint_tables.h @@ -9,7 +9,7 @@ #include -#include "core/include/fpdfapi/ipdf_data_avail.h" +#include "core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h" #include "core/include/fxcrt/fx_basic.h" #include "core/include/fxcrt/fx_stream.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp index b1606f9857..1de1ef2252 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp @@ -4,9 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_indirect_object_holder.h" -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fpdfapi/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" + +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" CPDF_IndirectObjectHolder::CPDF_IndirectObjectHolder(CPDF_Parser* pParser) : m_pParser(pParser), m_LastObjNum(0) { diff --git a/core/fpdfapi/fpdf_parser/cpdf_name.cpp b/core/fpdfapi/fpdf_parser/cpdf_name.cpp index 03d523db19..db37754b66 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_name.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_name.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" CPDF_Name::CPDF_Name(const CFX_ByteString& str) : m_Name(str) {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_null.cpp b/core/fpdfapi/fpdf_parser/cpdf_null.cpp index c18449d08f..c74daf300f 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_null.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_null.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_null.h" +#include "core/fpdfapi/fpdf_parser/cpdf_null.h" CPDF_Null::CPDF_Null() {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_null.h b/core/fpdfapi/fpdf_parser/cpdf_null.h new file mode 100644 index 0000000000..ae33bb0256 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/cpdf_null.h @@ -0,0 +1,21 @@ +// 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_FPDFAPI_FPDF_PARSER_CPDF_NULL_H_ +#define CORE_FPDFAPI_FPDF_PARSER_CPDF_NULL_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" + +class CPDF_Null : public CPDF_Object { + public: + CPDF_Null(); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_CPDF_NULL_H_ diff --git a/core/fpdfapi/fpdf_parser/cpdf_number.cpp b/core/fpdfapi/fpdf_parser/cpdf_number.cpp index ddc7aa11a2..d2f0503bc1 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_number.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_number.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" CPDF_Number::CPDF_Number() : m_bInteger(TRUE), m_Integer(0) {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_object.cpp b/core/fpdfapi/fpdf_parser/cpdf_object.cpp index 208bca8e6c..ad00cc113b 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_object.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_object.cpp @@ -4,15 +4,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_indirect_object_holder.h" -#include "core/include/fpdfapi/cpdf_parser.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/include/fxcrt/fx_string.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp index 971bdaf20e..529b6c4fd3 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp @@ -2,21 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_boolean.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_null.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" +#include "core/fpdfapi/fpdf_parser/cpdf_null.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#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_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" #include #include #include -#include "core/include/fpdfapi/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" #include "core/include/fxcrt/fx_basic.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp index b57405f092..c9b8583d16 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp @@ -4,21 +4,21 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" #include #include "core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h" #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_stream_acc.h" -#include "core/include/fpdfapi/ipdf_crypto_handler.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.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_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h" #include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_safe_types.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp index 2d1dcd4b5c..b343618f28 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser_unittest.cpp @@ -6,7 +6,7 @@ #include #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" -#include "core/include/fpdfapi/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" #include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_stream.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp index 4aede7d07a..6aa8fe9b4a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_reference.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_reference.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" CPDF_Reference::CPDF_Reference(CPDF_IndirectObjectHolder* pDoc, int objnum) : m_pObjList(pDoc), m_RefObjNum(objnum) {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp index 90d4e0b5ab..a13fb0f365 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp index a9acff4155..cfb0b33279 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_simple_parser_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_simple_parser_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/fpdfapi/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp index 0be414a135..17ef914c80 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.cpp @@ -9,9 +9,9 @@ #include #include "core/fdrm/crypto/include/fx_crypt.h" -#include "core/include/fpdfapi/cpdf_parser.h" -#include "core/include/fpdfapi/cpdf_simple_parser.h" -#include "core/include/fpdfapi/ipdf_security_handler.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/ipdf_security_handler.h" IPDF_CryptoHandler::~IPDF_CryptoHandler() {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h index 28b7503f6e..c40fa7d0a4 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h @@ -7,7 +7,7 @@ #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_STANDARD_CRYPTO_HANDLER_H_ #define CORE_FPDFAPI_FPDF_PARSER_CPDF_STANDARD_CRYPTO_HANDLER_H_ -#include "core/include/fpdfapi/ipdf_crypto_handler.h" +#include "core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h" class CPDF_StandardCryptoHandler : public IPDF_CryptoHandler { public: diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp index 6da4cb1ff6..14e7ed65d3 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp @@ -10,10 +10,10 @@ #include "core/fdrm/crypto/include/fx_crypt.h" #include "core/fpdfapi/fpdf_parser/cpdf_standard_crypto_handler.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fpdfapi/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" namespace { diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h index 3341ec391c..7acaabcaef 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.h @@ -7,7 +7,7 @@ #ifndef CORE_FPDFAPI_FPDF_PARSER_CPDF_STANDARD_SECURITY_HANDLER_H_ #define CORE_FPDFAPI_FPDF_PARSER_CPDF_STANDARD_SECURITY_HANDLER_H_ -#include "core/include/fpdfapi/ipdf_security_handler.h" +#include "core/fpdfapi/fpdf_parser/ipdf_security_handler.h" #include "core/include/fxcrt/fx_string.h" #include "core/include/fxcrt/fx_system.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp index 7faf9ddd44..72ecb7e9de 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp @@ -4,11 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_stream_acc.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" CPDF_Stream::CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict) : m_pDict(pDict), diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp index 51ab1c0134..f10e33758c 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_stream_acc.cpp @@ -4,10 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" CPDF_StreamAcc::CPDF_StreamAcc() : m_pData(nullptr), diff --git a/core/fpdfapi/fpdf_parser/cpdf_string.cpp b/core/fpdfapi/fpdf_parser/cpdf_string.cpp index 1d0bf0b829..9a88e937ab 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_string.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_string.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" CPDF_String::CPDF_String() : m_bHex(FALSE) {} diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp index f5464cc21e..9e5cb9d38a 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp @@ -8,19 +8,19 @@ #include +#include "core/fpdfapi/fpdf_parser/cpdf_boolean.h" +#include "core/fpdfapi/fpdf_parser/cpdf_null.h" #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_boolean.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_null.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_module.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" -#include "core/include/fpdfapi/ipdf_crypto_handler.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#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_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fxcrt/fx_ext.h" #include "third_party/base/numerics/safe_math.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser_unittest.cpp index f501c01715..53a01e0224 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser_unittest.cpp @@ -6,7 +6,7 @@ #include #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" -#include "core/include/fpdfapi/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" #include "core/include/fxcrt/fx_ext.h" #include "core/include/fxcrt/fx_stream.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp index eeb365d0e6..f7fc3099fc 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp @@ -4,15 +4,15 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include #include #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fxcodec/fx_codec.h" #include "core/include/fxcrt/fx_ext.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp index 2412f4310c..9e8d3344c3 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_embeddertest.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/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include #include diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp index e00759da7a..81f8cae354 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_decode_unittest.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_decode_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/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index 3df220b79e..ffd4388dcc 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -6,14 +6,14 @@ #include "core/fpdfapi/fpdf_parser/fpdf_parser_utility.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_stream_acc.h" -#include "core/include/fpdfapi/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/include/fxcrt/fx_ext.h" // Indexed by 8-bit character code, contains either: diff --git a/core/fpdfapi/fpdf_parser/include/cfdf_document.h b/core/fpdfapi/fpdf_parser/include/cfdf_document.h new file mode 100644 index 0000000000..bd68789a14 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cfdf_document.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_FPDFAPI_FPDF_PARSER_INCLUDE_CFDF_DOCUMENT_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CFDF_DOCUMENT_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/include/fxcrt/fx_basic.h" + +class CPDF_Dictionary; + +class CFDF_Document : public CPDF_IndirectObjectHolder { + public: + static CFDF_Document* CreateNewDoc(); + static CFDF_Document* ParseFile(IFX_FileRead* pFile, + FX_BOOL bOwnFile = FALSE); + static CFDF_Document* ParseMemory(const uint8_t* pData, FX_DWORD size); + ~CFDF_Document(); + + FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const; + CPDF_Dictionary* GetRoot() const { return m_pRootDict; } + + protected: + CFDF_Document(); + void ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile); + + CPDF_Dictionary* m_pRootDict; + IFX_FileRead* m_pFile; + FX_BOOL m_bOwnFile; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CFDF_DOCUMENT_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_array.h b/core/fpdfapi/fpdf_parser/include/cpdf_array.h new file mode 100644 index 0000000000..a166454eba --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_array.h @@ -0,0 +1,65 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/include/fxcrt/fx_basic.h" +#include "core/include/fxcrt/fx_coordinates.h" + +class CPDF_Array : public CPDF_Object { + public: + CPDF_Array(); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; + CPDF_Array* GetArray() const override; + bool IsArray() const override; + CPDF_Array* AsArray() override; + const CPDF_Array* AsArray() const override; + + FX_DWORD GetCount() const { return m_Objects.GetSize(); } + CPDF_Object* GetElement(FX_DWORD index) const; + CPDF_Object* GetElementValue(FX_DWORD index) const; + CFX_Matrix GetMatrix(); + CFX_FloatRect GetRect(); + CFX_ByteString GetStringAt(FX_DWORD index) const; + CFX_ByteStringC GetConstStringAt(FX_DWORD index) const; + int GetIntegerAt(FX_DWORD index) const; + FX_FLOAT GetNumberAt(FX_DWORD index) const; + CPDF_Dictionary* GetDictAt(FX_DWORD index) const; + CPDF_Stream* GetStreamAt(FX_DWORD index) const; + CPDF_Array* GetArrayAt(FX_DWORD index) const; + FX_FLOAT GetFloatAt(FX_DWORD index) const { return GetNumberAt(index); } + + void SetAt(FX_DWORD index, + CPDF_Object* pObj, + CPDF_IndirectObjectHolder* pObjs = nullptr); + void InsertAt(FX_DWORD index, + CPDF_Object* pObj, + CPDF_IndirectObjectHolder* pObjs = nullptr); + void RemoveAt(FX_DWORD index, int nCount = 1); + + void Add(CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs = nullptr); + void AddNumber(FX_FLOAT f); + void AddInteger(int i); + void AddString(const CFX_ByteString& str); + void AddName(const CFX_ByteString& str); + void AddReference(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum); + void AddReference(CPDF_IndirectObjectHolder* pDoc, CPDF_Object* obj) { + AddReference(pDoc, obj->GetObjNum()); + } + + protected: + ~CPDF_Array() override; + + CFX_ArrayTemplate m_Objects; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_ARRAY_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h new file mode 100644 index 0000000000..896db62cc2 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h @@ -0,0 +1,99 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ + +#include + +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/include/fxcrt/fx_coordinates.h" +#include "core/include/fxcrt/fx_string.h" + +class CPDF_IndirectObjectHolder; + +class CPDF_Dictionary : public CPDF_Object { + public: + using iterator = std::map::iterator; + using const_iterator = std::map::const_iterator; + + CPDF_Dictionary(); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; + CPDF_Dictionary* GetDict() const override; + bool IsDictionary() const override; + CPDF_Dictionary* AsDictionary() override; + const CPDF_Dictionary* AsDictionary() const override; + + size_t GetCount() const { return m_Map.size(); } + CPDF_Object* GetElement(const CFX_ByteStringC& key) const; + CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; + CFX_ByteString GetStringBy(const CFX_ByteStringC& key) const; + CFX_ByteStringC GetConstStringBy(const CFX_ByteStringC& key) const; + CFX_ByteString GetStringBy(const CFX_ByteStringC& key, + const CFX_ByteStringC& default_str) const; + CFX_ByteStringC GetConstStringBy(const CFX_ByteStringC& key, + const CFX_ByteStringC& default_str) const; + CFX_WideString GetUnicodeTextBy(const CFX_ByteStringC& key) const; + int GetIntegerBy(const CFX_ByteStringC& key) const; + int GetIntegerBy(const CFX_ByteStringC& key, int default_int) const; + FX_BOOL GetBooleanBy(const CFX_ByteStringC& key, + FX_BOOL bDefault = FALSE) const; + FX_FLOAT GetNumberBy(const CFX_ByteStringC& key) const; + CPDF_Dictionary* GetDictBy(const CFX_ByteStringC& key) const; + CPDF_Stream* GetStreamBy(const CFX_ByteStringC& key) const; + CPDF_Array* GetArrayBy(const CFX_ByteStringC& key) const; + CFX_FloatRect GetRectBy(const CFX_ByteStringC& key) const; + CFX_Matrix GetMatrixBy(const CFX_ByteStringC& key) const; + FX_FLOAT GetFloatBy(const CFX_ByteStringC& key) const { + return GetNumberBy(key); + } + + FX_BOOL KeyExist(const CFX_ByteStringC& key) const; + bool IsSignatureDict() const; + + // Set* functions invalidate iterators for the element with the key |key|. + void SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj); + void SetAtName(const CFX_ByteStringC& key, const CFX_ByteString& name); + void SetAtString(const CFX_ByteStringC& key, const CFX_ByteString& str); + void SetAtInteger(const CFX_ByteStringC& key, int i); + void SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f); + void SetAtReference(const CFX_ByteStringC& key, + CPDF_IndirectObjectHolder* pDoc, + FX_DWORD objnum); + void SetAtReference(const CFX_ByteStringC& key, + CPDF_IndirectObjectHolder* pDoc, + CPDF_Object* obj) { + SetAtReference(key, pDoc, obj->GetObjNum()); + } + void SetAtRect(const CFX_ByteStringC& key, const CFX_FloatRect& rect); + void SetAtMatrix(const CFX_ByteStringC& key, const CFX_Matrix& matrix); + void SetAtBoolean(const CFX_ByteStringC& key, FX_BOOL bValue); + + void AddReference(const CFX_ByteStringC& key, + CPDF_IndirectObjectHolder* pDoc, + FX_DWORD objnum); + + // Invalidates iterators for the element with the key |key|. + void RemoveAt(const CFX_ByteStringC& key); + + // Invalidates iterators for the element with the key |oldkey|. + void ReplaceKey(const CFX_ByteStringC& oldkey, const CFX_ByteStringC& newkey); + + iterator begin() { return m_Map.begin(); } + iterator end() { return m_Map.end(); } + const_iterator begin() const { return m_Map.begin(); } + const_iterator end() const { return m_Map.end(); } + + protected: + ~CPDF_Dictionary() override; + + std::map m_Map; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DICTIONARY_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h new file mode 100644 index 0000000000..56e41b4328 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h @@ -0,0 +1,137 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/include/fxcrt/fx_basic.h" + +class CFX_Font; +class CFX_Matrix; +class CPDF_ColorSpace; +class CPDF_DocPageData; +class CPDF_DocRenderData; +class CPDF_Font; +class CPDF_FontEncoding; +class CPDF_IccProfile; +class CPDF_Image; +class CPDF_Pattern; +class CPDF_StreamAcc; + +#define FPDFPERM_PRINT 0x0004 +#define FPDFPERM_MODIFY 0x0008 +#define FPDFPERM_EXTRACT 0x0010 +#define FPDFPERM_ANNOT_FORM 0x0020 +#define FPDFPERM_FILL_FORM 0x0100 +#define FPDFPERM_EXTRACT_ACCESS 0x0200 +#define FPDFPERM_ASSEMBLE 0x0400 +#define FPDFPERM_PRINT_HIGH 0x0800 +#define FPDF_PAGE_MAX_NUM 0xFFFFF + +class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder { + public: + CPDF_Document(); + explicit CPDF_Document(CPDF_Parser* pParser); + ~CPDF_Document(); + + CPDF_Parser* GetParser() const { return m_pParser; } + CPDF_Dictionary* GetRoot() const { return m_pRootDict; } + CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } + + void GetID(CFX_ByteString& id1, CFX_ByteString& id2) const { + id1 = m_ID1; + id2 = m_ID2; + } + + int GetPageCount() const; + CPDF_Dictionary* GetPage(int iPage); + int GetPageIndex(FX_DWORD objnum); + FX_DWORD GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const; + CPDF_DocPageData* GetPageData() { return GetValidatePageData(); } + void ClearPageData(); + void RemoveColorSpaceFromPageData(CPDF_Object* pObject); + + CPDF_DocRenderData* GetRenderData() { return GetValidateRenderData(); } + void ClearRenderData(); + void ClearRenderFont(); + + FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const; + + // |pFontDict| must not be null. + CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict); + CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj, + CPDF_Dictionary* pResources = NULL); + + CPDF_Pattern* LoadPattern(CPDF_Object* pObj, + FX_BOOL bShading, + const CFX_Matrix* matrix = NULL); + + CPDF_Image* LoadImageF(CPDF_Object* pObj); + CPDF_StreamAcc* LoadFontFile(CPDF_Stream* pStream); + CPDF_IccProfile* LoadIccProfile(CPDF_Stream* pStream); + +#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ + + CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont, + FX_BOOL bVert, + FX_BOOL bTranslateName = FALSE); + CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, + FX_BOOL bVert, + FX_BOOL bTranslateName = FALSE); +#endif +#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ + CPDF_Font* AddMacFont(CTFontRef pFont, + FX_BOOL bVert, + FX_BOOL bTranslateName = FALSE); +#endif + + CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding); + CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert); + void CreateNewDoc(); + + CPDF_Dictionary* CreateNewPage(int iPage); + void DeletePage(int iPage); + + void LoadDoc(); + void LoadAsynDoc(CPDF_Dictionary* pLinearized); + void LoadPages(); + + protected: + // Retrieve page count information by getting count value from the tree nodes + // or walking through the tree nodes to calculate it. + int RetrievePageCount() const; + CPDF_Dictionary* _FindPDFPage(CPDF_Dictionary* pPages, + int iPage, + int nPagesToGo, + int level); + int _FindPageIndex(CPDF_Dictionary* pNode, + FX_DWORD& skip_count, + FX_DWORD objnum, + int& index, + int level = 0); + FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting); + CPDF_DocPageData* GetValidatePageData(); + CPDF_DocRenderData* GetValidateRenderData(); + friend class CPDF_Creator; + friend class CPDF_Parser; + friend class CPDF_DataAvail; + friend class CPDF_OCContext; + + CPDF_Dictionary* m_pRootDict; + CPDF_Dictionary* m_pInfoDict; + CFX_ByteString m_ID1; + CFX_ByteString m_ID2; + FX_BOOL m_bLinearized; + FX_DWORD m_dwFirstPageNo; + FX_DWORD m_dwFirstPageObjNum; + CFX_DWordArray m_PageList; + CPDF_DocPageData* m_pDocPage; + CPDF_DocRenderData* m_pDocRender; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_DOCUMENT_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h new file mode 100644 index 0000000000..9fa6770c90 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h @@ -0,0 +1,44 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ + +#include + +#include "core/include/fxcrt/fx_system.h" + +class CPDF_Object; +class CPDF_Parser; + +class CPDF_IndirectObjectHolder { + public: + using iterator = std::map::iterator; + using const_iterator = std::map::const_iterator; + + explicit CPDF_IndirectObjectHolder(CPDF_Parser* pParser); + ~CPDF_IndirectObjectHolder(); + + CPDF_Object* GetIndirectObject(FX_DWORD objnum); + FX_DWORD AddIndirectObject(CPDF_Object* pObj); + void ReleaseIndirectObject(FX_DWORD objnum); + + // Takes ownership of |pObj|. + FX_BOOL InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj); + + FX_DWORD GetLastObjNum() const { return m_LastObjNum; } + iterator begin() { return m_IndirectObjs.begin(); } + const_iterator begin() const { return m_IndirectObjs.begin(); } + iterator end() { return m_IndirectObjs.end(); } + const_iterator end() const { return m_IndirectObjs.end(); } + + protected: + CPDF_Parser* m_pParser; + FX_DWORD m_LastObjNum; + std::map m_IndirectObjs; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_INDIRECT_OBJECT_HOLDER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_name.h b/core/fpdfapi/fpdf_parser/include/cpdf_name.h new file mode 100644 index 0000000000..62fd5c14a8 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_name.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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NAME_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NAME_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" + +class CPDF_Name : public CPDF_Object { + public: + explicit CPDF_Name(const CFX_ByteString& str); + explicit CPDF_Name(const CFX_ByteStringC& str); + explicit CPDF_Name(const FX_CHAR* str); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; + CFX_ByteString GetString() const override; + CFX_ByteStringC GetConstString() const override; + CFX_WideString GetUnicodeText() const override; + void SetString(const CFX_ByteString& str) override; + bool IsName() const override; + CPDF_Name* AsName() override; + const CPDF_Name* AsName() const override; + + protected: + ~CPDF_Name() override; + + CFX_ByteString m_Name; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NAME_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_number.h b/core/fpdfapi/fpdf_parser/include/cpdf_number.h new file mode 100644 index 0000000000..89586352f6 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_number.h @@ -0,0 +1,44 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NUMBER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NUMBER_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDF_Number : public CPDF_Object { + public: + CPDF_Number(); + explicit CPDF_Number(int value); + explicit CPDF_Number(FX_FLOAT value); + explicit CPDF_Number(const CFX_ByteStringC& str); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; + CFX_ByteString GetString() const override; + FX_FLOAT GetNumber() const override; + int GetInteger() const override; + void SetString(const CFX_ByteString& str) override; + bool IsNumber() const override; + CPDF_Number* AsNumber() override; + const CPDF_Number* AsNumber() const override; + + FX_BOOL IsInteger() { return m_bInteger; } + + protected: + ~CPDF_Number() override; + + FX_BOOL m_bInteger; + union { + int m_Integer; + FX_FLOAT m_Float; + }; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_NUMBER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h new file mode 100644 index 0000000000..9149510536 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h @@ -0,0 +1,161 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ + +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDF_Array; +class CPDF_Boolean; +class CPDF_Dictionary; +class CPDF_Name; +class CPDF_Null; +class CPDF_Number; +class CPDF_Reference; +class CPDF_Stream; +class CPDF_String; + +class CPDF_Object { + public: + enum Type { + BOOLEAN = 1, + NUMBER, + STRING, + NAME, + ARRAY, + DICTIONARY, + STREAM, + NULLOBJ, + REFERENCE + }; + + virtual Type GetType() const = 0; + FX_DWORD GetObjNum() const { return m_ObjNum; } + FX_DWORD GetGenNum() const { return m_GenNum; } + + virtual CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const = 0; + virtual CPDF_Object* GetDirect() const; + + FX_BOOL IsModified() const { return FALSE; } + void Release(); + + virtual CFX_ByteString GetString() const; + virtual CFX_ByteStringC GetConstString() const; + virtual CFX_WideString GetUnicodeText() const; + virtual FX_FLOAT GetNumber() const; + virtual int GetInteger() const; + virtual CPDF_Dictionary* GetDict() const; + virtual CPDF_Array* GetArray() const; + + virtual void SetString(const CFX_ByteString& str); + + virtual bool IsArray() const; + virtual bool IsBoolean() const; + virtual bool IsDictionary() const; + virtual bool IsName() const; + virtual bool IsNumber() const; + virtual bool IsReference() const; + virtual bool IsStream() const; + virtual bool IsString() const; + + virtual CPDF_Array* AsArray(); + virtual const CPDF_Array* AsArray() const; + virtual CPDF_Boolean* AsBoolean(); + virtual const CPDF_Boolean* AsBoolean() const; + virtual CPDF_Dictionary* AsDictionary(); + virtual const CPDF_Dictionary* AsDictionary() const; + virtual CPDF_Name* AsName(); + virtual const CPDF_Name* AsName() const; + virtual CPDF_Number* AsNumber(); + virtual const CPDF_Number* AsNumber() const; + virtual CPDF_Reference* AsReference(); + virtual const CPDF_Reference* AsReference() const; + virtual CPDF_Stream* AsStream(); + virtual const CPDF_Stream* AsStream() const; + virtual CPDF_String* AsString(); + virtual const CPDF_String* AsString() const; + + protected: + CPDF_Object() : m_ObjNum(0), m_GenNum(0) {} + virtual ~CPDF_Object(); + void Destroy() { delete this; } + + FX_DWORD m_ObjNum; + FX_DWORD m_GenNum; + + friend class CPDF_IndirectObjectHolder; + friend class CPDF_Parser; + + private: + CPDF_Object(const CPDF_Object& src) {} +}; + +inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) { + return obj ? obj->AsBoolean() : nullptr; +} + +inline const CPDF_Boolean* ToBoolean(const CPDF_Object* obj) { + return obj ? obj->AsBoolean() : nullptr; +} + +inline CPDF_Number* ToNumber(CPDF_Object* obj) { + return obj ? obj->AsNumber() : nullptr; +} + +inline const CPDF_Number* ToNumber(const CPDF_Object* obj) { + return obj ? obj->AsNumber() : nullptr; +} + +inline CPDF_String* ToString(CPDF_Object* obj) { + return obj ? obj->AsString() : nullptr; +} + +inline const CPDF_String* ToString(const CPDF_Object* obj) { + return obj ? obj->AsString() : nullptr; +} + +inline CPDF_Name* ToName(CPDF_Object* obj) { + return obj ? obj->AsName() : nullptr; +} + +inline const CPDF_Name* ToName(const CPDF_Object* obj) { + return obj ? obj->AsName() : nullptr; +} + +inline CPDF_Array* ToArray(CPDF_Object* obj) { + return obj ? obj->AsArray() : nullptr; +} + +inline const CPDF_Array* ToArray(const CPDF_Object* obj) { + return obj ? obj->AsArray() : nullptr; +} + +inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) { + return obj ? obj->AsDictionary() : nullptr; +} + +inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) { + return obj ? obj->AsDictionary() : nullptr; +} +inline CPDF_Reference* ToReference(CPDF_Object* obj) { + return obj ? obj->AsReference() : nullptr; +} + +inline const CPDF_Reference* ToReference(const CPDF_Object* obj) { + return obj ? obj->AsReference() : nullptr; +} + +inline CPDF_Stream* ToStream(CPDF_Object* obj) { + return obj ? obj->AsStream() : nullptr; +} + +inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { + return obj ? obj->AsStream() : nullptr; +} + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_OBJECT_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h new file mode 100644 index 0000000000..d5c5216b9c --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_parser.h @@ -0,0 +1,173 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ + +#include +#include +#include + +#include "core/include/fxcrt/fx_basic.h" + +class CPDF_Array; +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_IndirectObjectHolder; +class CPDF_Object; +class CPDF_StreamAcc; +class CPDF_SyntaxParser; +class IFX_FileRead; +class IPDF_CryptoHandler; +class IPDF_SecurityHandler; + +class CPDF_Parser { + public: + enum Error { + SUCCESS = 0, + FILE_ERROR, + FORMAT_ERROR, + PASSWORD_ERROR, + HANDLER_ERROR + }; + + CPDF_Parser(); + ~CPDF_Parser(); + + Error StartParse(IFX_FileRead* pFile); + FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); + + void SetPassword(const FX_CHAR* password) { m_Password = password; } + CFX_ByteString GetPassword() { return m_Password; } + CPDF_Dictionary* GetTrailer() const { return m_pTrailer; } + FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } + CPDF_Document* GetDocument() const { return m_pDocument; } + + FX_DWORD GetRootObjNum(); + FX_DWORD GetInfoObjNum(); + CPDF_Array* GetIDArray(); + + CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; } + + CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList, + FX_DWORD objnum); + + FX_DWORD GetLastObjNum() const; + bool IsValidObjectNumber(FX_DWORD objnum) const; + FX_FILESIZE GetObjectPositionOrZero(FX_DWORD objnum) const; + uint8_t GetObjectType(FX_DWORD objnum) const; + uint16_t GetObjectGenNum(FX_DWORD objnum) const; + bool IsVersionUpdated() const { return m_bVersionUpdated; } + bool IsObjectFreeOrNull(FX_DWORD objnum) const; + FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); + IPDF_CryptoHandler* GetCryptoHandler(); + IFX_FileRead* GetFileAccess() const; + + FX_FILESIZE GetObjectOffset(FX_DWORD objnum) const; + FX_FILESIZE GetObjectSize(FX_DWORD objnum) const; + + void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); + int GetFileVersion() const { return m_FileVersion; } + FX_BOOL IsXRefStream() const { return m_bXRefStream; } + + CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList, + FX_FILESIZE pos, + FX_DWORD objnum); + + CPDF_Object* ParseIndirectObjectAtByStrict( + CPDF_IndirectObjectHolder* pObjList, + FX_FILESIZE pos, + FX_DWORD objnum, + FX_FILESIZE* pResultPos); + + Error StartAsyncParse(IFX_FileRead* pFile); + + FX_DWORD GetFirstPageNo() const { return m_dwFirstPageNo; } + + protected: + struct ObjectInfo { + ObjectInfo() : pos(0), type(0), gennum(0) {} + + FX_FILESIZE pos; + uint8_t type; + uint16_t gennum; + }; + + void CloseParser(); + CPDF_Object* ParseDirect(CPDF_Object* pObj); + FX_BOOL LoadAllCrossRefV4(FX_FILESIZE pos); + FX_BOOL LoadAllCrossRefV5(FX_FILESIZE pos); + bool LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_BOOL bSkip); + FX_BOOL LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef); + CPDF_Dictionary* LoadTrailerV4(); + FX_BOOL RebuildCrossRef(); + Error SetEncryptHandler(); + void ReleaseEncryptHandler(); + FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); + FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); + FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); + Error LoadLinearizedMainXRefTable(); + CPDF_StreamAcc* GetObjectStream(FX_DWORD number); + FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset); + void SetEncryptDictionary(CPDF_Dictionary* pDict); + void ShrinkObjectMap(FX_DWORD size); + + CPDF_Document* m_pDocument; + std::unique_ptr m_pSyntax; + bool m_bOwnFileRead; + int m_FileVersion; + CPDF_Dictionary* m_pTrailer; + CPDF_Dictionary* m_pEncryptDict; + FX_FILESIZE m_LastXRefOffset; + FX_BOOL m_bXRefStream; + std::unique_ptr m_pSecurityHandler; + CFX_ByteString m_bsRecipient; + CFX_ByteString m_FilePath; + CFX_ByteString m_Password; + std::map m_ObjectInfo; + std::set m_SortedOffset; + CFX_ArrayTemplate m_Trailers; + bool m_bVersionUpdated; + CPDF_Object* m_pLinearized; + FX_DWORD m_dwFirstPageNo; + FX_DWORD m_dwXrefStartObjNum; + + // A map of object numbers to indirect streams. Map owns the streams. + std::map> m_ObjectStreamMap; + + // Mapping of object numbers to offsets. The offsets are relative to the first + // object in the stream. + using StreamObjectCache = std::map; + + // Mapping of streams to their object caches. This is valid as long as the + // streams in |m_ObjectStreamMap| are valid. + std::map m_ObjCache; + + // All indirect object numbers that are being parsed. + std::set m_ParsingObjNums; + + friend class CPDF_DataAvail; + + private: + enum class ParserState { + kDefault, + kComment, + kWhitespace, + kString, + kHexString, + kEscapedString, + kXref, + kObjNum, + kPostObjNum, + kGenNum, + kPostGenNum, + kTrailer, + kBeginObj, + kEndObj + }; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_PARSER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_reference.h b/core/fpdfapi/fpdf_parser/include/cpdf_reference.h new file mode 100644 index 0000000000..f44f1e437b --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_reference.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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_REFERENCE_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_REFERENCE_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" + +class CPDF_IndirectObjectHolder; + +class CPDF_Reference : public CPDF_Object { + public: + CPDF_Reference(CPDF_IndirectObjectHolder* pDoc, int objnum); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; + CPDF_Object* GetDirect() const override; + CFX_ByteString GetString() const override; + CFX_ByteStringC GetConstString() const override; + FX_FLOAT GetNumber() const override; + int GetInteger() const override; + CPDF_Dictionary* GetDict() const override; + + // TODO(weili): check whether GetUnicodeText() and GetArray() are needed. + bool IsReference() const override; + CPDF_Reference* AsReference() override; + const CPDF_Reference* AsReference() const override; + + CPDF_IndirectObjectHolder* GetObjList() const { return m_pObjList; } + FX_DWORD GetRefObjNum() const { return m_RefObjNum; } + + void SetRef(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum); + + protected: + ~CPDF_Reference() override; + CPDF_Object* SafeGetDirect() const { + CPDF_Object* obj = GetDirect(); + if (!obj || obj->IsReference()) + return nullptr; + return obj; + } + + CPDF_IndirectObjectHolder* m_pObjList; + FX_DWORD m_RefObjNum; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_REFERENCE_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h b/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h new file mode 100644 index 0000000000..a2a39f10ea --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_SIMPLE_PARSER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_SIMPLE_PARSER_H_ + +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDF_SimpleParser { + public: + CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize); + CPDF_SimpleParser(const CFX_ByteStringC& str); + + CFX_ByteStringC GetWord(); + + // Find the token and its |nParams| parameters from the start of data, + // and move the current position to the start of those parameters. + bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams); + + // For testing only. + FX_DWORD GetCurPos() const { return m_dwCurPos; } + + private: + void ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize); + + const uint8_t* m_pData; + FX_DWORD m_dwSize; + FX_DWORD m_dwCurPos; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_SIMPLE_PARSER_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h new file mode 100644 index 0000000000..43853839a1 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_stream.h @@ -0,0 +1,61 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/include/fxcrt/fx_stream.h" + +class CPDF_Stream : public CPDF_Object { + public: + CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; + CPDF_Dictionary* GetDict() const override; + CFX_WideString GetUnicodeText() const override; + bool IsStream() const override; + CPDF_Stream* AsStream() override; + const CPDF_Stream* AsStream() const override; + + FX_DWORD GetRawSize() const { return m_dwSize; } + uint8_t* GetRawData() const { return m_pDataBuf; } + + void SetData(const uint8_t* pData, + FX_DWORD size, + FX_BOOL bCompressed, + FX_BOOL bKeepBuf); + + void InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); + void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict); + + FX_BOOL ReadRawData(FX_FILESIZE start_pos, + uint8_t* pBuf, + FX_DWORD buf_size) const; + + bool IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; } + + protected: + static const FX_DWORD kMemoryBasedGenNum = (FX_DWORD)-1; + + ~CPDF_Stream() override; + + void InitStreamInternal(CPDF_Dictionary* pDict); + + CPDF_Dictionary* m_pDict; + FX_DWORD m_dwSize; + FX_DWORD m_GenNum; + + union { + uint8_t* m_pDataBuf; + IFX_FileRead* m_pFile; + }; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h b/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h new file mode 100644 index 0000000000..6920579c8e --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h @@ -0,0 +1,46 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_ACC_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_ACC_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDF_StreamAcc { + public: + CPDF_StreamAcc(); + ~CPDF_StreamAcc(); + + void LoadAllData(const CPDF_Stream* pStream, + FX_BOOL bRawAccess = FALSE, + FX_DWORD estimated_size = 0, + FX_BOOL bImageAcc = FALSE); + + const CPDF_Stream* GetStream() const { return m_pStream; } + CPDF_Dictionary* GetDict() const { + return m_pStream ? m_pStream->GetDict() : nullptr; + } + + const uint8_t* GetData() const; + FX_DWORD GetSize() const; + const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } + const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } + uint8_t* DetachData(); + + protected: + uint8_t* m_pData; + FX_DWORD m_dwSize; + FX_BOOL m_bNewBuf; + CFX_ByteString m_ImageDecoder; + CPDF_Dictionary* m_pImageParam; + const CPDF_Stream* m_pStream; + uint8_t* m_pSrcData; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STREAM_ACC_H_ diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_string.h b/core/fpdfapi/fpdf_parser/include/cpdf_string.h new file mode 100644 index 0000000000..088fe6e28d --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/cpdf_string.h @@ -0,0 +1,40 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STRING_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STRING_H_ + +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDF_String : public CPDF_Object { + public: + CPDF_String(); + CPDF_String(const CFX_ByteString& str, FX_BOOL bHex); + explicit CPDF_String(const CFX_WideString& str); + + // CPDF_Object. + Type GetType() const override; + CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; + CFX_ByteString GetString() const override; + CFX_ByteStringC GetConstString() const override; + CFX_WideString GetUnicodeText() const override; + void SetString(const CFX_ByteString& str) override; + bool IsString() const override; + CPDF_String* AsString() override; + const CPDF_String* AsString() const override; + + FX_BOOL IsHex() const { return m_bHex; } + + protected: + ~CPDF_String() override; + + CFX_ByteString m_String; + FX_BOOL m_bHex; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_CPDF_STRING_H_ diff --git a/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h b/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h new file mode 100644 index 0000000000..6a17ac5332 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h @@ -0,0 +1,76 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_FPDF_PARSER_DECODE_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_FPDF_PARSER_DECODE_H_ + +#include "core/include/fxcrt/fx_basic.h" + +class CPDF_Dictionary; + +// Indexed by 8-bit char code, contains unicode code points. +extern const FX_WORD PDFDocEncoding[256]; + +CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig); +CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); +CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); +CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, + FX_BOOL bHex = FALSE); +CFX_WideString PDF_DecodeText(const uint8_t* pData, FX_DWORD size); +CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr); +CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1); +CFX_ByteString PDF_EncodeText(const CFX_WideString& str); + +void FlateEncode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size); +void FlateEncode(const uint8_t* src_buf, + FX_DWORD src_size, + int predictor, + int Colors, + int BitsPerComponent, + int Columns, + uint8_t*& dest_buf, + FX_DWORD& dest_size); +FX_DWORD FlateDecode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size); +FX_DWORD RunLengthDecode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size); + +// Public for testing. +FX_DWORD A85Decode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size); +// Public for testing. +FX_DWORD HexDecode(const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size); +// Public for testing. +FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, + const uint8_t* src_buf, + FX_DWORD src_size, + CPDF_Dictionary* pParams, + FX_DWORD estimated_size, + uint8_t*& dest_buf, + FX_DWORD& dest_size); +FX_BOOL PDF_DataDecode(const uint8_t* src_buf, + FX_DWORD src_size, + const CPDF_Dictionary* pDict, + uint8_t*& dest_buf, + FX_DWORD& dest_size, + CFX_ByteString& ImageEncoding, + CPDF_Dictionary*& pImageParms, + FX_DWORD estimated_size, + FX_BOOL bImageAcc); + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_FPDF_PARSER_DECODE_H_ diff --git a/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h b/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h new file mode 100644 index 0000000000..90d137c34a --- /dev/null +++ b/core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h @@ -0,0 +1,80 @@ +// 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_FPDFAPI_FPDF_PARSER_INCLUDE_IPDF_DATA_AVAIL_H_ +#define CORE_FPDFAPI_FPDF_PARSER_INCLUDE_IPDF_DATA_AVAIL_H_ + +#include "core/include/fxcrt/fx_stream.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDF_Document; +class CPDF_Object; + +class IPDF_DataAvail { + public: + // Must match PDF_DATA_* definitions in public/fpdf_dataavail.h, but cannot + // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts + // to make sure the two sets of values match. + enum DocAvailStatus { + DataError = -1, // PDF_DATA_ERROR + DataNotAvailable = 0, // PDF_DATA_NOTAVAIL + DataAvailable = 1, // PDF_DATA_AVAIL + }; + + // Must match PDF_*LINEAR* definitions in public/fpdf_dataavail.h, but cannot + // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts + // to make sure the two sets of values match. + enum DocLinearizationStatus { + LinearizationUnknown = -1, // PDF_LINEARIZATION_UNKNOWN + NotLinearized = 0, // PDF_NOT_LINEARIZED + Linearized = 1, // PDF_LINEARIZED + }; + + // Must match PDF_FORM_* definitions in public/fpdf_dataavail.h, but cannot + // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts + // to make sure the two sets of values match. + enum DocFormStatus { + FormError = -1, // PDF_FORM_ERROR + FormNotAvailable = 0, // PDF_FORM_NOTAVAIL + FormAvailable = 1, // PDF_FORM_AVAIL + FormNotExist = 2, // PDF_FORM_NOTEXIST + }; + + class FileAvail { + public: + virtual ~FileAvail(); + virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) = 0; + }; + + class DownloadHints { + public: + virtual ~DownloadHints(); + virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) = 0; + }; + + static IPDF_DataAvail* Create(FileAvail* pFileAvail, IFX_FileRead* pFileRead); + virtual ~IPDF_DataAvail(); + + FileAvail* GetFileAvail() const { return m_pFileAvail; } + IFX_FileRead* GetFileRead() const { return m_pFileRead; } + + virtual DocAvailStatus IsDocAvail(DownloadHints* pHints) = 0; + virtual void SetDocument(CPDF_Document* pDoc) = 0; + virtual DocAvailStatus IsPageAvail(int iPage, DownloadHints* pHints) = 0; + virtual FX_BOOL IsLinearized() = 0; + virtual DocFormStatus IsFormAvail(DownloadHints* pHints) = 0; + virtual DocLinearizationStatus IsLinearizedPDF() = 0; + virtual void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, + FX_DWORD* pSize) = 0; + + protected: + IPDF_DataAvail(FileAvail* pFileAvail, IFX_FileRead* pFileRead); + + FileAvail* m_pFileAvail; + IFX_FileRead* m_pFileRead; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_INCLUDE_IPDF_DATA_AVAIL_H_ diff --git a/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h b/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h new file mode 100644 index 0000000000..a1000760f3 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h @@ -0,0 +1,45 @@ +// 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_FPDFAPI_FPDF_PARSER_IPDF_CRYPTO_HANDLER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_IPDF_CRYPTO_HANDLER_H_ + +#include "core/include/fxcrt/fx_basic.h" + +class CPDF_Dictionary; +class IPDF_SecurityHandler; + +class IPDF_CryptoHandler { + public: + virtual ~IPDF_CryptoHandler(); + + virtual FX_BOOL Init(CPDF_Dictionary* pEncryptDict, + IPDF_SecurityHandler* pSecurityHandler) = 0; + + virtual FX_DWORD DecryptGetSize(FX_DWORD src_size) = 0; + virtual void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0; + virtual FX_BOOL DecryptStream(void* context, + const uint8_t* src_buf, + FX_DWORD src_size, + CFX_BinaryBuf& dest_buf) = 0; + + virtual FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) = 0; + virtual FX_DWORD EncryptGetSize(FX_DWORD objnum, + FX_DWORD version, + const uint8_t* src_buf, + FX_DWORD src_size) = 0; + + virtual FX_BOOL EncryptContent(FX_DWORD objnum, + FX_DWORD version, + const uint8_t* src_buf, + FX_DWORD src_size, + uint8_t* dest_buf, + FX_DWORD& dest_size) = 0; + + void Decrypt(FX_DWORD objnum, FX_DWORD version, CFX_ByteString& str); +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_IPDF_CRYPTO_HANDLER_H_ diff --git a/core/fpdfapi/fpdf_parser/ipdf_occontext.cpp b/core/fpdfapi/fpdf_parser/ipdf_occontext.cpp new file mode 100644 index 0000000000..56a2412d9a --- /dev/null +++ b/core/fpdfapi/fpdf_parser/ipdf_occontext.cpp @@ -0,0 +1,25 @@ +// 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 + +#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h" + +#include "core/include/fpdfapi/fpdf_pageobj.h" + +IPDF_OCContext::~IPDF_OCContext() {} + +FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) { + const CPDF_ContentMarkData* pData = pObj->m_ContentMark; + int nItems = pData->CountItems(); + for (int i = 0; i < nItems; i++) { + const CPDF_ContentMarkItem& item = pData->GetItem(i); + if (item.GetName() == "OC" && + item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict && + !CheckOCGVisible(item.GetParam())) { + return FALSE; + } + } + return TRUE; +} diff --git a/core/fpdfapi/fpdf_parser/ipdf_occontext.h b/core/fpdfapi/fpdf_parser/ipdf_occontext.h new file mode 100644 index 0000000000..6c410037e2 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/ipdf_occontext.h @@ -0,0 +1,23 @@ +// 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_FPDFAPI_FPDF_PARSER_IPDF_OCCONTEXT_H_ +#define CORE_FPDFAPI_FPDF_PARSER_IPDF_OCCONTEXT_H_ + +#include "core/include/fxcrt/fx_system.h" + +class CPDF_Dictionary; +class CPDF_PageObject; + +class IPDF_OCContext { + public: + virtual ~IPDF_OCContext(); + + virtual FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCG) = 0; + FX_BOOL CheckObjectVisible(const CPDF_PageObject* pObj); +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_IPDF_OCCONTEXT_H_ diff --git a/core/fpdfapi/fpdf_parser/ipdf_security_handler.h b/core/fpdfapi/fpdf_parser/ipdf_security_handler.h new file mode 100644 index 0000000000..c73c4c5081 --- /dev/null +++ b/core/fpdfapi/fpdf_parser/ipdf_security_handler.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_FPDFAPI_FPDF_PARSER_IPDF_SECURITY_HANDLER_H_ +#define CORE_FPDFAPI_FPDF_PARSER_IPDF_SECURITY_HANDLER_H_ + +#include "core/include/fxcrt/fx_system.h" + +class CPDF_Parser; +class CPDF_Dictionary; +class IPDF_CryptoHandler; + +#define FXCIPHER_NONE 0 +#define FXCIPHER_RC4 1 +#define FXCIPHER_AES 2 +#define FXCIPHER_AES2 3 + +class IPDF_SecurityHandler { + public: + virtual ~IPDF_SecurityHandler(); + virtual FX_BOOL OnInit(CPDF_Parser* pParser, + CPDF_Dictionary* pEncryptDict) = 0; + + virtual FX_DWORD GetPermissions() = 0; + virtual FX_BOOL GetCryptInfo(int& cipher, + const uint8_t*& buffer, + int& keylen) = 0; + + virtual FX_BOOL IsMetadataEncrypted() = 0; + virtual IPDF_CryptoHandler* CreateCryptoHandler() = 0; +}; + +#endif // CORE_FPDFAPI_FPDF_PARSER_IPDF_SECURITY_HANDLER_H_ diff --git a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h new file mode 100644 index 0000000000..26d71efcab --- /dev/null +++ b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h @@ -0,0 +1,77 @@ +// 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_FPDFAPI_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_ +#define CORE_FPDFAPI_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_ + +#include + +#include "core/include/fxcrt/fx_system.h" + +class CPDF_Stream; +class CPDF_ImageCacheEntry; +class CPDF_Page; +class CPDF_RenderStatus; +class CFX_DIBitmap; +class CFX_DIBSource; +class IFX_Pause; + +class CPDF_PageRenderCache { + public: + explicit CPDF_PageRenderCache(CPDF_Page* pPage) + : m_pPage(pPage), + m_pCurImageCacheEntry(nullptr), + m_nTimeCount(0), + m_nCacheSize(0), + m_bCurFindCache(FALSE) {} + ~CPDF_PageRenderCache(); + void ClearImageData(); + + FX_DWORD EstimateSize(); + void CacheOptimization(int32_t dwLimitCacheSize); + FX_DWORD GetTimeCount() const { return m_nTimeCount; } + void SetTimeCount(FX_DWORD dwTimeCount) { m_nTimeCount = dwTimeCount; } + + void GetCachedBitmap(CPDF_Stream* pStream, + CFX_DIBSource*& pBitmap, + CFX_DIBSource*& pMask, + FX_DWORD& MatteColor, + FX_BOOL bStdCS = FALSE, + FX_DWORD GroupFamily = 0, + FX_BOOL bLoadMask = FALSE, + CPDF_RenderStatus* pRenderStatus = NULL, + int32_t downsampleWidth = 0, + int32_t downsampleHeight = 0); + + void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); + void ClearImageCacheEntry(CPDF_Stream* pStream); + CPDF_Page* GetPage() const { return m_pPage; } + CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { + return m_pCurImageCacheEntry; + } + + FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, + FX_BOOL bStdCS = FALSE, + FX_DWORD GroupFamily = 0, + FX_BOOL bLoadMask = FALSE, + CPDF_RenderStatus* pRenderStatus = NULL, + int32_t downsampleWidth = 0, + int32_t downsampleHeight = 0); + + FX_BOOL Continue(IFX_Pause* pPause); + + protected: + friend class CPDF_Page; + + CPDF_Page* const m_pPage; + CPDF_ImageCacheEntry* m_pCurImageCacheEntry; + std::map m_ImageCache; + FX_DWORD m_nTimeCount; + FX_DWORD m_nCacheSize; + FX_BOOL m_bCurFindCache; +}; + +#endif // CORE_FPDFAPI_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_ diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 2b82ed4cc6..94398df296 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -7,11 +7,16 @@ #include "core/fpdfapi/fpdf_render/render_int.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_module.h" -#include "core/include/fpdfapi/fpdf_render.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h" +#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" +#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/fpdfapi/ipdf_rendermodule.h" #include "core/include/fxge/fx_ge.h" CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc) @@ -1322,16 +1327,3 @@ void CPDF_ScaledRenderBuffer::OutputToDevice() { m_Rect.top, m_Rect.Width(), m_Rect.Height()); } } -FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) { - const CPDF_ContentMarkData* pData = pObj->m_ContentMark; - int nItems = pData->CountItems(); - for (int i = 0; i < nItems; i++) { - const CPDF_ContentMarkItem& item = pData->GetItem(i); - if (item.GetName() == "OC" && - item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict && - !CheckOCGVisible(item.GetParam())) { - return FALSE; - } - } - return TRUE; -} diff --git a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp index f5ab7e0da5..fbe07842d9 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -4,12 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_render/render_int.h" +#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" +#include "core/fpdfapi/fpdf_render/render_int.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "core/include/fpdfapi/fpdf_render.h" #include "core/include/fxge/fx_ge.h" struct CACHEINFO { diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index 6c235a0258..963ff246d9 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -10,12 +10,14 @@ #include #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h" +#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/include/fpdfapi/fpdf_pageobj.h" -#include "core/include/fpdfapi/fpdf_render.h" #include "core/include/fxcodec/fx_codec.h" #include "core/include/fxcrt/fx_safe_types.h" #include "core/include/fxge/fx_ge.h" diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index f1a06c4fc7..905e7a60c6 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -11,12 +11,12 @@ #include #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "core/include/fpdfapi/fpdf_render.h" #include "core/include/fxcodec/fx_codec.h" #include "core/include/fxcrt/fx_safe_types.h" #include "core/include/fxge/fx_ge.h" diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 5ad8db1646..2e259126cf 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -7,10 +7,11 @@ #include "core/fpdfapi/fpdf_render/render_int.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "core/include/fpdfapi/fpdf_render.h" #include "core/include/fxge/fx_ge.h" #define SHADING_STEPS 256 diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index 24b77ed368..4db224939d 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -7,10 +7,11 @@ #include "core/fpdfapi/fpdf_render/render_int.h" #include "core/fpdfapi/fpdf_page/pageint.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "core/include/fpdfapi/fpdf_render.h" #include "core/include/fxge/fx_ge.h" CPDF_Type3Cache::~CPDF_Type3Cache() { diff --git a/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h new file mode 100644 index 0000000000..eddd4b0c83 --- /dev/null +++ b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h @@ -0,0 +1,62 @@ +// 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_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_PROGRESSIVERENDERER_H_ +#define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_PROGRESSIVERENDERER_H_ + +#include + +#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" +#include "core/include/fpdfapi/fpdf_page.h" +#include "core/include/fxcrt/fx_coordinates.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDF_RenderOptions; +class CPDF_RenderStatus; +class CFX_RenderDevice; +class IFX_Pause; + +class CPDF_ProgressiveRenderer { + public: + // Must match FDF_RENDER_* definitions in public/fpdf_progressive.h, but + // cannot #include that header. fpdfsdk/fpdf_progressive.cpp has + // static_asserts to make sure the two sets of values match. + enum Status { + Ready, // FPDF_RENDER_READER + ToBeContinued, // FPDF_RENDER_TOBECOUNTINUED + Done, // FPDF_RENDER_DONE + Failed // FPDF_RENDER_FAILED + }; + + static int ToFPDFStatus(Status status) { return static_cast(status); } + + CPDF_ProgressiveRenderer(CPDF_RenderContext* pContext, + CFX_RenderDevice* pDevice, + const CPDF_RenderOptions* pOptions); + ~CPDF_ProgressiveRenderer(); + + Status GetStatus() const { return m_Status; } + void Start(IFX_Pause* pPause); + void Continue(IFX_Pause* pPause); + + private: + void RenderStep(); + + // Maximum page objects to render before checking for pause. + static const int kStepLimit = 100; + + Status m_Status; + CPDF_RenderContext* const m_pContext; + CFX_RenderDevice* const m_pDevice; + const CPDF_RenderOptions* const m_pOptions; + std::unique_ptr m_pRenderStatus; + CFX_FloatRect m_ClipRect; + FX_DWORD m_LayerIndex; + CPDF_RenderContext::Layer* m_pCurrentLayer; + CPDF_PageObjectList::iterator m_LastObjectRendered; +}; + +#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_PROGRESSIVERENDERER_H_ diff --git a/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h b/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h new file mode 100644 index 0000000000..4c55658163 --- /dev/null +++ b/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h @@ -0,0 +1,68 @@ +// 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_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDERCONTEXT_H_ +#define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDERCONTEXT_H_ + +#include "core/include/fxcrt/fx_basic.h" +#include "core/include/fxcrt/fx_coordinates.h" + +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_Page; +class CPDF_PageObject; +class CPDF_PageObjectHolder; +class CPDF_PageRenderCache; +class CPDF_RenderOptions; +class CFX_DIBitmap; +class CFX_Matrix; +class CFX_RenderDevice; + +class CPDF_RenderContext { + public: + class Layer { + public: + CPDF_PageObjectHolder* m_pObjectHolder; + CFX_Matrix m_Matrix; + }; + + explicit CPDF_RenderContext(CPDF_Page* pPage); + CPDF_RenderContext(CPDF_Document* pDoc, CPDF_PageRenderCache* pPageCache); + ~CPDF_RenderContext(); + + void AppendLayer(CPDF_PageObjectHolder* pObjectHolder, + const CFX_Matrix* pObject2Device); + + void Render(CFX_RenderDevice* pDevice, + const CPDF_RenderOptions* pOptions, + const CFX_Matrix* pFinalMatrix); + + void Render(CFX_RenderDevice* pDevice, + const CPDF_PageObject* pStopObj, + const CPDF_RenderOptions* pOptions, + const CFX_Matrix* pFinalMatrix); + + void GetBackground(CFX_DIBitmap* pBuffer, + const CPDF_PageObject* pObj, + const CPDF_RenderOptions* pOptions, + CFX_Matrix* pFinalMatrix); + + FX_DWORD CountLayers() const { return m_Layers.GetSize(); } + Layer* GetLayer(FX_DWORD index) { return m_Layers.GetDataPtr(index); } + + CPDF_Document* GetDocument() const { return m_pDocument; } + CPDF_Dictionary* GetPageResources() const { return m_pPageResources; } + CPDF_PageRenderCache* GetPageCache() const { return m_pPageCache; } + + protected: + CPDF_Document* const m_pDocument; + CPDF_Dictionary* m_pPageResources; + CPDF_PageRenderCache* m_pPageCache; + FX_BOOL m_bFirstLayer; + CFX_ArrayTemplate m_Layers; +}; + +#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDERCONTEXT_H_ diff --git a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h new file mode 100644 index 0000000000..c0911e7cd2 --- /dev/null +++ b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h @@ -0,0 +1,52 @@ +// 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_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDEROPTIONS_H_ +#define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDEROPTIONS_H_ + +#include "core/include/fxcrt/fx_system.h" +#include "core/include/fxge/fx_dib.h" + +class IPDF_OCContext; + +#define RENDER_COLOR_NORMAL 0 +#define RENDER_COLOR_GRAY 1 +#define RENDER_COLOR_TWOCOLOR 2 +#define RENDER_COLOR_ALPHA 3 +#define RENDER_CLEARTYPE 0x00000001 +#define RENDER_PRINTGRAPHICTEXT 0x00000002 +#define RENDER_FORCE_DOWNSAMPLE 0x00000004 +#define RENDER_PRINTPREVIEW 0x00000008 +#define RENDER_BGR_STRIPE 0x00000010 +#define RENDER_NO_NATIVETEXT 0x00000020 +#define RENDER_FORCE_HALFTONE 0x00000040 +#define RENDER_RECT_AA 0x00000080 +#define RENDER_FILL_FULLCOVER 0x00000100 +#define RENDER_PRINTIMAGETEXT 0x00000200 +#define RENDER_OVERPRINT 0x00000400 +#define RENDER_THINLINE 0x00000800 +#define RENDER_NOTEXTSMOOTH 0x10000000 +#define RENDER_NOPATHSMOOTH 0x20000000 +#define RENDER_NOIMAGESMOOTH 0x40000000 +#define RENDER_LIMITEDIMAGECACHE 0x80000000 + +class CPDF_RenderOptions { + public: + CPDF_RenderOptions(); + FX_ARGB TranslateColor(FX_ARGB argb) const; + + int m_ColorMode; + FX_COLORREF m_BackColor; + FX_COLORREF m_ForeColor; + FX_DWORD m_Flags; + int m_Interpolation; + FX_DWORD m_AddFlags; + IPDF_OCContext* m_pOCContext; + FX_DWORD m_dwLimitCacheSize; + int m_HalftoneLimit; +}; + +#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDEROPTIONS_H_ diff --git a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h new file mode 100644 index 0000000000..1cf67cd2f2 --- /dev/null +++ b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h @@ -0,0 +1,77 @@ +// 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_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_TEXTRENDERER_H_ +#define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_TEXTRENDERER_H_ + +#include "core/include/fxcrt/fx_coordinates.h" +#include "core/include/fxcrt/fx_string.h" +#include "core/include/fxcrt/fx_system.h" +#include "core/include/fxge/fx_dib.h" + +class CFX_RenderDevice; +class CFX_GraphStateData; +class CFX_PathData; +class CPDF_RenderOptions; +class CPDF_Font; + +class CPDF_TextRenderer { + public: + static void DrawTextString(CFX_RenderDevice* pDevice, + int left, + int top, + CPDF_Font* pFont, + int height, + const CFX_ByteString& str, + FX_ARGB argb); + + static void DrawTextString(CFX_RenderDevice* pDevice, + FX_FLOAT origin_x, + FX_FLOAT origin_y, + CPDF_Font* pFont, + FX_FLOAT font_size, + const CFX_Matrix* matrix, + const CFX_ByteString& str, + FX_ARGB fill_argb, + FX_ARGB stroke_argb = 0, + const CFX_GraphStateData* pGraphState = NULL, + const CPDF_RenderOptions* pOptions = NULL); + + static FX_BOOL DrawTextPath(CFX_RenderDevice* pDevice, + int nChars, + FX_DWORD* pCharCodes, + FX_FLOAT* pCharPos, + CPDF_Font* pFont, + FX_FLOAT font_size, + const CFX_Matrix* pText2User, + const CFX_Matrix* pUser2Device, + const CFX_GraphStateData* pGraphState, + FX_ARGB fill_argb, + FX_ARGB stroke_argb, + CFX_PathData* pClippingPath, + int nFlag = 0); + + static FX_BOOL DrawNormalText(CFX_RenderDevice* pDevice, + int nChars, + FX_DWORD* pCharCodes, + FX_FLOAT* pCharPos, + CPDF_Font* pFont, + FX_FLOAT font_size, + const CFX_Matrix* pText2Device, + FX_ARGB fill_argb, + const CPDF_RenderOptions* pOptions); + + static FX_BOOL DrawType3Text(CFX_RenderDevice* pDevice, + int nChars, + FX_DWORD* pCharCodes, + FX_FLOAT* pCharPos, + CPDF_Font* pFont, + FX_FLOAT font_size, + const CFX_Matrix* pText2Device, + FX_ARGB fill_argb); +}; + +#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_TEXTRENDERER_H_ diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h index c15612466c..f4cc02357b 100644 --- a/core/fpdfapi/fpdf_render/render_int.h +++ b/core/fpdfapi/fpdf_render/render_int.h @@ -10,9 +10,12 @@ #include #include +#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "core/include/fpdfapi/fpdf_render.h" +class CPDF_PageObjectHolder; +class CPDF_PageRenderCache; +class CPDF_RenderStatus; class CFX_GlyphBitmap; class CFX_ImageTransformer; class CPDF_ImageCacheEntry; @@ -21,6 +24,8 @@ class ICodec_ScanlineDecoder; #define TYPE3_MAX_BLUES 16 +FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix); + class CPDF_Type3Glyphs { public: CPDF_Type3Glyphs() : m_TopBlueCount(0), m_BottomBlueCount(0) {} diff --git a/core/fpdfapi/include/cpdf_modulemgr.h b/core/fpdfapi/include/cpdf_modulemgr.h new file mode 100644 index 0000000000..5449b082c6 --- /dev/null +++ b/core/fpdfapi/include/cpdf_modulemgr.h @@ -0,0 +1,70 @@ +// 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_FPDFAPI_INCLUDE_CPDF_MODULEMGR_H_ +#define CORE_FPDFAPI_INCLUDE_CPDF_MODULEMGR_H_ + +#include + +#include "core/fpdfapi/ipdf_pagemodule.h" +#include "core/include/fxcrt/fx_basic.h" + +class CCodec_ModuleMgr; +class ICodec_FaxModule; +class ICodec_FlateModule; +class ICodec_IccModule; +class ICodec_Jbig2Module; +class ICodec_JpegModule; +class ICodec_JpxModule; + +class IPDF_PageModule; +class IPDF_RenderModule; + +class CPDF_ModuleMgr { + public: + static CPDF_ModuleMgr* Get(); + static void Create(); + static void Destroy(); + static const int kFileBufSize = 512; + + void SetCodecModule(CCodec_ModuleMgr* pModule) { m_pCodecModule = pModule; } + CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } + + void InitPageModule(); + void InitRenderModule(); + + IPDF_RenderModule* GetRenderModule() const { return m_pRenderModule.get(); } + IPDF_PageModule* GetPageModule() const { return m_pPageModule.get(); } + + void LoadEmbeddedGB1CMaps(); + void LoadEmbeddedCNS1CMaps(); + void LoadEmbeddedJapan1CMaps(); + void LoadEmbeddedKorea1CMaps(); + + ICodec_FaxModule* GetFaxModule(); + ICodec_JpegModule* GetJpegModule(); + ICodec_JpxModule* GetJpxModule(); + ICodec_Jbig2Module* GetJbig2Module(); + ICodec_IccModule* GetIccModule(); + ICodec_FlateModule* GetFlateModule(); + + void SetPrivateData(void* module_id, + void* pData, + PD_CALLBACK_FREEDATA callback); + + void* GetPrivateData(void* module_id); + + private: + CPDF_ModuleMgr(); + ~CPDF_ModuleMgr(); + + CCodec_ModuleMgr* m_pCodecModule; + std::unique_ptr m_pRenderModule; + std::unique_ptr m_pPageModule; + CFX_PrivateData m_privateData; +}; + +#endif // CORE_FPDFAPI_INCLUDE_CPDF_MODULEMGR_H_ diff --git a/core/fpdfapi/ipdf_pagemodule.h b/core/fpdfapi/ipdf_pagemodule.h new file mode 100644 index 0000000000..3765cd91d2 --- /dev/null +++ b/core/fpdfapi/ipdf_pagemodule.h @@ -0,0 +1,28 @@ +// 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_FPDFAPI_IPDF_PAGEMODULE_H_ +#define CORE_FPDFAPI_IPDF_PAGEMODULE_H_ + +class CPDF_ColorSpace; +class CPDF_DocPageData; +class CPDF_Document; +class CPDF_FontGlobals; + +class IPDF_PageModule { + public: + virtual ~IPDF_PageModule() {} + + virtual CPDF_DocPageData* CreateDocData(CPDF_Document* pDoc) = 0; + virtual void ReleaseDoc(CPDF_Document* pDoc) = 0; + virtual void ClearDoc(CPDF_Document* pDoc) = 0; + virtual CPDF_FontGlobals* GetFontGlobals() = 0; + virtual void ClearStockFont(CPDF_Document* pDoc) = 0; + virtual void NotifyCJKAvailable() = 0; + virtual CPDF_ColorSpace* GetStockCS(int family) = 0; +}; + +#endif // CORE_FPDFAPI_IPDF_PAGEMODULE_H_ diff --git a/core/fpdfapi/ipdf_rendermodule.h b/core/fpdfapi/ipdf_rendermodule.h new file mode 100644 index 0000000000..5082b19e8c --- /dev/null +++ b/core/fpdfapi/ipdf_rendermodule.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_FPDFAPI_IPDF_RENDERMODULE_H_ +#define CORE_FPDFAPI_IPDF_RENDERMODULE_H_ + +class CPDF_DocRenderData; +class CPDF_Document; +class CPDF_Page; +class CPDF_PageRenderCache; + +class IPDF_RenderModule { + public: + virtual ~IPDF_RenderModule() {} + + virtual CPDF_DocRenderData* CreateDocData(CPDF_Document* pDoc) = 0; + virtual void DestroyDocData(CPDF_DocRenderData* pDocRenderData) = 0; + virtual void ClearDocData(CPDF_DocRenderData* pDocRenderData) = 0; + + virtual CPDF_DocRenderData* GetRenderData() = 0; + + virtual CPDF_PageRenderCache* CreatePageCache(CPDF_Page* pPage) = 0; + virtual void DestroyPageCache(CPDF_PageRenderCache* pCache) = 0; +}; + +#endif // CORE_FPDFAPI_IPDF_RENDERMODULE_H_ diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index 0af219e47e..963257006a 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -6,8 +6,8 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" +#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" CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp index b17347cce3..219d61151d 100644 --- a/core/fpdfdoc/doc_annot.cpp +++ b/core/fpdfdoc/doc_annot.cpp @@ -4,9 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_reference.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_reference.h" +#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" #include "core/include/fpdfdoc/fpdf_doc.h" diff --git a/core/fpdfdoc/doc_ap.cpp b/core/fpdfdoc/doc_ap.cpp index d2400123d2..43dcfb4ac0 100644 --- a/core/fpdfdoc/doc_ap.cpp +++ b/core/fpdfdoc/doc_ap.cpp @@ -4,11 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#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/fpdfdoc/doc_utils.h" #include "core/fpdfdoc/pdf_vt.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_simple_parser.h" #include "core/include/fpdfdoc/fpdf_ap.h" #include "core/include/fpdfdoc/fpdf_doc.h" #include "core/include/fpdfdoc/fpdf_vt.h" diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index b3a6511734..851730346c 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#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/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" #include "core/include/fpdfdoc/fpdf_doc.h" const int nMaxRecursion = 32; diff --git a/core/fpdfdoc/doc_basic_unittest.cpp b/core/fpdfdoc/doc_basic_unittest.cpp index 659643851d..a84f334ebb 100644 --- a/core/fpdfdoc/doc_basic_unittest.cpp +++ b/core/fpdfdoc/doc_basic_unittest.cpp @@ -7,8 +7,8 @@ #include #include -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_string.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.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 c338e5d48c..908960e497 100644 --- a/core/fpdfdoc/doc_bookmark.cpp +++ b/core/fpdfdoc/doc_bookmark.cpp @@ -7,9 +7,10 @@ #include #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_string.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_string.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfdoc/fpdf_doc.h" CPDF_Bookmark CPDF_BookmarkTree::GetFirstChild( diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index c205588335..bcb2dcc00e 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -6,11 +6,12 @@ #include +#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_string.h" #include "core/fpdfdoc/doc_utils.h" -#include "core/include/fpdfapi/cfdf_document.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_string.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfdoc/fpdf_doc.h" #include "third_party/base/stl_util.h" diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp index 15ff7b5e64..eab190279c 100644 --- a/core/fpdfdoc/doc_formcontrol.cpp +++ b/core/fpdfdoc/doc_formcontrol.cpp @@ -6,8 +6,11 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_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_stream.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfdoc/fpdf_doc.h" CPDF_FormControl::CPDF_FormControl(CPDF_FormField* pField, diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp index 7ad8cacea9..6c3afad1ee 100644 --- a/core/fpdfdoc/doc_formfield.cpp +++ b/core/fpdfdoc/doc_formfield.cpp @@ -4,13 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#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/fpdfdoc/doc_utils.h" -#include "core/include/fpdfapi/cfdf_document.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_simple_parser.h" -#include "core/include/fpdfapi/cpdf_string.h" #include "core/include/fpdfdoc/fpdf_doc.h" FX_BOOL PDF_FormField_IsUnison(CPDF_FormField* pField) { diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp index 8aedb40034..6c7ecdec4b 100644 --- a/core/fpdfdoc/doc_link.cpp +++ b/core/fpdfdoc/doc_link.cpp @@ -8,7 +8,8 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/include/fpdfapi/fpdf_page.h" CPDF_LinkList::CPDF_LinkList() {} diff --git a/core/fpdfdoc/doc_metadata.cpp b/core/fpdfdoc/doc_metadata.cpp index 78364c4cbf..5526b8d5ab 100644 --- a/core/fpdfdoc/doc_metadata.cpp +++ b/core/fpdfdoc/doc_metadata.cpp @@ -4,7 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_document.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/include/fpdfdoc/fpdf_doc.h" #include "core/include/fxcrt/fx_xml.h" diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp index 3af745580c..8148b31a56 100644 --- a/core/fpdfdoc/doc_ocg.cpp +++ b/core/fpdfdoc/doc_ocg.cpp @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" +#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" static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject, diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp index 015f4db878..5795b36120 100644 --- a/core/fpdfdoc/doc_tagged.cpp +++ b/core/fpdfdoc/doc_tagged.cpp @@ -6,12 +6,12 @@ #include +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" #include "core/fpdfdoc/doc_utils.h" #include "core/fpdfdoc/tagged_int.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_reference.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfdoc/fpdf_tagged.h" diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index 5160c1115c..795a26a6e2 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -7,10 +7,10 @@ #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_simple_parser.h" #include "core/fpdfdoc/doc_utils.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_simple_parser.h" #include "core/include/fpdfdoc/fpdf_doc.h" namespace { diff --git a/core/fpdfdoc/doc_utils.h b/core/fpdfdoc/doc_utils.h index ed687943da..6bfd005920 100644 --- a/core/fpdfdoc/doc_utils.h +++ b/core/fpdfdoc/doc_utils.h @@ -9,7 +9,7 @@ #include -#include "core/include/fpdfapi/cpdf_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" #include "core/include/fpdfapi/fpdf_resource.h" class CPDF_Dictionary; diff --git a/core/fpdfdoc/doc_viewerPreferences.cpp b/core/fpdfdoc/doc_viewerPreferences.cpp index 582f3a5a93..035d192395 100644 --- a/core/fpdfdoc/doc_viewerPreferences.cpp +++ b/core/fpdfdoc/doc_viewerPreferences.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/include/fpdfdoc/fpdf_doc.h" CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc) diff --git a/core/fpdftext/fpdf_text_int.cpp b/core/fpdftext/fpdf_text_int.cpp index f862af9fbe..0b237972fb 100644 --- a/core/fpdftext/fpdf_text_int.cpp +++ b/core/fpdftext/fpdf_text_int.cpp @@ -13,13 +13,12 @@ #include #include +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" #include "core/fpdftext/include/ipdf_linkextract.h" #include "core/fpdftext/include/ipdf_textpage.h" #include "core/fpdftext/include/ipdf_textpagefind.h" #include "core/fpdftext/unicodenormalization.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_module.h" #include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" #include "core/include/fpdfapi/fpdf_resource.h" diff --git a/core/fxcodec/jbig2/JBig2_BitStream.cpp b/core/fxcodec/jbig2/JBig2_BitStream.cpp index 3e042bc92b..a2a4c2c7c0 100644 --- a/core/fxcodec/jbig2/JBig2_BitStream.cpp +++ b/core/fxcodec/jbig2/JBig2_BitStream.cpp @@ -8,8 +8,8 @@ #include -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" CJBig2_BitStream::CJBig2_BitStream(CPDF_StreamAcc* pSrcStream) : m_pBuf(pSrcStream->GetData()), diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index d5eeda081c..89157b9bf1 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -11,6 +11,8 @@ #include #include +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "core/fxcodec/jbig2/JBig2_ArithDecoder.h" #include "core/fxcodec/jbig2/JBig2_BitStream.h" #include "core/fxcodec/jbig2/JBig2_GrdProc.h" @@ -20,8 +22,6 @@ #include "core/fxcodec/jbig2/JBig2_PddProc.h" #include "core/fxcodec/jbig2/JBig2_SddProc.h" #include "core/fxcodec/jbig2/JBig2_TrdProc.h" -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_stream_acc.h" #include "third_party/base/stl_util.h" namespace { diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index f09b8fc1ab..aff3b1bb38 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -11,10 +11,10 @@ #include #include +#include "core/fpdfapi/fpdf_parser/include/cpdf_object.h" #include "core/fxcodec/jbig2/JBig2_List.h" #include "core/fxcodec/jbig2/JBig2_Page.h" #include "core/fxcodec/jbig2/JBig2_Segment.h" -#include "core/include/fpdfapi/cpdf_object.h" #include "core/include/fxcodec/fx_codec_def.h" class CJBig2_ArithDecoder; diff --git a/core/fxge/skia/DEPS b/core/fxge/skia/DEPS new file mode 100644 index 0000000000..6492756b7e --- /dev/null +++ b/core/fxge/skia/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + '+third_party/skia/include' +] diff --git a/core/include/fpdfapi/cfdf_document.h b/core/include/fpdfapi/cfdf_document.h deleted file mode 100644 index 85852cd8cf..0000000000 --- a/core/include/fpdfapi/cfdf_document.h +++ /dev/null @@ -1,36 +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_INCLUDE_FPDFAPI_CFDF_DOCUMENT_H_ -#define CORE_INCLUDE_FPDFAPI_CFDF_DOCUMENT_H_ - -#include "core/include/fpdfapi/cpdf_indirect_object_holder.h" -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fxcrt/fx_basic.h" - -class CPDF_Dictionary; - -class CFDF_Document : public CPDF_IndirectObjectHolder { - public: - static CFDF_Document* CreateNewDoc(); - static CFDF_Document* ParseFile(IFX_FileRead* pFile, - FX_BOOL bOwnFile = FALSE); - static CFDF_Document* ParseMemory(const uint8_t* pData, FX_DWORD size); - ~CFDF_Document(); - - FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const; - CPDF_Dictionary* GetRoot() const { return m_pRootDict; } - - protected: - CFDF_Document(); - void ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile); - - CPDF_Dictionary* m_pRootDict; - IFX_FileRead* m_pFile; - FX_BOOL m_bOwnFile; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CFDF_DOCUMENT_H_ diff --git a/core/include/fpdfapi/cpdf_array.h b/core/include/fpdfapi/cpdf_array.h deleted file mode 100644 index 8e47d9fef5..0000000000 --- a/core/include/fpdfapi/cpdf_array.h +++ /dev/null @@ -1,65 +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_INCLUDE_FPDFAPI_CPDF_ARRAY_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_ARRAY_H_ - -#include "core/include/fpdfapi/cpdf_indirect_object_holder.h" -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fxcrt/fx_basic.h" -#include "core/include/fxcrt/fx_coordinates.h" - -class CPDF_Array : public CPDF_Object { - public: - CPDF_Array(); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; - CPDF_Array* GetArray() const override; - bool IsArray() const override; - CPDF_Array* AsArray() override; - const CPDF_Array* AsArray() const override; - - FX_DWORD GetCount() const { return m_Objects.GetSize(); } - CPDF_Object* GetElement(FX_DWORD index) const; - CPDF_Object* GetElementValue(FX_DWORD index) const; - CFX_Matrix GetMatrix(); - CFX_FloatRect GetRect(); - CFX_ByteString GetStringAt(FX_DWORD index) const; - CFX_ByteStringC GetConstStringAt(FX_DWORD index) const; - int GetIntegerAt(FX_DWORD index) const; - FX_FLOAT GetNumberAt(FX_DWORD index) const; - CPDF_Dictionary* GetDictAt(FX_DWORD index) const; - CPDF_Stream* GetStreamAt(FX_DWORD index) const; - CPDF_Array* GetArrayAt(FX_DWORD index) const; - FX_FLOAT GetFloatAt(FX_DWORD index) const { return GetNumberAt(index); } - - void SetAt(FX_DWORD index, - CPDF_Object* pObj, - CPDF_IndirectObjectHolder* pObjs = nullptr); - void InsertAt(FX_DWORD index, - CPDF_Object* pObj, - CPDF_IndirectObjectHolder* pObjs = nullptr); - void RemoveAt(FX_DWORD index, int nCount = 1); - - void Add(CPDF_Object* pObj, CPDF_IndirectObjectHolder* pObjs = nullptr); - void AddNumber(FX_FLOAT f); - void AddInteger(int i); - void AddString(const CFX_ByteString& str); - void AddName(const CFX_ByteString& str); - void AddReference(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum); - void AddReference(CPDF_IndirectObjectHolder* pDoc, CPDF_Object* obj) { - AddReference(pDoc, obj->GetObjNum()); - } - - protected: - ~CPDF_Array() override; - - CFX_ArrayTemplate m_Objects; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_ARRAY_H_ diff --git a/core/include/fpdfapi/cpdf_boolean.h b/core/include/fpdfapi/cpdf_boolean.h deleted file mode 100644 index 0621c0441c..0000000000 --- a/core/include/fpdfapi/cpdf_boolean.h +++ /dev/null @@ -1,35 +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_INCLUDE_FPDFAPI_CPDF_BOOLEAN_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_BOOLEAN_H_ - -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fxcrt/fx_string.h" -#include "core/include/fxcrt/fx_system.h" - -class CPDF_Boolean : public CPDF_Object { - public: - CPDF_Boolean(); - explicit CPDF_Boolean(FX_BOOL value); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; - CFX_ByteString GetString() const override; - int GetInteger() const override; - void SetString(const CFX_ByteString& str) override; - bool IsBoolean() const override; - CPDF_Boolean* AsBoolean() override; - const CPDF_Boolean* AsBoolean() const override; - - protected: - ~CPDF_Boolean() override; - - FX_BOOL m_bValue; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_BOOLEAN_H_ diff --git a/core/include/fpdfapi/cpdf_dictionary.h b/core/include/fpdfapi/cpdf_dictionary.h deleted file mode 100644 index e547f75729..0000000000 --- a/core/include/fpdfapi/cpdf_dictionary.h +++ /dev/null @@ -1,99 +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_INCLUDE_FPDFAPI_CPDF_DICTIONARY_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_DICTIONARY_H_ - -#include - -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fxcrt/fx_coordinates.h" -#include "core/include/fxcrt/fx_string.h" - -class CPDF_IndirectObjectHolder; - -class CPDF_Dictionary : public CPDF_Object { - public: - using iterator = std::map::iterator; - using const_iterator = std::map::const_iterator; - - CPDF_Dictionary(); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; - CPDF_Dictionary* GetDict() const override; - bool IsDictionary() const override; - CPDF_Dictionary* AsDictionary() override; - const CPDF_Dictionary* AsDictionary() const override; - - size_t GetCount() const { return m_Map.size(); } - CPDF_Object* GetElement(const CFX_ByteStringC& key) const; - CPDF_Object* GetElementValue(const CFX_ByteStringC& key) const; - CFX_ByteString GetStringBy(const CFX_ByteStringC& key) const; - CFX_ByteStringC GetConstStringBy(const CFX_ByteStringC& key) const; - CFX_ByteString GetStringBy(const CFX_ByteStringC& key, - const CFX_ByteStringC& default_str) const; - CFX_ByteStringC GetConstStringBy(const CFX_ByteStringC& key, - const CFX_ByteStringC& default_str) const; - CFX_WideString GetUnicodeTextBy(const CFX_ByteStringC& key) const; - int GetIntegerBy(const CFX_ByteStringC& key) const; - int GetIntegerBy(const CFX_ByteStringC& key, int default_int) const; - FX_BOOL GetBooleanBy(const CFX_ByteStringC& key, - FX_BOOL bDefault = FALSE) const; - FX_FLOAT GetNumberBy(const CFX_ByteStringC& key) const; - CPDF_Dictionary* GetDictBy(const CFX_ByteStringC& key) const; - CPDF_Stream* GetStreamBy(const CFX_ByteStringC& key) const; - CPDF_Array* GetArrayBy(const CFX_ByteStringC& key) const; - CFX_FloatRect GetRectBy(const CFX_ByteStringC& key) const; - CFX_Matrix GetMatrixBy(const CFX_ByteStringC& key) const; - FX_FLOAT GetFloatBy(const CFX_ByteStringC& key) const { - return GetNumberBy(key); - } - - FX_BOOL KeyExist(const CFX_ByteStringC& key) const; - bool IsSignatureDict() const; - - // Set* functions invalidate iterators for the element with the key |key|. - void SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj); - void SetAtName(const CFX_ByteStringC& key, const CFX_ByteString& name); - void SetAtString(const CFX_ByteStringC& key, const CFX_ByteString& str); - void SetAtInteger(const CFX_ByteStringC& key, int i); - void SetAtNumber(const CFX_ByteStringC& key, FX_FLOAT f); - void SetAtReference(const CFX_ByteStringC& key, - CPDF_IndirectObjectHolder* pDoc, - FX_DWORD objnum); - void SetAtReference(const CFX_ByteStringC& key, - CPDF_IndirectObjectHolder* pDoc, - CPDF_Object* obj) { - SetAtReference(key, pDoc, obj->GetObjNum()); - } - void SetAtRect(const CFX_ByteStringC& key, const CFX_FloatRect& rect); - void SetAtMatrix(const CFX_ByteStringC& key, const CFX_Matrix& matrix); - void SetAtBoolean(const CFX_ByteStringC& key, FX_BOOL bValue); - - void AddReference(const CFX_ByteStringC& key, - CPDF_IndirectObjectHolder* pDoc, - FX_DWORD objnum); - - // Invalidates iterators for the element with the key |key|. - void RemoveAt(const CFX_ByteStringC& key); - - // Invalidates iterators for the element with the key |oldkey|. - void ReplaceKey(const CFX_ByteStringC& oldkey, const CFX_ByteStringC& newkey); - - iterator begin() { return m_Map.begin(); } - iterator end() { return m_Map.end(); } - const_iterator begin() const { return m_Map.begin(); } - const_iterator end() const { return m_Map.end(); } - - protected: - ~CPDF_Dictionary() override; - - std::map m_Map; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_DICTIONARY_H_ diff --git a/core/include/fpdfapi/cpdf_document.h b/core/include/fpdfapi/cpdf_document.h deleted file mode 100644 index af7e2ab787..0000000000 --- a/core/include/fpdfapi/cpdf_document.h +++ /dev/null @@ -1,137 +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_INCLUDE_FPDFAPI_CPDF_DOCUMENT_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_DOCUMENT_H_ - -#include "core/include/fpdfapi/cpdf_indirect_object_holder.h" -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fxcrt/fx_basic.h" - -class CFX_Font; -class CFX_Matrix; -class CPDF_ColorSpace; -class CPDF_DocPageData; -class CPDF_DocRenderData; -class CPDF_Font; -class CPDF_FontEncoding; -class CPDF_IccProfile; -class CPDF_Image; -class CPDF_Pattern; -class CPDF_StreamAcc; - -#define FPDFPERM_PRINT 0x0004 -#define FPDFPERM_MODIFY 0x0008 -#define FPDFPERM_EXTRACT 0x0010 -#define FPDFPERM_ANNOT_FORM 0x0020 -#define FPDFPERM_FILL_FORM 0x0100 -#define FPDFPERM_EXTRACT_ACCESS 0x0200 -#define FPDFPERM_ASSEMBLE 0x0400 -#define FPDFPERM_PRINT_HIGH 0x0800 -#define FPDF_PAGE_MAX_NUM 0xFFFFF - -class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder { - public: - CPDF_Document(); - explicit CPDF_Document(CPDF_Parser* pParser); - ~CPDF_Document(); - - CPDF_Parser* GetParser() const { return m_pParser; } - CPDF_Dictionary* GetRoot() const { return m_pRootDict; } - CPDF_Dictionary* GetInfo() const { return m_pInfoDict; } - - void GetID(CFX_ByteString& id1, CFX_ByteString& id2) const { - id1 = m_ID1; - id2 = m_ID2; - } - - int GetPageCount() const; - CPDF_Dictionary* GetPage(int iPage); - int GetPageIndex(FX_DWORD objnum); - FX_DWORD GetUserPermissions(FX_BOOL bCheckRevision = FALSE) const; - CPDF_DocPageData* GetPageData() { return GetValidatePageData(); } - void ClearPageData(); - void RemoveColorSpaceFromPageData(CPDF_Object* pObject); - - CPDF_DocRenderData* GetRenderData() { return GetValidateRenderData(); } - void ClearRenderData(); - void ClearRenderFont(); - - FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const; - - // |pFontDict| must not be null. - CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict); - CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj, - CPDF_Dictionary* pResources = NULL); - - CPDF_Pattern* LoadPattern(CPDF_Object* pObj, - FX_BOOL bShading, - const CFX_Matrix* matrix = NULL); - - CPDF_Image* LoadImageF(CPDF_Object* pObj); - CPDF_StreamAcc* LoadFontFile(CPDF_Stream* pStream); - CPDF_IccProfile* LoadIccProfile(CPDF_Stream* pStream); - -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - - CPDF_Font* AddWindowsFont(LOGFONTA* pLogFont, - FX_BOOL bVert, - FX_BOOL bTranslateName = FALSE); - CPDF_Font* AddWindowsFont(LOGFONTW* pLogFont, - FX_BOOL bVert, - FX_BOOL bTranslateName = FALSE); -#endif -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - CPDF_Font* AddMacFont(CTFontRef pFont, - FX_BOOL bVert, - FX_BOOL bTranslateName = FALSE); -#endif - - CPDF_Font* AddStandardFont(const FX_CHAR* font, CPDF_FontEncoding* pEncoding); - CPDF_Font* AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert); - void CreateNewDoc(); - - CPDF_Dictionary* CreateNewPage(int iPage); - void DeletePage(int iPage); - - void LoadDoc(); - void LoadAsynDoc(CPDF_Dictionary* pLinearized); - void LoadPages(); - - protected: - // Retrieve page count information by getting count value from the tree nodes - // or walking through the tree nodes to calculate it. - int RetrievePageCount() const; - CPDF_Dictionary* _FindPDFPage(CPDF_Dictionary* pPages, - int iPage, - int nPagesToGo, - int level); - int _FindPageIndex(CPDF_Dictionary* pNode, - FX_DWORD& skip_count, - FX_DWORD objnum, - int& index, - int level = 0); - FX_BOOL CheckOCGVisible(CPDF_Dictionary* pOCG, FX_BOOL bPrinting); - CPDF_DocPageData* GetValidatePageData(); - CPDF_DocRenderData* GetValidateRenderData(); - friend class CPDF_Creator; - friend class CPDF_Parser; - friend class CPDF_DataAvail; - friend class CPDF_OCContext; - - CPDF_Dictionary* m_pRootDict; - CPDF_Dictionary* m_pInfoDict; - CFX_ByteString m_ID1; - CFX_ByteString m_ID2; - FX_BOOL m_bLinearized; - FX_DWORD m_dwFirstPageNo; - FX_DWORD m_dwFirstPageObjNum; - CFX_DWordArray m_PageList; - CPDF_DocPageData* m_pDocPage; - CPDF_DocRenderData* m_pDocRender; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_DOCUMENT_H_ diff --git a/core/include/fpdfapi/cpdf_indirect_object_holder.h b/core/include/fpdfapi/cpdf_indirect_object_holder.h deleted file mode 100644 index 9f12323669..0000000000 --- a/core/include/fpdfapi/cpdf_indirect_object_holder.h +++ /dev/null @@ -1,44 +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_INCLUDE_FPDFAPI_CPDF_INDIRECT_OBJECT_HOLDER_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_INDIRECT_OBJECT_HOLDER_H_ - -#include - -#include "core/include/fxcrt/fx_system.h" - -class CPDF_Object; -class CPDF_Parser; - -class CPDF_IndirectObjectHolder { - public: - using iterator = std::map::iterator; - using const_iterator = std::map::const_iterator; - - explicit CPDF_IndirectObjectHolder(CPDF_Parser* pParser); - ~CPDF_IndirectObjectHolder(); - - CPDF_Object* GetIndirectObject(FX_DWORD objnum); - FX_DWORD AddIndirectObject(CPDF_Object* pObj); - void ReleaseIndirectObject(FX_DWORD objnum); - - // Takes ownership of |pObj|. - FX_BOOL InsertIndirectObject(FX_DWORD objnum, CPDF_Object* pObj); - - FX_DWORD GetLastObjNum() const { return m_LastObjNum; } - iterator begin() { return m_IndirectObjs.begin(); } - const_iterator begin() const { return m_IndirectObjs.begin(); } - iterator end() { return m_IndirectObjs.end(); } - const_iterator end() const { return m_IndirectObjs.end(); } - - protected: - CPDF_Parser* m_pParser; - FX_DWORD m_LastObjNum; - std::map m_IndirectObjs; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_INDIRECT_OBJECT_HOLDER_H_ diff --git a/core/include/fpdfapi/cpdf_name.h b/core/include/fpdfapi/cpdf_name.h deleted file mode 100644 index c956244112..0000000000 --- a/core/include/fpdfapi/cpdf_name.h +++ /dev/null @@ -1,35 +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_INCLUDE_FPDFAPI_CPDF_NAME_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_NAME_H_ - -#include "core/include/fpdfapi/cpdf_object.h" - -class CPDF_Name : public CPDF_Object { - public: - explicit CPDF_Name(const CFX_ByteString& str); - explicit CPDF_Name(const CFX_ByteStringC& str); - explicit CPDF_Name(const FX_CHAR* str); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; - CFX_ByteString GetString() const override; - CFX_ByteStringC GetConstString() const override; - CFX_WideString GetUnicodeText() const override; - void SetString(const CFX_ByteString& str) override; - bool IsName() const override; - CPDF_Name* AsName() override; - const CPDF_Name* AsName() const override; - - protected: - ~CPDF_Name() override; - - CFX_ByteString m_Name; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_NAME_H_ diff --git a/core/include/fpdfapi/cpdf_null.h b/core/include/fpdfapi/cpdf_null.h deleted file mode 100644 index 654c2a4029..0000000000 --- a/core/include/fpdfapi/cpdf_null.h +++ /dev/null @@ -1,21 +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_INCLUDE_FPDFAPI_CPDF_NULL_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_NULL_H_ - -#include "core/include/fpdfapi/cpdf_object.h" - -class CPDF_Null : public CPDF_Object { - public: - CPDF_Null(); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_NULL_H_ diff --git a/core/include/fpdfapi/cpdf_number.h b/core/include/fpdfapi/cpdf_number.h deleted file mode 100644 index 8bab95ebc2..0000000000 --- a/core/include/fpdfapi/cpdf_number.h +++ /dev/null @@ -1,44 +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_INCLUDE_FPDFAPI_CPDF_NUMBER_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_NUMBER_H_ - -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fxcrt/fx_string.h" -#include "core/include/fxcrt/fx_system.h" - -class CPDF_Number : public CPDF_Object { - public: - CPDF_Number(); - explicit CPDF_Number(int value); - explicit CPDF_Number(FX_FLOAT value); - explicit CPDF_Number(const CFX_ByteStringC& str); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; - CFX_ByteString GetString() const override; - FX_FLOAT GetNumber() const override; - int GetInteger() const override; - void SetString(const CFX_ByteString& str) override; - bool IsNumber() const override; - CPDF_Number* AsNumber() override; - const CPDF_Number* AsNumber() const override; - - FX_BOOL IsInteger() { return m_bInteger; } - - protected: - ~CPDF_Number() override; - - FX_BOOL m_bInteger; - union { - int m_Integer; - FX_FLOAT m_Float; - }; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_NUMBER_H_ diff --git a/core/include/fpdfapi/cpdf_object.h b/core/include/fpdfapi/cpdf_object.h deleted file mode 100644 index 97499d140c..0000000000 --- a/core/include/fpdfapi/cpdf_object.h +++ /dev/null @@ -1,161 +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_INCLUDE_FPDFAPI_CPDF_OBJECT_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_OBJECT_H_ - -#include "core/include/fxcrt/fx_string.h" -#include "core/include/fxcrt/fx_system.h" - -class CPDF_Array; -class CPDF_Boolean; -class CPDF_Dictionary; -class CPDF_Name; -class CPDF_Null; -class CPDF_Number; -class CPDF_Reference; -class CPDF_Stream; -class CPDF_String; - -class CPDF_Object { - public: - enum Type { - BOOLEAN = 1, - NUMBER, - STRING, - NAME, - ARRAY, - DICTIONARY, - STREAM, - NULLOBJ, - REFERENCE - }; - - virtual Type GetType() const = 0; - FX_DWORD GetObjNum() const { return m_ObjNum; } - FX_DWORD GetGenNum() const { return m_GenNum; } - - virtual CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const = 0; - virtual CPDF_Object* GetDirect() const; - - FX_BOOL IsModified() const { return FALSE; } - void Release(); - - virtual CFX_ByteString GetString() const; - virtual CFX_ByteStringC GetConstString() const; - virtual CFX_WideString GetUnicodeText() const; - virtual FX_FLOAT GetNumber() const; - virtual int GetInteger() const; - virtual CPDF_Dictionary* GetDict() const; - virtual CPDF_Array* GetArray() const; - - virtual void SetString(const CFX_ByteString& str); - - virtual bool IsArray() const; - virtual bool IsBoolean() const; - virtual bool IsDictionary() const; - virtual bool IsName() const; - virtual bool IsNumber() const; - virtual bool IsReference() const; - virtual bool IsStream() const; - virtual bool IsString() const; - - virtual CPDF_Array* AsArray(); - virtual const CPDF_Array* AsArray() const; - virtual CPDF_Boolean* AsBoolean(); - virtual const CPDF_Boolean* AsBoolean() const; - virtual CPDF_Dictionary* AsDictionary(); - virtual const CPDF_Dictionary* AsDictionary() const; - virtual CPDF_Name* AsName(); - virtual const CPDF_Name* AsName() const; - virtual CPDF_Number* AsNumber(); - virtual const CPDF_Number* AsNumber() const; - virtual CPDF_Reference* AsReference(); - virtual const CPDF_Reference* AsReference() const; - virtual CPDF_Stream* AsStream(); - virtual const CPDF_Stream* AsStream() const; - virtual CPDF_String* AsString(); - virtual const CPDF_String* AsString() const; - - protected: - CPDF_Object() : m_ObjNum(0), m_GenNum(0) {} - virtual ~CPDF_Object(); - void Destroy() { delete this; } - - FX_DWORD m_ObjNum; - FX_DWORD m_GenNum; - - friend class CPDF_IndirectObjectHolder; - friend class CPDF_Parser; - - private: - CPDF_Object(const CPDF_Object& src) {} -}; - -inline CPDF_Boolean* ToBoolean(CPDF_Object* obj) { - return obj ? obj->AsBoolean() : nullptr; -} - -inline const CPDF_Boolean* ToBoolean(const CPDF_Object* obj) { - return obj ? obj->AsBoolean() : nullptr; -} - -inline CPDF_Number* ToNumber(CPDF_Object* obj) { - return obj ? obj->AsNumber() : nullptr; -} - -inline const CPDF_Number* ToNumber(const CPDF_Object* obj) { - return obj ? obj->AsNumber() : nullptr; -} - -inline CPDF_String* ToString(CPDF_Object* obj) { - return obj ? obj->AsString() : nullptr; -} - -inline const CPDF_String* ToString(const CPDF_Object* obj) { - return obj ? obj->AsString() : nullptr; -} - -inline CPDF_Name* ToName(CPDF_Object* obj) { - return obj ? obj->AsName() : nullptr; -} - -inline const CPDF_Name* ToName(const CPDF_Object* obj) { - return obj ? obj->AsName() : nullptr; -} - -inline CPDF_Array* ToArray(CPDF_Object* obj) { - return obj ? obj->AsArray() : nullptr; -} - -inline const CPDF_Array* ToArray(const CPDF_Object* obj) { - return obj ? obj->AsArray() : nullptr; -} - -inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) { - return obj ? obj->AsDictionary() : nullptr; -} - -inline const CPDF_Dictionary* ToDictionary(const CPDF_Object* obj) { - return obj ? obj->AsDictionary() : nullptr; -} -inline CPDF_Reference* ToReference(CPDF_Object* obj) { - return obj ? obj->AsReference() : nullptr; -} - -inline const CPDF_Reference* ToReference(const CPDF_Object* obj) { - return obj ? obj->AsReference() : nullptr; -} - -inline CPDF_Stream* ToStream(CPDF_Object* obj) { - return obj ? obj->AsStream() : nullptr; -} - -inline const CPDF_Stream* ToStream(const CPDF_Object* obj) { - return obj ? obj->AsStream() : nullptr; -} - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_OBJECT_H_ diff --git a/core/include/fpdfapi/cpdf_parser.h b/core/include/fpdfapi/cpdf_parser.h deleted file mode 100644 index f2d7343e87..0000000000 --- a/core/include/fpdfapi/cpdf_parser.h +++ /dev/null @@ -1,173 +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_INCLUDE_FPDFAPI_CPDF_PARSER_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_PARSER_H_ - -#include -#include -#include - -#include "core/include/fxcrt/fx_basic.h" - -class CPDF_Array; -class CPDF_Dictionary; -class CPDF_Document; -class CPDF_IndirectObjectHolder; -class CPDF_Object; -class CPDF_StreamAcc; -class CPDF_SyntaxParser; -class IFX_FileRead; -class IPDF_CryptoHandler; -class IPDF_SecurityHandler; - -class CPDF_Parser { - public: - enum Error { - SUCCESS = 0, - FILE_ERROR, - FORMAT_ERROR, - PASSWORD_ERROR, - HANDLER_ERROR - }; - - CPDF_Parser(); - ~CPDF_Parser(); - - Error StartParse(IFX_FileRead* pFile); - FX_DWORD GetPermissions(FX_BOOL bCheckRevision = FALSE); - - void SetPassword(const FX_CHAR* password) { m_Password = password; } - CFX_ByteString GetPassword() { return m_Password; } - CPDF_Dictionary* GetTrailer() const { return m_pTrailer; } - FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; } - CPDF_Document* GetDocument() const { return m_pDocument; } - - FX_DWORD GetRootObjNum(); - FX_DWORD GetInfoObjNum(); - CPDF_Array* GetIDArray(); - - CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; } - - CPDF_Object* ParseIndirectObject(CPDF_IndirectObjectHolder* pObjList, - FX_DWORD objnum); - - FX_DWORD GetLastObjNum() const; - bool IsValidObjectNumber(FX_DWORD objnum) const; - FX_FILESIZE GetObjectPositionOrZero(FX_DWORD objnum) const; - uint8_t GetObjectType(FX_DWORD objnum) const; - uint16_t GetObjectGenNum(FX_DWORD objnum) const; - bool IsVersionUpdated() const { return m_bVersionUpdated; } - bool IsObjectFreeOrNull(FX_DWORD objnum) const; - FX_BOOL IsFormStream(FX_DWORD objnum, FX_BOOL& bForm); - IPDF_CryptoHandler* GetCryptoHandler(); - IFX_FileRead* GetFileAccess() const; - - FX_FILESIZE GetObjectOffset(FX_DWORD objnum) const; - FX_FILESIZE GetObjectSize(FX_DWORD objnum) const; - - void GetIndirectBinary(FX_DWORD objnum, uint8_t*& pBuffer, FX_DWORD& size); - int GetFileVersion() const { return m_FileVersion; } - FX_BOOL IsXRefStream() const { return m_bXRefStream; } - - CPDF_Object* ParseIndirectObjectAt(CPDF_IndirectObjectHolder* pObjList, - FX_FILESIZE pos, - FX_DWORD objnum); - - CPDF_Object* ParseIndirectObjectAtByStrict( - CPDF_IndirectObjectHolder* pObjList, - FX_FILESIZE pos, - FX_DWORD objnum, - FX_FILESIZE* pResultPos); - - Error StartAsyncParse(IFX_FileRead* pFile); - - FX_DWORD GetFirstPageNo() const { return m_dwFirstPageNo; } - - protected: - struct ObjectInfo { - ObjectInfo() : pos(0), type(0), gennum(0) {} - - FX_FILESIZE pos; - uint8_t type; - uint16_t gennum; - }; - - void CloseParser(); - CPDF_Object* ParseDirect(CPDF_Object* pObj); - FX_BOOL LoadAllCrossRefV4(FX_FILESIZE pos); - FX_BOOL LoadAllCrossRefV5(FX_FILESIZE pos); - bool LoadCrossRefV4(FX_FILESIZE pos, FX_FILESIZE streampos, FX_BOOL bSkip); - FX_BOOL LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef); - CPDF_Dictionary* LoadTrailerV4(); - FX_BOOL RebuildCrossRef(); - Error SetEncryptHandler(); - void ReleaseEncryptHandler(); - FX_BOOL LoadLinearizedAllCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); - FX_BOOL LoadLinearizedCrossRefV4(FX_FILESIZE pos, FX_DWORD dwObjCount); - FX_BOOL LoadLinearizedAllCrossRefV5(FX_FILESIZE pos); - Error LoadLinearizedMainXRefTable(); - CPDF_StreamAcc* GetObjectStream(FX_DWORD number); - FX_BOOL IsLinearizedFile(IFX_FileRead* pFileAccess, FX_DWORD offset); - void SetEncryptDictionary(CPDF_Dictionary* pDict); - void ShrinkObjectMap(FX_DWORD size); - - CPDF_Document* m_pDocument; - std::unique_ptr m_pSyntax; - bool m_bOwnFileRead; - int m_FileVersion; - CPDF_Dictionary* m_pTrailer; - CPDF_Dictionary* m_pEncryptDict; - FX_FILESIZE m_LastXRefOffset; - FX_BOOL m_bXRefStream; - std::unique_ptr m_pSecurityHandler; - CFX_ByteString m_bsRecipient; - CFX_ByteString m_FilePath; - CFX_ByteString m_Password; - std::map m_ObjectInfo; - std::set m_SortedOffset; - CFX_ArrayTemplate m_Trailers; - bool m_bVersionUpdated; - CPDF_Object* m_pLinearized; - FX_DWORD m_dwFirstPageNo; - FX_DWORD m_dwXrefStartObjNum; - - // A map of object numbers to indirect streams. Map owns the streams. - std::map> m_ObjectStreamMap; - - // Mapping of object numbers to offsets. The offsets are relative to the first - // object in the stream. - using StreamObjectCache = std::map; - - // Mapping of streams to their object caches. This is valid as long as the - // streams in |m_ObjectStreamMap| are valid. - std::map m_ObjCache; - - // All indirect object numbers that are being parsed. - std::set m_ParsingObjNums; - - friend class CPDF_DataAvail; - - private: - enum class ParserState { - kDefault, - kComment, - kWhitespace, - kString, - kHexString, - kEscapedString, - kXref, - kObjNum, - kPostObjNum, - kGenNum, - kPostGenNum, - kTrailer, - kBeginObj, - kEndObj - }; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_PARSER_H_ diff --git a/core/include/fpdfapi/cpdf_reference.h b/core/include/fpdfapi/cpdf_reference.h deleted file mode 100644 index 2444aad4fd..0000000000 --- a/core/include/fpdfapi/cpdf_reference.h +++ /dev/null @@ -1,51 +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_INCLUDE_FPDFAPI_CPDF_REFERENCE_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_REFERENCE_H_ - -#include "core/include/fpdfapi/cpdf_object.h" - -class CPDF_IndirectObjectHolder; - -class CPDF_Reference : public CPDF_Object { - public: - CPDF_Reference(CPDF_IndirectObjectHolder* pDoc, int objnum); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; - CPDF_Object* GetDirect() const override; - CFX_ByteString GetString() const override; - CFX_ByteStringC GetConstString() const override; - FX_FLOAT GetNumber() const override; - int GetInteger() const override; - CPDF_Dictionary* GetDict() const override; - - // TODO(weili): check whether GetUnicodeText() and GetArray() are needed. - bool IsReference() const override; - CPDF_Reference* AsReference() override; - const CPDF_Reference* AsReference() const override; - - CPDF_IndirectObjectHolder* GetObjList() const { return m_pObjList; } - FX_DWORD GetRefObjNum() const { return m_RefObjNum; } - - void SetRef(CPDF_IndirectObjectHolder* pDoc, FX_DWORD objnum); - - protected: - ~CPDF_Reference() override; - CPDF_Object* SafeGetDirect() const { - CPDF_Object* obj = GetDirect(); - if (!obj || obj->IsReference()) - return nullptr; - return obj; - } - - CPDF_IndirectObjectHolder* m_pObjList; - FX_DWORD m_RefObjNum; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_REFERENCE_H_ diff --git a/core/include/fpdfapi/cpdf_simple_parser.h b/core/include/fpdfapi/cpdf_simple_parser.h deleted file mode 100644 index dc1441d18e..0000000000 --- a/core/include/fpdfapi/cpdf_simple_parser.h +++ /dev/null @@ -1,35 +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_INCLUDE_FPDFAPI_CPDF_SIMPLE_PARSER_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_SIMPLE_PARSER_H_ - -#include "core/include/fxcrt/fx_string.h" -#include "core/include/fxcrt/fx_system.h" - -class CPDF_SimpleParser { - public: - CPDF_SimpleParser(const uint8_t* pData, FX_DWORD dwSize); - CPDF_SimpleParser(const CFX_ByteStringC& str); - - CFX_ByteStringC GetWord(); - - // Find the token and its |nParams| parameters from the start of data, - // and move the current position to the start of those parameters. - bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams); - - // For testing only. - FX_DWORD GetCurPos() const { return m_dwCurPos; } - - private: - void ParseWord(const uint8_t*& pStart, FX_DWORD& dwSize); - - const uint8_t* m_pData; - FX_DWORD m_dwSize; - FX_DWORD m_dwCurPos; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_SIMPLE_PARSER_H_ diff --git a/core/include/fpdfapi/cpdf_stream.h b/core/include/fpdfapi/cpdf_stream.h deleted file mode 100644 index 579a3a97be..0000000000 --- a/core/include/fpdfapi/cpdf_stream.h +++ /dev/null @@ -1,61 +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_INCLUDE_FPDFAPI_CPDF_STREAM_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ - -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fxcrt/fx_stream.h" - -class CPDF_Stream : public CPDF_Object { - public: - CPDF_Stream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; - CPDF_Dictionary* GetDict() const override; - CFX_WideString GetUnicodeText() const override; - bool IsStream() const override; - CPDF_Stream* AsStream() override; - const CPDF_Stream* AsStream() const override; - - FX_DWORD GetRawSize() const { return m_dwSize; } - uint8_t* GetRawData() const { return m_pDataBuf; } - - void SetData(const uint8_t* pData, - FX_DWORD size, - FX_BOOL bCompressed, - FX_BOOL bKeepBuf); - - void InitStream(uint8_t* pData, FX_DWORD size, CPDF_Dictionary* pDict); - void InitStreamFromFile(IFX_FileRead* pFile, CPDF_Dictionary* pDict); - - FX_BOOL ReadRawData(FX_FILESIZE start_pos, - uint8_t* pBuf, - FX_DWORD buf_size) const; - - bool IsMemoryBased() const { return m_GenNum == kMemoryBasedGenNum; } - - protected: - static const FX_DWORD kMemoryBasedGenNum = (FX_DWORD)-1; - - ~CPDF_Stream() override; - - void InitStreamInternal(CPDF_Dictionary* pDict); - - CPDF_Dictionary* m_pDict; - FX_DWORD m_dwSize; - FX_DWORD m_GenNum; - - union { - uint8_t* m_pDataBuf; - IFX_FileRead* m_pFile; - }; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_STREAM_H_ diff --git a/core/include/fpdfapi/cpdf_stream_acc.h b/core/include/fpdfapi/cpdf_stream_acc.h deleted file mode 100644 index 77ad272de3..0000000000 --- a/core/include/fpdfapi/cpdf_stream_acc.h +++ /dev/null @@ -1,46 +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_INCLUDE_FPDFAPI_CPDF_STREAM_ACC_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_STREAM_ACC_H_ - -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fxcrt/fx_string.h" -#include "core/include/fxcrt/fx_system.h" - -class CPDF_StreamAcc { - public: - CPDF_StreamAcc(); - ~CPDF_StreamAcc(); - - void LoadAllData(const CPDF_Stream* pStream, - FX_BOOL bRawAccess = FALSE, - FX_DWORD estimated_size = 0, - FX_BOOL bImageAcc = FALSE); - - const CPDF_Stream* GetStream() const { return m_pStream; } - CPDF_Dictionary* GetDict() const { - return m_pStream ? m_pStream->GetDict() : nullptr; - } - - const uint8_t* GetData() const; - FX_DWORD GetSize() const; - const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; } - const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; } - uint8_t* DetachData(); - - protected: - uint8_t* m_pData; - FX_DWORD m_dwSize; - FX_BOOL m_bNewBuf; - CFX_ByteString m_ImageDecoder; - CPDF_Dictionary* m_pImageParam; - const CPDF_Stream* m_pStream; - uint8_t* m_pSrcData; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_STREAM_ACC_H_ diff --git a/core/include/fpdfapi/cpdf_string.h b/core/include/fpdfapi/cpdf_string.h deleted file mode 100644 index 895513813c..0000000000 --- a/core/include/fpdfapi/cpdf_string.h +++ /dev/null @@ -1,40 +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_INCLUDE_FPDFAPI_CPDF_STRING_H_ -#define CORE_INCLUDE_FPDFAPI_CPDF_STRING_H_ - -#include "core/include/fpdfapi/cpdf_object.h" -#include "core/include/fxcrt/fx_string.h" -#include "core/include/fxcrt/fx_system.h" - -class CPDF_String : public CPDF_Object { - public: - CPDF_String(); - CPDF_String(const CFX_ByteString& str, FX_BOOL bHex); - explicit CPDF_String(const CFX_WideString& str); - - // CPDF_Object. - Type GetType() const override; - CPDF_Object* Clone(FX_BOOL bDirect = FALSE) const override; - CFX_ByteString GetString() const override; - CFX_ByteStringC GetConstString() const override; - CFX_WideString GetUnicodeText() const override; - void SetString(const CFX_ByteString& str) override; - bool IsString() const override; - CPDF_String* AsString() override; - const CPDF_String* AsString() const override; - - FX_BOOL IsHex() const { return m_bHex; } - - protected: - ~CPDF_String() override; - - CFX_ByteString m_String; - FX_BOOL m_bHex; -}; - -#endif // CORE_INCLUDE_FPDFAPI_CPDF_STRING_H_ diff --git a/core/include/fpdfapi/fpdf_module.h b/core/include/fpdfapi/fpdf_module.h deleted file mode 100644 index e8cbb0d201..0000000000 --- a/core/include/fpdfapi/fpdf_module.h +++ /dev/null @@ -1,101 +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_FPDFAPI_FPDF_MODULE_H_ -#define CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ - -#include - -#include "core/include/fxcrt/fx_coordinates.h" -#include "core/include/fxcrt/fx_system.h" - -class CCodec_ModuleMgr; -class CPDF_ColorSpace; -class CPDF_DocPageData; -class CPDF_DocRenderData; -class CPDF_Document; -class CPDF_FontGlobals; -class CPDF_Page; -class CPDF_PageRenderCache; -class ICodec_FaxModule; -class ICodec_FlateModule; -class ICodec_IccModule; -class ICodec_Jbig2Module; -class ICodec_JpegModule; -class ICodec_JpxModule; -class IPDF_PageModule; -class IPDF_RenderModule; - -class CPDF_ModuleMgr { - public: - static CPDF_ModuleMgr* Get(); - static void Create(); - static void Destroy(); - static const int kFileBufSize = 512; - - void SetCodecModule(CCodec_ModuleMgr* pModule) { m_pCodecModule = pModule; } - CCodec_ModuleMgr* GetCodecModule() { return m_pCodecModule; } - - void InitPageModule(); - void InitRenderModule(); - - IPDF_RenderModule* GetRenderModule() const { return m_pRenderModule.get(); } - IPDF_PageModule* GetPageModule() const { return m_pPageModule.get(); } - - void LoadEmbeddedGB1CMaps(); - void LoadEmbeddedCNS1CMaps(); - void LoadEmbeddedJapan1CMaps(); - void LoadEmbeddedKorea1CMaps(); - - ICodec_FaxModule* GetFaxModule(); - ICodec_JpegModule* GetJpegModule(); - ICodec_JpxModule* GetJpxModule(); - ICodec_Jbig2Module* GetJbig2Module(); - ICodec_IccModule* GetIccModule(); - ICodec_FlateModule* GetFlateModule(); - - void SetPrivateData(void* module_id, - void* pData, - PD_CALLBACK_FREEDATA callback); - - void* GetPrivateData(void* module_id); - - private: - CPDF_ModuleMgr(); - ~CPDF_ModuleMgr(); - - CCodec_ModuleMgr* m_pCodecModule; - std::unique_ptr m_pRenderModule; - std::unique_ptr m_pPageModule; - CFX_PrivateData m_privateData; -}; - -class IPDF_PageModule { - public: - virtual ~IPDF_PageModule() {} - - virtual CPDF_DocPageData* CreateDocData(CPDF_Document* pDoc) = 0; - virtual void ReleaseDoc(CPDF_Document* pDoc) = 0; - virtual void ClearDoc(CPDF_Document* pDoc) = 0; - virtual CPDF_FontGlobals* GetFontGlobals() = 0; - virtual void ClearStockFont(CPDF_Document* pDoc) = 0; - virtual void NotifyCJKAvailable() = 0; - virtual CPDF_ColorSpace* GetStockCS(int family) = 0; -}; - -class IPDF_RenderModule { - public: - virtual ~IPDF_RenderModule() {} - - virtual CPDF_DocRenderData* CreateDocData(CPDF_Document* pDoc) = 0; - virtual void DestroyDocData(CPDF_DocRenderData* pDocRenderData) = 0; - virtual void ClearDocData(CPDF_DocRenderData* pDocRenderData) = 0; - virtual CPDF_DocRenderData* GetRenderData() = 0; - virtual CPDF_PageRenderCache* CreatePageCache(CPDF_Page* pPage) = 0; - virtual void DestroyPageCache(CPDF_PageRenderCache* pCache) = 0; -}; - -#endif // CORE_INCLUDE_FPDFAPI_FPDF_MODULE_H_ diff --git a/core/include/fpdfapi/fpdf_parser_decode.h b/core/include/fpdfapi/fpdf_parser_decode.h deleted file mode 100644 index 1217c7ea21..0000000000 --- a/core/include/fpdfapi/fpdf_parser_decode.h +++ /dev/null @@ -1,76 +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_INCLUDE_FPDFAPI_FPDF_PARSER_DECODE_H_ -#define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_DECODE_H_ - -#include "core/include/fxcrt/fx_basic.h" - -class CPDF_Dictionary; - -// Indexed by 8-bit char code, contains unicode code points. -extern const FX_WORD PDFDocEncoding[256]; - -CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig); -CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig); -CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig); -CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, - FX_BOOL bHex = FALSE); -CFX_WideString PDF_DecodeText(const uint8_t* pData, FX_DWORD size); -CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr); -CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1); -CFX_ByteString PDF_EncodeText(const CFX_WideString& str); - -void FlateEncode(const uint8_t* src_buf, - FX_DWORD src_size, - uint8_t*& dest_buf, - FX_DWORD& dest_size); -void FlateEncode(const uint8_t* src_buf, - FX_DWORD src_size, - int predictor, - int Colors, - int BitsPerComponent, - int Columns, - uint8_t*& dest_buf, - FX_DWORD& dest_size); -FX_DWORD FlateDecode(const uint8_t* src_buf, - FX_DWORD src_size, - uint8_t*& dest_buf, - FX_DWORD& dest_size); -FX_DWORD RunLengthDecode(const uint8_t* src_buf, - FX_DWORD src_size, - uint8_t*& dest_buf, - FX_DWORD& dest_size); - -// Public for testing. -FX_DWORD A85Decode(const uint8_t* src_buf, - FX_DWORD src_size, - uint8_t*& dest_buf, - FX_DWORD& dest_size); -// Public for testing. -FX_DWORD HexDecode(const uint8_t* src_buf, - FX_DWORD src_size, - uint8_t*& dest_buf, - FX_DWORD& dest_size); -// Public for testing. -FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, - const uint8_t* src_buf, - FX_DWORD src_size, - CPDF_Dictionary* pParams, - FX_DWORD estimated_size, - uint8_t*& dest_buf, - FX_DWORD& dest_size); -FX_BOOL PDF_DataDecode(const uint8_t* src_buf, - FX_DWORD src_size, - const CPDF_Dictionary* pDict, - uint8_t*& dest_buf, - FX_DWORD& dest_size, - CFX_ByteString& ImageEncoding, - CPDF_Dictionary*& pImageParms, - FX_DWORD estimated_size, - FX_BOOL bImageAcc); - -#endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_DECODE_H_ diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h deleted file mode 100644 index 71711e3b16..0000000000 --- a/core/include/fpdfapi/fpdf_render.h +++ /dev/null @@ -1,263 +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_FPDFAPI_FPDF_RENDER_H_ -#define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ - -#include -#include - -#include "core/include/fpdfapi/fpdf_page.h" -#include "core/include/fxge/fx_ge.h" - -class CFX_GraphStateData; -class CFX_PathData; -class CFX_RenderDevice; -class CPDF_ImageCacheEntry; -class CPDF_RenderStatus; -class IFX_Pause; - -class IPDF_OCContext { - public: - virtual ~IPDF_OCContext() {} - - virtual FX_BOOL CheckOCGVisible(const CPDF_Dictionary* pOCG) = 0; - - FX_BOOL CheckObjectVisible(const CPDF_PageObject* pObj); -}; -#define RENDER_COLOR_NORMAL 0 -#define RENDER_COLOR_GRAY 1 -#define RENDER_COLOR_TWOCOLOR 2 -#define RENDER_COLOR_ALPHA 3 -#define RENDER_CLEARTYPE 0x00000001 -#define RENDER_PRINTGRAPHICTEXT 0x00000002 -#define RENDER_FORCE_DOWNSAMPLE 0x00000004 -#define RENDER_PRINTPREVIEW 0x00000008 -#define RENDER_BGR_STRIPE 0x00000010 -#define RENDER_NO_NATIVETEXT 0x00000020 -#define RENDER_FORCE_HALFTONE 0x00000040 -#define RENDER_RECT_AA 0x00000080 -#define RENDER_FILL_FULLCOVER 0x00000100 -#define RENDER_PRINTIMAGETEXT 0x00000200 -#define RENDER_OVERPRINT 0x00000400 -#define RENDER_THINLINE 0x00000800 -#define RENDER_NOTEXTSMOOTH 0x10000000 -#define RENDER_NOPATHSMOOTH 0x20000000 -#define RENDER_NOIMAGESMOOTH 0x40000000 -#define RENDER_LIMITEDIMAGECACHE 0x80000000 - -class CPDF_RenderOptions { - public: - CPDF_RenderOptions(); - FX_ARGB TranslateColor(FX_ARGB argb) const; - - int m_ColorMode; - FX_COLORREF m_BackColor; - FX_COLORREF m_ForeColor; - FX_DWORD m_Flags; - int m_Interpolation; - FX_DWORD m_AddFlags; - IPDF_OCContext* m_pOCContext; - FX_DWORD m_dwLimitCacheSize; - int m_HalftoneLimit; -}; - -class CPDF_RenderContext { - public: - class Layer { - public: - CPDF_PageObjectHolder* m_pObjectHolder; - CFX_Matrix m_Matrix; - }; - - explicit CPDF_RenderContext(CPDF_Page* pPage); - CPDF_RenderContext(CPDF_Document* pDoc, CPDF_PageRenderCache* pPageCache); - ~CPDF_RenderContext(); - - void AppendLayer(CPDF_PageObjectHolder* pObjectHolder, - const CFX_Matrix* pObject2Device); - - void Render(CFX_RenderDevice* pDevice, - const CPDF_RenderOptions* pOptions, - const CFX_Matrix* pFinalMatrix); - - void Render(CFX_RenderDevice* pDevice, - const CPDF_PageObject* pStopObj, - const CPDF_RenderOptions* pOptions, - const CFX_Matrix* pFinalMatrix); - - void GetBackground(CFX_DIBitmap* pBuffer, - const CPDF_PageObject* pObj, - const CPDF_RenderOptions* pOptions, - CFX_Matrix* pFinalMatrix); - - FX_DWORD CountLayers() const { return m_Layers.GetSize(); } - Layer* GetLayer(FX_DWORD index) { return m_Layers.GetDataPtr(index); } - - CPDF_Document* GetDocument() const { return m_pDocument; } - CPDF_Dictionary* GetPageResources() const { return m_pPageResources; } - CPDF_PageRenderCache* GetPageCache() const { return m_pPageCache; } - - protected: - CPDF_Document* const m_pDocument; - CPDF_Dictionary* m_pPageResources; - CPDF_PageRenderCache* m_pPageCache; - FX_BOOL m_bFirstLayer; - CFX_ArrayTemplate m_Layers; -}; - -class CPDF_ProgressiveRenderer { - public: - // Must match FDF_RENDER_* definitions in public/fpdf_progressive.h, but - // cannot #include that header. fpdfsdk/fpdf_progressive.cpp has - // static_asserts to make sure the two sets of values match. - enum Status { - Ready, // FPDF_RENDER_READER - ToBeContinued, // FPDF_RENDER_TOBECOUNTINUED - Done, // FPDF_RENDER_DONE - Failed // FPDF_RENDER_FAILED - }; - - static int ToFPDFStatus(Status status) { return static_cast(status); } - - CPDF_ProgressiveRenderer(CPDF_RenderContext* pContext, - CFX_RenderDevice* pDevice, - const CPDF_RenderOptions* pOptions); - ~CPDF_ProgressiveRenderer(); - - Status GetStatus() const { return m_Status; } - void Start(IFX_Pause* pPause); - void Continue(IFX_Pause* pPause); - - private: - void RenderStep(); - - // Maximum page objects to render before checking for pause. - static const int kStepLimit = 100; - - Status m_Status; - CPDF_RenderContext* const m_pContext; - CFX_RenderDevice* const m_pDevice; - const CPDF_RenderOptions* const m_pOptions; - std::unique_ptr m_pRenderStatus; - CFX_FloatRect m_ClipRect; - FX_DWORD m_LayerIndex; - CPDF_RenderContext::Layer* m_pCurrentLayer; - CPDF_PageObjectList::iterator m_LastObjectRendered; -}; - -class CPDF_TextRenderer { - public: - static void DrawTextString(CFX_RenderDevice* pDevice, - int left, - int top, - CPDF_Font* pFont, - int height, - const CFX_ByteString& str, - FX_ARGB argb); - - static void DrawTextString(CFX_RenderDevice* pDevice, - FX_FLOAT origin_x, - FX_FLOAT origin_y, - CPDF_Font* pFont, - FX_FLOAT font_size, - const CFX_Matrix* matrix, - const CFX_ByteString& str, - FX_ARGB fill_argb, - FX_ARGB stroke_argb = 0, - const CFX_GraphStateData* pGraphState = NULL, - const CPDF_RenderOptions* pOptions = NULL); - - static FX_BOOL DrawTextPath(CFX_RenderDevice* pDevice, - int nChars, - FX_DWORD* pCharCodes, - FX_FLOAT* pCharPos, - CPDF_Font* pFont, - FX_FLOAT font_size, - const CFX_Matrix* pText2User, - const CFX_Matrix* pUser2Device, - const CFX_GraphStateData* pGraphState, - FX_ARGB fill_argb, - FX_ARGB stroke_argb, - CFX_PathData* pClippingPath, - int nFlag = 0); - - static FX_BOOL DrawNormalText(CFX_RenderDevice* pDevice, - int nChars, - FX_DWORD* pCharCodes, - FX_FLOAT* pCharPos, - CPDF_Font* pFont, - FX_FLOAT font_size, - const CFX_Matrix* pText2Device, - FX_ARGB fill_argb, - const CPDF_RenderOptions* pOptions); - - static FX_BOOL DrawType3Text(CFX_RenderDevice* pDevice, - int nChars, - FX_DWORD* pCharCodes, - FX_FLOAT* pCharPos, - CPDF_Font* pFont, - FX_FLOAT font_size, - const CFX_Matrix* pText2Device, - FX_ARGB fill_argb); -}; -class CPDF_PageRenderCache { - public: - explicit CPDF_PageRenderCache(CPDF_Page* pPage) - : m_pPage(pPage), - m_pCurImageCacheEntry(nullptr), - m_nTimeCount(0), - m_nCacheSize(0), - m_bCurFindCache(FALSE) {} - ~CPDF_PageRenderCache(); - void ClearImageData(); - - FX_DWORD EstimateSize(); - void CacheOptimization(int32_t dwLimitCacheSize); - FX_DWORD GetTimeCount() const { return m_nTimeCount; } - void SetTimeCount(FX_DWORD dwTimeCount) { m_nTimeCount = dwTimeCount; } - - void GetCachedBitmap(CPDF_Stream* pStream, - CFX_DIBSource*& pBitmap, - CFX_DIBSource*& pMask, - FX_DWORD& MatteColor, - FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, - int32_t downsampleWidth = 0, - int32_t downsampleHeight = 0); - - void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap); - void ClearImageCacheEntry(CPDF_Stream* pStream); - CPDF_Page* GetPage() const { return m_pPage; } - CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { - return m_pCurImageCacheEntry; - } - - FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream, - FX_BOOL bStdCS = FALSE, - FX_DWORD GroupFamily = 0, - FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, - int32_t downsampleWidth = 0, - int32_t downsampleHeight = 0); - - FX_BOOL Continue(IFX_Pause* pPause); - - protected: - friend class CPDF_Page; - CPDF_Page* const m_pPage; - CPDF_ImageCacheEntry* m_pCurImageCacheEntry; - std::map m_ImageCache; - FX_DWORD m_nTimeCount; - FX_DWORD m_nCacheSize; - FX_BOOL m_bCurFindCache; -}; - -FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix); - -#endif // CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_ diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h index 7c19dd52c3..a8a3ecc52a 100644 --- a/core/include/fpdfapi/fpdf_resource.h +++ b/core/include/fpdfapi/fpdf_resource.h @@ -9,8 +9,8 @@ #include -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "core/include/fxcrt/fx_system.h" #include "core/include/fxge/fx_font.h" diff --git a/core/include/fpdfapi/fpdf_serial.h b/core/include/fpdfapi/fpdf_serial.h deleted file mode 100644 index cb0c290783..0000000000 --- a/core/include/fpdfapi/fpdf_serial.h +++ /dev/null @@ -1,105 +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_FPDFAPI_FPDF_SERIAL_H_ -#define CORE_INCLUDE_FPDFAPI_FPDF_SERIAL_H_ - -#include "core/include/fpdfapi/fpdf_page.h" -#include "core/include/fpdfapi/fpdf_pageobj.h" - -class CPDF_XRefStream; -class IPDF_CryptoHandler; - -CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj); - -#define FPDFCREATE_INCREMENTAL 1 -#define FPDFCREATE_NO_ORIGINAL 2 -#define FPDFCREATE_PROGRESSIVE 4 -#define FPDFCREATE_OBJECTSTREAM 8 - -class CPDF_Creator { - public: - CPDF_Creator(CPDF_Document* pDoc); - ~CPDF_Creator(); - - void RemoveSecurity(); - bool Create(IFX_StreamWrite* pFile, FX_DWORD flags = 0); - int32_t Continue(IFX_Pause* pPause = NULL); - FX_BOOL SetFileVersion(int32_t fileVersion = 17); - - protected: - CPDF_Document* m_pDocument; - - CPDF_Parser* m_pParser; - - FX_BOOL m_bCompress; - - FX_BOOL m_bSecurityChanged; - - CPDF_Dictionary* m_pEncryptDict; - FX_DWORD m_dwEnryptObjNum; - FX_BOOL m_bEncryptCloned; - - FX_BOOL m_bStandardSecurity; - - IPDF_CryptoHandler* m_pCryptoHandler; - FX_BOOL m_bNewCrypto; - - FX_BOOL m_bEncryptMetadata; - - CPDF_Object* m_pMetadata; - - CPDF_XRefStream* m_pXRefStream; - - int32_t m_ObjectStreamSize; - - FX_DWORD m_dwLastObjNum; - bool Create(FX_DWORD flags); - void ResetStandardSecurity(); - void Clear(); - int32_t WriteDoc_Stage1(IFX_Pause* pPause); - int32_t WriteDoc_Stage2(IFX_Pause* pPause); - int32_t WriteDoc_Stage3(IFX_Pause* pPause); - int32_t WriteDoc_Stage4(IFX_Pause* pPause); - - CFX_FileBufferArchive m_File; - - FX_FILESIZE m_Offset; - void InitOldObjNumOffsets(); - void InitNewObjNumOffsets(); - void AppendNewObjNum(FX_DWORD objbum); - int32_t WriteOldIndirectObject(FX_DWORD objnum); - int32_t WriteOldObjs(IFX_Pause* pPause); - int32_t WriteNewObjs(FX_BOOL bIncremental, IFX_Pause* pPause); - int32_t WriteIndirectObj(const CPDF_Object* pObj); - int32_t WriteDirectObj(FX_DWORD objnum, - const CPDF_Object* pObj, - FX_BOOL bEncrypt = TRUE); - int32_t WriteIndirectObjectToStream(const CPDF_Object* pObj); - int32_t WriteIndirectObj(FX_DWORD objnum, const CPDF_Object* pObj); - int32_t WriteIndirectObjectToStream(FX_DWORD objnum, - const uint8_t* pBuffer, - FX_DWORD dwSize); - int32_t AppendObjectNumberToXRef(FX_DWORD objnum); - void InitID(FX_BOOL bDefault = TRUE); - int32_t WriteStream(const CPDF_Object* pStream, - FX_DWORD objnum, - IPDF_CryptoHandler* pCrypto); - - int32_t m_iStage; - FX_DWORD m_dwFlags; - FX_POSITION m_Pos; - FX_FILESIZE m_XrefStart; - CFX_FileSizeListArray m_ObjectOffset; - CFX_DWordArray m_NewObjNumArray; - CPDF_Array* m_pIDArray; - int32_t m_FileVersion; - - friend class CPDF_ObjectStream; - friend class CPDF_XRefStream; -}; - -#endif // CORE_INCLUDE_FPDFAPI_FPDF_SERIAL_H_ diff --git a/core/include/fpdfapi/ipdf_crypto_handler.h b/core/include/fpdfapi/ipdf_crypto_handler.h deleted file mode 100644 index 6a09a02278..0000000000 --- a/core/include/fpdfapi/ipdf_crypto_handler.h +++ /dev/null @@ -1,45 +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_INCLUDE_FPDFAPI_IPDF_CRYPTO_HANDLER_H_ -#define CORE_INCLUDE_FPDFAPI_IPDF_CRYPTO_HANDLER_H_ - -#include "core/include/fxcrt/fx_basic.h" - -class CPDF_Dictionary; -class IPDF_SecurityHandler; - -class IPDF_CryptoHandler { - public: - virtual ~IPDF_CryptoHandler(); - - virtual FX_BOOL Init(CPDF_Dictionary* pEncryptDict, - IPDF_SecurityHandler* pSecurityHandler) = 0; - - virtual FX_DWORD DecryptGetSize(FX_DWORD src_size) = 0; - virtual void* DecryptStart(FX_DWORD objnum, FX_DWORD gennum) = 0; - virtual FX_BOOL DecryptStream(void* context, - const uint8_t* src_buf, - FX_DWORD src_size, - CFX_BinaryBuf& dest_buf) = 0; - - virtual FX_BOOL DecryptFinish(void* context, CFX_BinaryBuf& dest_buf) = 0; - virtual FX_DWORD EncryptGetSize(FX_DWORD objnum, - FX_DWORD version, - const uint8_t* src_buf, - FX_DWORD src_size) = 0; - - virtual FX_BOOL EncryptContent(FX_DWORD objnum, - FX_DWORD version, - const uint8_t* src_buf, - FX_DWORD src_size, - uint8_t* dest_buf, - FX_DWORD& dest_size) = 0; - - void Decrypt(FX_DWORD objnum, FX_DWORD version, CFX_ByteString& str); -}; - -#endif // CORE_INCLUDE_FPDFAPI_IPDF_CRYPTO_HANDLER_H_ diff --git a/core/include/fpdfapi/ipdf_data_avail.h b/core/include/fpdfapi/ipdf_data_avail.h deleted file mode 100644 index e2b22eaf2a..0000000000 --- a/core/include/fpdfapi/ipdf_data_avail.h +++ /dev/null @@ -1,80 +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_INCLUDE_FPDFAPI_IPDF_DATA_AVAIL_H_ -#define CORE_INCLUDE_FPDFAPI_IPDF_DATA_AVAIL_H_ - -#include "core/include/fxcrt/fx_stream.h" -#include "core/include/fxcrt/fx_system.h" - -class CPDF_Document; -class CPDF_Object; - -class IPDF_DataAvail { - public: - // Must match PDF_DATA_* definitions in public/fpdf_dataavail.h, but cannot - // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts - // to make sure the two sets of values match. - enum DocAvailStatus { - DataError = -1, // PDF_DATA_ERROR - DataNotAvailable = 0, // PDF_DATA_NOTAVAIL - DataAvailable = 1, // PDF_DATA_AVAIL - }; - - // Must match PDF_*LINEAR* definitions in public/fpdf_dataavail.h, but cannot - // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts - // to make sure the two sets of values match. - enum DocLinearizationStatus { - LinearizationUnknown = -1, // PDF_LINEARIZATION_UNKNOWN - NotLinearized = 0, // PDF_NOT_LINEARIZED - Linearized = 1, // PDF_LINEARIZED - }; - - // Must match PDF_FORM_* definitions in public/fpdf_dataavail.h, but cannot - // #include that header. fpdfsdk/fpdf_dataavail.cpp has static_asserts - // to make sure the two sets of values match. - enum DocFormStatus { - FormError = -1, // PDF_FORM_ERROR - FormNotAvailable = 0, // PDF_FORM_NOTAVAIL - FormAvailable = 1, // PDF_FORM_AVAIL - FormNotExist = 2, // PDF_FORM_NOTEXIST - }; - - class FileAvail { - public: - virtual ~FileAvail(); - virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, FX_DWORD size) = 0; - }; - - class DownloadHints { - public: - virtual ~DownloadHints(); - virtual void AddSegment(FX_FILESIZE offset, FX_DWORD size) = 0; - }; - - static IPDF_DataAvail* Create(FileAvail* pFileAvail, IFX_FileRead* pFileRead); - virtual ~IPDF_DataAvail(); - - FileAvail* GetFileAvail() const { return m_pFileAvail; } - IFX_FileRead* GetFileRead() const { return m_pFileRead; } - - virtual DocAvailStatus IsDocAvail(DownloadHints* pHints) = 0; - virtual void SetDocument(CPDF_Document* pDoc) = 0; - virtual DocAvailStatus IsPageAvail(int iPage, DownloadHints* pHints) = 0; - virtual FX_BOOL IsLinearized() = 0; - virtual DocFormStatus IsFormAvail(DownloadHints* pHints) = 0; - virtual DocLinearizationStatus IsLinearizedPDF() = 0; - virtual void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, - FX_DWORD* pSize) = 0; - - protected: - IPDF_DataAvail(FileAvail* pFileAvail, IFX_FileRead* pFileRead); - - FileAvail* m_pFileAvail; - IFX_FileRead* m_pFileRead; -}; - -#endif // CORE_INCLUDE_FPDFAPI_IPDF_DATA_AVAIL_H_ diff --git a/core/include/fpdfapi/ipdf_security_handler.h b/core/include/fpdfapi/ipdf_security_handler.h deleted file mode 100644 index 4dce7c6963..0000000000 --- a/core/include/fpdfapi/ipdf_security_handler.h +++ /dev/null @@ -1,36 +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_INCLUDE_FPDFAPI_IPDF_SECURITY_HANDLER_H_ -#define CORE_INCLUDE_FPDFAPI_IPDF_SECURITY_HANDLER_H_ - -#include "core/include/fxcrt/fx_system.h" - -class CPDF_Parser; -class CPDF_Dictionary; -class IPDF_CryptoHandler; - -#define FXCIPHER_NONE 0 -#define FXCIPHER_RC4 1 -#define FXCIPHER_AES 2 -#define FXCIPHER_AES2 3 - -class IPDF_SecurityHandler { - public: - virtual ~IPDF_SecurityHandler(); - virtual FX_BOOL OnInit(CPDF_Parser* pParser, - CPDF_Dictionary* pEncryptDict) = 0; - - virtual FX_DWORD GetPermissions() = 0; - virtual FX_BOOL GetCryptInfo(int& cipher, - const uint8_t*& buffer, - int& keylen) = 0; - - virtual FX_BOOL IsMetadataEncrypted() = 0; - virtual IPDF_CryptoHandler* CreateCryptoHandler() = 0; -}; - -#endif // CORE_INCLUDE_FPDFAPI_IPDF_SECURITY_HANDLER_H_ diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 60a0939211..28d62effd4 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -11,9 +11,10 @@ #include #include -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/fpdf_parser_decode.h" -#include "core/include/fpdfapi/fpdf_render.h" +#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/include/fxge/fx_dib.h" class CFDF_Document; class CFieldTree; @@ -27,6 +28,7 @@ class CPDF_Bookmark; class CPDF_BookmarkTree; class CPDF_DefaultAppearance; class CPDF_Dest; +class CPDF_Document; class CPDF_DocJSActions; class CPDF_FileSpec; class CPDF_FormControl; @@ -38,9 +40,13 @@ 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: diff --git a/fpdfsdk/DEPS b/fpdfsdk/DEPS index ed111888c8..a351ff794f 100644 --- a/fpdfsdk/DEPS +++ b/fpdfsdk/DEPS @@ -1,6 +1,10 @@ include_rules = [ '+core/include', '+core/fpdftext/include', + '+core/fpdfapi/include', + '+core/fpdfapi/fpdf_edit/include', + '+core/fpdfapi/fpdf_parser/include', + '+core/fpdfapi/fpdf_render/include', '+javascript/IJavaScript.h', '+public', '+v8', diff --git a/fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp b/fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp index 35c2be6319..44e9cdd89e 100644 --- a/fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp +++ b/fpdfsdk/formfiller/FFL_CBA_Fontmap.cpp @@ -6,8 +6,8 @@ #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_simple_parser.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" #include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_baseannot.h" diff --git a/fpdfsdk/formfiller/FFL_FormFiller.cpp b/fpdfsdk/formfiller/FFL_FormFiller.cpp index e596ba08ba..fbf0fd2ec6 100644 --- a/fpdfsdk/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/formfiller/FFL_FormFiller.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_CBA_Fontmap.h" #include "fpdfsdk/include/fsdk_common.h" #include "fpdfsdk/include/fsdk_mgr.h" diff --git a/fpdfsdk/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/formfiller/FFL_IFormFiller.cpp index 75f18e7c73..4c5537e8f8 100644 --- a/fpdfsdk/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/formfiller/FFL_IFormFiller.cpp @@ -6,7 +6,8 @@ #include "fpdfsdk/include/formfiller/FFL_IFormFiller.h" -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_CheckBox.h" #include "fpdfsdk/include/formfiller/FFL_ComboBox.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp index 0a1ebefaef..6cef5fd37b 100644 --- a/fpdfsdk/fpdf_dataavail.cpp +++ b/fpdfsdk/fpdf_dataavail.cpp @@ -6,8 +6,8 @@ #include "public/fpdf_dataavail.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/ipdf_data_avail.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h" #include "fpdfsdk/include/fsdk_define.h" #include "public/fpdf_formfill.h" diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp index bf35cecd9c..ed087199e2 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -6,8 +6,9 @@ #include "public/fpdf_ext.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" +#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/include/fxcrt/fx_xml.h" #include "fpdfsdk/include/fsdk_define.h" diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index cca63d6b76..bb982ca78b 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -8,9 +8,10 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_number.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/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_define.h" typedef CFX_ArrayTemplate CPDF_ObjectArray; diff --git a/fpdfsdk/fpdf_progressive.cpp b/fpdfsdk/fpdf_progressive.cpp index b6fd8e071e..f4af9c4699 100644 --- a/fpdfsdk/fpdf_progressive.cpp +++ b/fpdfsdk/fpdf_progressive.cpp @@ -6,6 +6,7 @@ #include "public/fpdf_progressive.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_rendercontext.h" #include "public/fpdfview.h" diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index f3c2576dd5..033e49fdf7 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -6,10 +6,11 @@ #include "public/fpdf_transformpage.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.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_reference.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_define.h" namespace { diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp index 9fa9f4fcab..cb05df19e9 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -8,8 +8,9 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/include/fpdfapi/fpdf_page.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 04f885264e..2c10281fbe 100644 --- a/fpdfsdk/fpdfdoc_unittest.cpp +++ b/fpdfsdk/fpdfdoc_unittest.cpp @@ -7,12 +7,12 @@ #include #include -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#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 "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp index de5c72f659..194f5e0c54 100644 --- a/fpdfsdk/fpdfeditimg.cpp +++ b/fpdfsdk/fpdfeditimg.cpp @@ -6,6 +6,7 @@ #include "public/fpdf_edit.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "fpdfsdk/include/fsdk_define.h" DLLEXPORT FPDF_PAGEOBJECT STDCALL diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp index 992f08eb8b..e10f3825af 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -6,10 +6,11 @@ #include "public/fpdf_edit.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_string.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_string.h" +#include "core/include/fpdfapi/fpdf_page.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 b33e303db0..fea66a05c5 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -9,7 +9,9 @@ #include #include -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "public/fpdfview.h" diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp index 4253cc5fd9..e15b086f88 100644 --- a/fpdfsdk/fpdfppo.cpp +++ b/fpdfsdk/fpdfppo.cpp @@ -10,12 +10,12 @@ #include #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_name.h" -#include "core/include/fpdfapi/cpdf_number.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_string.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_name.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_number.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" #include "fpdfsdk/include/fsdk_define.h" #include "third_party/base/stl_util.h" diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp index 81defbf0a7..c93b23b69f 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -8,11 +8,11 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_reference.h" -#include "core/include/fpdfapi/cpdf_string.h" -#include "core/include/fpdfapi/fpdf_serial.h" +#include "core/fpdfapi/fpdf_edit/include/cpdf_creator.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_reference.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_string.h" #include "core/include/fxcrt/fx_ext.h" #include "fpdfsdk/include/fsdk_define.h" #include "public/fpdf_edit.h" diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 4630ac1e7e..acad659495 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -8,8 +8,10 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" #include "core/include/fxcodec/fx_codec.h" #include "core/include/fxcrt/fx_safe_types.h" #include "fpdfsdk/include/fsdk_define.h" @@ -21,7 +23,6 @@ #include "third_party/base/numerics/safe_conversions_impl.h" #ifdef PDF_ENABLE_XFA -#include "core/include/fpdfapi/fpdf_module.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index ede9b7e892..144e5dc811 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -4,9 +4,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_string.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_string.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_app.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp index 0210ac1c08..120d1ba24d 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_page.cpp @@ -4,9 +4,11 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_document.h" -#include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_page.h" + +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/include/fpdfapi/fpdf_page.h" +#include "fpdfsdk/include/fpdfxfa/fpdfxfa_doc.h" #include "fpdfsdk/include/fpdfxfa/fpdfxfa_util.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp index 0b3ee54ed5..1977ce5cee 100644 --- a/fpdfsdk/fsdk_actionhandler.cpp +++ b/fpdfsdk/fsdk_actionhandler.cpp @@ -8,7 +8,7 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/include/javascript/IJavaScript.h" diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp index f2456b0fb4..0b6f2e1889 100644 --- a/fpdfsdk/fsdk_annothandler.cpp +++ b/fpdfsdk/fsdk_annothandler.cpp @@ -9,7 +9,8 @@ #include #include -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_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 606f02c2ed..e50a9f11b2 100644 --- a/fpdfsdk/fsdk_baseannot.cpp +++ b/fpdfsdk/fsdk_baseannot.cpp @@ -6,9 +6,9 @@ #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/cpdf_number.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/include/fxcrt/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 6a01813494..4bb5374ac9 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -10,9 +10,10 @@ #include #include -#include "core/include/fpdfapi/cfdf_document.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.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/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" #include "fpdfsdk/include/fsdk_actionhandler.h" #include "fpdfsdk/include/fsdk_baseannot.h" diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp index 519aa06945..e8654d39eb 100644 --- a/fpdfsdk/fsdk_mgr.cpp +++ b/fpdfsdk/fsdk_mgr.cpp @@ -9,8 +9,9 @@ #include #include -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/formfiller/FFL_FormFiller.h" #include "fpdfsdk/include/fsdk_define.h" #include "fpdfsdk/include/javascript/IJavaScript.h" diff --git a/fpdfsdk/fsdk_rendercontext.cpp b/fpdfsdk/fsdk_rendercontext.cpp index c91772d41c..9232d83edd 100644 --- a/fpdfsdk/fsdk_rendercontext.cpp +++ b/fpdfsdk/fsdk_rendercontext.cpp @@ -6,6 +6,8 @@ #include "fpdfsdk/include/fsdk_rendercontext.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" + void CRenderContext::Clear() { m_pDevice = NULL; m_pContext = NULL; diff --git a/fpdfsdk/fxedit/fxet_ap.cpp b/fpdfsdk/fxedit/fxet_ap.cpp index 22f200d753..6f064b2ce8 100644 --- a/fpdfsdk/fxedit/fxet_ap.cpp +++ b/fpdfsdk/fxedit/fxet_ap.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/fpdf_parser_decode.h" +#include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/include/fpdfapi/fpdf_resource.h" #include "fpdfsdk/include/fxedit/fx_edit.h" #include "fpdfsdk/include/fxedit/fxet_edit.h" diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp index 6d091b7c19..660f4a475f 100644 --- a/fpdfsdk/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp @@ -4,8 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h" +#include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "core/include/fpdfapi/fpdf_render.h" #include "fpdfsdk/include/fx_systemhandler.h" #include "fpdfsdk/include/fxedit/fx_edit.h" #include "fpdfsdk/include/fxedit/fxet_edit.h" diff --git a/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h b/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h index 5f11d5e5aa..19d36e4494 100644 --- a/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h +++ b/fpdfsdk/include/fpdfxfa/fpdfxfa_page.h @@ -7,7 +7,14 @@ #ifndef FPDFSDK_INCLUDE_FPDFXFA_FPDFXFA_PAGE_H_ #define FPDFSDK_INCLUDE_FPDFXFA_FPDFXFA_PAGE_H_ +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" +#include "core/include/fxcrt/fx_coordinates.h" +#include "core/include/fxcrt/fx_system.h" + +class CPDFXFA_Document; class CPDF_Page; +class IXFA_PageView; class CPDFXFA_Page { public: diff --git a/fpdfsdk/include/fsdk_define.h b/fpdfsdk/include/fsdk_define.h index a40442c7d5..7791fdf0fd 100644 --- a/fpdfsdk/include/fsdk_define.h +++ b/fpdfsdk/include/fsdk_define.h @@ -7,10 +7,8 @@ #ifndef FPDFSDK_INCLUDE_FSDK_DEFINE_H_ #define FPDFSDK_INCLUDE_FSDK_DEFINE_H_ -#include "core/include/fpdfapi/cpdf_parser.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" #include "core/include/fpdfapi/fpdf_pageobj.h" -#include "core/include/fpdfapi/fpdf_render.h" #include "core/include/fpdfdoc/fpdf_doc.h" #include "core/include/fpdfdoc/fpdf_vt.h" #include "core/include/fxge/fx_ge.h" diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h index 0073377893..88b539f7e7 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -11,7 +11,7 @@ #include #include -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "fpdfsdk/include/fsdk_actionhandler.h" #include "fpdfsdk/include/fsdk_annothandler.h" #include "fpdfsdk/include/fsdk_baseannot.h" diff --git a/fpdfsdk/include/fsdk_rendercontext.h b/fpdfsdk/include/fsdk_rendercontext.h index 4a542902f9..f984a64583 100644 --- a/fpdfsdk/include/fsdk_rendercontext.h +++ b/fpdfsdk/include/fsdk_rendercontext.h @@ -7,6 +7,7 @@ #ifndef FPDFSDK_INCLUDE_FSDK_RENDERCONTEXT_H_ #define FPDFSDK_INCLUDE_FSDK_RENDERCONTEXT_H_ +#include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h" #include "fpdfsdk/include/fsdk_define.h" #include "public/fpdf_progressive.h" diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 032ca5467e..241e03818e 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -8,7 +8,8 @@ #include -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/include/javascript/IJavaScript.h" #include "fpdfsdk/javascript/Field.h" diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index abe18f4e36..1ccd756fad 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -11,7 +11,8 @@ #include #include -#include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. +#include "core/include/fpdfapi/fpdf_page.h" +#include "fpdfsdk/include/fsdk_mgr.h" #include "fpdfsdk/include/javascript/IJavaScript.h" #include "fpdfsdk/javascript/Document.h" #include "fpdfsdk/javascript/Icon.h" diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index 320b2bf62f..94a9c7e588 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -5,6 +5,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" + +#include "core/include/fxge/fx_ge.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp index 6edd6bdd85..1d98a51d26 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/include/pdfwindow/PWL_ComboBox.h" +#include "core/include/fxge/fx_ge.h" #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" #include "fpdfsdk/include/pdfwindow/PWL_ListBox.h" diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index c4a5bf03fd..c2b3864074 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -8,8 +8,10 @@ #include +#include "core/include/fpdfapi/fpdf_page.h" #include "core/include/fxcrt/fx_safe_types.h" #include "core/include/fxcrt/fx_xml.h" +#include "core/include/fxge/fx_ge.h" #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" #include "fpdfsdk/include/pdfwindow/PWL_EditCtrl.h" #include "fpdfsdk/include/pdfwindow/PWL_FontMap.h" diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp index 0a70357efd..2b9f17cf59 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -6,8 +6,9 @@ #include "fpdfsdk/include/pdfwindow/PWL_FontMap.h" -#include "core/include/fpdfapi/cpdf_document.h" -#include "core/include/fpdfapi/fpdf_module.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fpdfapi/include/cpdf_modulemgr.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" namespace { diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp index 2a33b96cf9..6fa65cf1e5 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp @@ -4,8 +4,10 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/include/fpdfapi/cpdf_array.h" #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" + +#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" +#include "core/include/fpdfapi/fpdf_page.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" diff --git a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp index 7c2c1f4d17..f9482878b9 100644 --- a/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListCtrl.cpp @@ -4,6 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include "core/include/fxge/fx_ge.h" #include "fpdfsdk/include/pdfwindow/PWL_ListCtrl.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" diff --git a/fpdfsdk/pdfwindow/PWL_Note.cpp b/fpdfsdk/pdfwindow/PWL_Note.cpp index 7ba6f6ad66..ec7c1c9cde 100644 --- a/fpdfsdk/pdfwindow/PWL_Note.cpp +++ b/fpdfsdk/pdfwindow/PWL_Note.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/include/pdfwindow/PWL_Note.h" +#include "core/include/fxge/fx_ge.h" #include "fpdfsdk/include/pdfwindow/PWL_Button.h" #include "fpdfsdk/include/pdfwindow/PWL_Caret.h" #include "fpdfsdk/include/pdfwindow/PWL_Edit.h" diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp index 03bf3238fa..8b7cfd5b4c 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -5,6 +5,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "fpdfsdk/include/pdfwindow/PWL_ScrollBar.h" + +#include "core/include/fxge/fx_ge.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" diff --git a/fpdfsdk/pdfwindow/PWL_Signature.cpp b/fpdfsdk/pdfwindow/PWL_Signature.cpp index ffb4461878..a928e4eeb5 100644 --- a/fpdfsdk/pdfwindow/PWL_Signature.cpp +++ b/fpdfsdk/pdfwindow/PWL_Signature.cpp @@ -6,6 +6,7 @@ #include "fpdfsdk/include/pdfwindow/PWL_Signature.h" +#include "core/include/fxge/fx_ge.h" #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" #include "fpdfsdk/include/pdfwindow/PWL_Label.h" #include "fpdfsdk/include/pdfwindow/PWL_Utils.h" diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index 926ab3f0b7..23bddcdf1e 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -8,6 +8,7 @@ #include +#include "core/include/fxge/fx_ge.h" #include "fpdfsdk/include/pdfwindow/PWL_Icon.h" #include "fpdfsdk/include/pdfwindow/PWL_Wnd.h" diff --git a/pdfium.gyp b/pdfium.gyp index ab2d4cadda..f440b9e018 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -251,32 +251,6 @@ 'target_name': 'fpdfapi', 'type': 'static_library', 'sources': [ - 'core/include/fpdfapi/cfdf_document.h', - 'core/include/fpdfapi/cpdf_array.h', - 'core/include/fpdfapi/cpdf_boolean.h', - 'core/include/fpdfapi/cpdf_dictionary.h', - 'core/include/fpdfapi/cpdf_document.h', - 'core/include/fpdfapi/cpdf_indirect_object_holder.h', - 'core/include/fpdfapi/cpdf_name.h', - 'core/include/fpdfapi/cpdf_null.h', - 'core/include/fpdfapi/cpdf_number.h', - 'core/include/fpdfapi/cpdf_object.h', - 'core/include/fpdfapi/cpdf_parser.h', - 'core/include/fpdfapi/cpdf_reference.h', - 'core/include/fpdfapi/cpdf_simple_parser.h', - 'core/include/fpdfapi/cpdf_stream.h', - 'core/include/fpdfapi/cpdf_stream_acc.h', - 'core/include/fpdfapi/cpdf_string.h', - 'core/include/fpdfapi/fpdf_module.h', - 'core/include/fpdfapi/fpdf_page.h', - 'core/include/fpdfapi/fpdf_pageobj.h', - 'core/include/fpdfapi/fpdf_parser_decode.h', - 'core/include/fpdfapi/fpdf_render.h', - 'core/include/fpdfapi/fpdf_resource.h', - 'core/include/fpdfapi/fpdf_serial.h', - 'core/include/fpdfapi/ipdf_crypto_handler.h', - 'core/include/fpdfapi/ipdf_data_avail.h', - 'core/include/fpdfapi/ipdf_security_handler.h', 'core/fpdfapi/fpdf_basic_module.cpp', 'core/fpdfapi/fpdf_cmaps/cmap_int.h', 'core/fpdfapi/fpdf_cmaps/CNS1/Adobe-CNS1-UCS2_5.cpp', @@ -346,6 +320,7 @@ 'core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp', 'core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp', 'core/fpdfapi/fpdf_edit/fpdf_edit_image.cpp', + 'core/fpdfapi/fpdf_edit/include/cpdf_creator.h', 'core/fpdfapi/fpdf_font/font_int.h', 'core/fpdfapi/fpdf_font/fpdf_font.cpp', 'core/fpdfapi/fpdf_font/fpdf_font_charset.cpp', @@ -366,6 +341,7 @@ 'core/fpdfapi/fpdf_parser/cfdf_document.cpp', 'core/fpdfapi/fpdf_parser/cpdf_array.cpp', 'core/fpdfapi/fpdf_parser/cpdf_boolean.cpp', + 'core/fpdfapi/fpdf_parser/cpdf_boolean.h', 'core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp', 'core/fpdfapi/fpdf_parser/cpdf_data_avail.h', 'core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp', @@ -375,6 +351,7 @@ 'core/fpdfapi/fpdf_parser/cpdf_indirect_object_holder.cpp', 'core/fpdfapi/fpdf_parser/cpdf_name.cpp', 'core/fpdfapi/fpdf_parser/cpdf_null.cpp', + 'core/fpdfapi/fpdf_parser/cpdf_null.h', 'core/fpdfapi/fpdf_parser/cpdf_number.cpp', 'core/fpdfapi/fpdf_parser/cpdf_object.cpp', 'core/fpdfapi/fpdf_parser/cpdf_parser.cpp', @@ -392,13 +369,44 @@ 'core/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp', 'core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp', 'core/fpdfapi/fpdf_parser/fpdf_parser_utility.h', + 'core/fpdfapi/fpdf_parser/include/cfdf_document.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_array.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_document.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_indirect_object_holder.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_name.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_number.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_object.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_parser.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_reference.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_stream.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h', + 'core/fpdfapi/fpdf_parser/include/cpdf_string.h', + 'core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h', + 'core/fpdfapi/fpdf_parser/include/ipdf_data_avail.h', + 'core/fpdfapi/fpdf_parser/ipdf_occontext.h', + 'core/fpdfapi/fpdf_parser/ipdf_occontext.cpp', + 'core/fpdfapi/fpdf_parser/ipdf_crypto_handler.h', + 'core/fpdfapi/fpdf_parser/ipdf_security_handler.h', + 'core/fpdfapi/fpdf_render/cpdf_pagerendercache.h', 'core/fpdfapi/fpdf_render/fpdf_render.cpp', 'core/fpdfapi/fpdf_render/fpdf_render_cache.cpp', 'core/fpdfapi/fpdf_render/fpdf_render_image.cpp', 'core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp', 'core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp', 'core/fpdfapi/fpdf_render/fpdf_render_text.cpp', + 'core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h', + 'core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h', + 'core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h', + 'core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h', 'core/fpdfapi/fpdf_render/render_int.h', + 'core/fpdfapi/include/cpdf_modulemgr.h', + 'core/fpdfapi/ipdf_rendermodule.h', + 'core/fpdfapi/ipdf_pagemodule.h', + 'core/include/fpdfapi/fpdf_page.h', + 'core/include/fpdfapi/fpdf_pageobj.h', + 'core/include/fpdfapi/fpdf_resource.h', ], }, { diff --git a/samples/DEPS b/samples/DEPS index e77312f4bb..f38daab263 100644 --- a/samples/DEPS +++ b/samples/DEPS @@ -1,6 +1,7 @@ include_rules = [ '+public', '+third_party/libpng16', + '+third_party/skia/include', '+third_party/zlib_v128', '+v8', ] diff --git a/xfa/fxfa/app/DEPS b/xfa/fxfa/app/DEPS index a0d113f3cf..d92f3de033 100644 --- a/xfa/fxfa/app/DEPS +++ b/xfa/fxfa/app/DEPS @@ -1,3 +1,4 @@ include_rules = [ '+core/fdrm/crypto/include', + '+core/fpdfapi/fpdf_parser/include', ] diff --git a/xfa/fxfa/app/xfa_ffapp.h b/xfa/fxfa/app/xfa_ffapp.h index 675c6ba879..fe3358ace7 100644 --- a/xfa/fxfa/app/xfa_ffapp.h +++ b/xfa/fxfa/app/xfa_ffapp.h @@ -7,8 +7,8 @@ #ifndef XFA_FXFA_APP_XFA_FFAPP_H_ #define XFA_FXFA_APP_XFA_FFAPP_H_ -#include "core/include/fpdfapi/cpdf_stream.h" -#include "core/include/fpdfapi/cpdf_stream_acc.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" #include "xfa/fgas/font/fgas_font.h" #include "xfa/include/fwl/adapter/fwl_adapternative.h" #include "xfa/include/fwl/adapter/fwl_sdadapterimp.h" diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index e33dd4fa47..041b41ce5d 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -6,8 +6,8 @@ #include "xfa/fxfa/app/xfa_ffdoc.h" -#include "core/include/fpdfapi/cpdf_array.h" -#include "core/include/fpdfapi/cpdf_document.h" +#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/include/fxcrt/fx_ext.h" #include "xfa/fgas/crt/fgas_algorithm.h" diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index dda8f5b5c3..5fc3ce97aa 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -8,8 +8,8 @@ #include -#include "core/include/fpdfapi/cpdf_dictionary.h" -#include "core/include/fpdfapi/cpdf_document.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" +#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/include/fpdfapi/fpdf_resource.h" #include "xfa/fxfa/app/xfa_ffapp.h" #include "xfa/fxfa/app/xfa_ffdoc.h" -- cgit v1.2.3