summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-14 16:34:46 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-14 16:34:46 -0700
commitbb51c4fb6bc6095984c303c95e5336f83e66bc67 (patch)
treeaa95c7948b60a9935c0d83e449d2aef5658e1ff2 /core
parenteca866c64ec0319d4723798290a3155957fa733e (diff)
downloadpdfium-bb51c4fb6bc6095984c303c95e5336f83e66bc67.tar.xz
Introduce CPDF_Document::FromFPDFDocument().
This will be used to abstract one major difference between master and XFA, namely that the CPDF_Document is not a direct cast in XFA. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1395493007 .
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/fpdf_parser.h3
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp5
2 files changed, 8 insertions, 0 deletions
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index 04c7d90f6f..b58cf14974 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -7,6 +7,7 @@
#ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
#define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
+#include "../../../public/fpdfview.h"
#include "../fxcrt/fx_system.h"
#include "fpdf_objects.h"
@@ -56,6 +57,8 @@ extern const FX_WORD PDFDocEncoding[256];
class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjects {
public:
+ static CPDF_Document* FromFPDFDocument(FPDF_DOCUMENT document);
+
CPDF_Document();
explicit CPDF_Document(CPDF_Parser* pParser);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index 5b78013694..b93cadd266 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -7,6 +7,11 @@
#include "../../../include/fpdfapi/fpdf_parser.h"
#include "../../../include/fpdfapi/fpdf_module.h"
+// static
+CPDF_Document* CPDF_Document::FromFPDFDocument(FPDF_DOCUMENT document) {
+ return static_cast<CPDF_Document*>(document);
+}
+
CPDF_Document::CPDF_Document(CPDF_Parser* pParser)
: CPDF_IndirectObjects(pParser) {
ASSERT(pParser != NULL);