Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(192)

Side by Side Diff: fpdfsdk/fpdfxfa/fpdfxfa_page.cpp

Issue 2386273004: Add ptr_util.h from base until std::make_unique<> available (Closed)
Patch Set: 2016 Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/fpdfxfa/fpdfxfa_app.cpp ('k') | fpdfsdk/fxedit/fxet_edit.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "fpdfsdk/fpdfxfa/fpdfxfa_page.h" 7 #include "fpdfsdk/fpdfxfa/fpdfxfa_page.h"
8 8
9 #include "core/fpdfapi/fpdf_page/cpdf_page.h" 9 #include "core/fpdfapi/fpdf_page/cpdf_page.h"
10 #include "core/fpdfapi/fpdf_parser/cpdf_document.h" 10 #include "core/fpdfapi/fpdf_parser/cpdf_document.h"
11 #include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h" 11 #include "fpdfsdk/fpdfxfa/fpdfxfa_doc.h"
12 #include "fpdfsdk/fpdfxfa/fpdfxfa_util.h" 12 #include "fpdfsdk/fpdfxfa/fpdfxfa_util.h"
13 #include "fpdfsdk/fsdk_define.h" 13 #include "fpdfsdk/fsdk_define.h"
14 #include "public/fpdf_formfill.h" 14 #include "public/fpdf_formfill.h"
15 #include "third_party/base/ptr_util.h"
15 #include "xfa/fxfa/xfa_ffdocview.h" 16 #include "xfa/fxfa/xfa_ffdocview.h"
16 #include "xfa/fxfa/xfa_ffpageview.h" 17 #include "xfa/fxfa/xfa_ffpageview.h"
17 18
18 CPDFXFA_Page::CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index) 19 CPDFXFA_Page::CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index)
19 : m_pXFAPageView(nullptr), 20 : m_pXFAPageView(nullptr),
20 m_pDocument(pDoc), 21 m_pDocument(pDoc),
21 m_iPageIndex(page_index), 22 m_iPageIndex(page_index),
22 m_iRef(1) {} 23 m_iRef(1) {}
23 24
24 CPDFXFA_Page::~CPDFXFA_Page() { 25 CPDFXFA_Page::~CPDFXFA_Page() {
25 if (m_pDocument) 26 if (m_pDocument)
26 m_pDocument->RemovePage(this); 27 m_pDocument->RemovePage(this);
27 } 28 }
28 29
29 FX_BOOL CPDFXFA_Page::LoadPDFPage() { 30 FX_BOOL CPDFXFA_Page::LoadPDFPage() {
30 if (!m_pDocument) 31 if (!m_pDocument)
31 return FALSE; 32 return FALSE;
32 33
33 CPDF_Document* pPDFDoc = m_pDocument->GetPDFDoc(); 34 CPDF_Document* pPDFDoc = m_pDocument->GetPDFDoc();
34 if (!pPDFDoc) 35 if (!pPDFDoc)
35 return FALSE; 36 return FALSE;
36 37
37 CPDF_Dictionary* pDict = pPDFDoc->GetPage(m_iPageIndex); 38 CPDF_Dictionary* pDict = pPDFDoc->GetPage(m_iPageIndex);
38 if (!pDict) 39 if (!pDict)
39 return FALSE; 40 return FALSE;
40 41
41 if (!m_pPDFPage || m_pPDFPage->m_pFormDict != pDict) { 42 if (!m_pPDFPage || m_pPDFPage->m_pFormDict != pDict) {
42 m_pPDFPage = WrapUnique(new CPDF_Page(pPDFDoc, pDict, true)); 43 m_pPDFPage = pdfium::MakeUnique<CPDF_Page>(pPDFDoc, pDict, true);
43 m_pPDFPage->ParseContent(); 44 m_pPDFPage->ParseContent();
44 } 45 }
45 return TRUE; 46 return TRUE;
46 } 47 }
47 48
48 FX_BOOL CPDFXFA_Page::LoadXFAPageView() { 49 FX_BOOL CPDFXFA_Page::LoadXFAPageView() {
49 if (!m_pDocument) 50 if (!m_pDocument)
50 return FALSE; 51 return FALSE;
51 52
52 CXFA_FFDoc* pXFADoc = m_pDocument->GetXFADoc(); 53 CXFA_FFDoc* pXFADoc = m_pDocument->GetXFADoc();
(...skipping 28 matching lines...) Expand all
81 default: 82 default:
82 return FALSE; 83 return FALSE;
83 } 84 }
84 } 85 }
85 86
86 FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) { 87 FX_BOOL CPDFXFA_Page::LoadPDFPage(CPDF_Dictionary* pageDict) {
87 if (!m_pDocument || m_iPageIndex < 0 || !pageDict) 88 if (!m_pDocument || m_iPageIndex < 0 || !pageDict)
88 return FALSE; 89 return FALSE;
89 90
90 m_pPDFPage = 91 m_pPDFPage =
91 WrapUnique(new CPDF_Page(m_pDocument->GetPDFDoc(), pageDict, true)); 92 pdfium::MakeUnique<CPDF_Page>(m_pDocument->GetPDFDoc(), pageDict, true);
92 m_pPDFPage->ParseContent(); 93 m_pPDFPage->ParseContent();
93 return TRUE; 94 return TRUE;
94 } 95 }
95 96
96 FX_FLOAT CPDFXFA_Page::GetPageWidth() const { 97 FX_FLOAT CPDFXFA_Page::GetPageWidth() const {
97 if (!m_pPDFPage && !m_pXFAPageView) 98 if (!m_pPDFPage && !m_pXFAPageView)
98 return 0.0f; 99 return 0.0f;
99 100
100 int nDocType = m_pDocument->GetDocType(); 101 int nDocType = m_pDocument->GetDocType();
101 switch (nDocType) { 102 switch (nDocType) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 case DOCTYPE_PDF: 215 case DOCTYPE_PDF:
215 case DOCTYPE_STATIC_XFA: { 216 case DOCTYPE_STATIC_XFA: {
216 if (m_pPDFPage) { 217 if (m_pPDFPage) {
217 m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate); 218 m_pPDFPage->GetDisplayMatrix(matrix, xPos, yPos, xSize, ySize, iRotate);
218 } 219 }
219 } break; 220 } break;
220 default: 221 default:
221 return; 222 return;
222 } 223 }
223 } 224 }
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/fpdfxfa_app.cpp ('k') | fpdfsdk/fxedit/fxet_edit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698