OLD | NEW |
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 "public/fpdf_ppo.h" | 7 #include "public/fpdf_ppo.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 int index) { | 362 int index) { |
363 CPDF_Document* pDestDoc = CPDFDocumentFromFPDFDocument(dest_doc); | 363 CPDF_Document* pDestDoc = CPDFDocumentFromFPDFDocument(dest_doc); |
364 if (!dest_doc) | 364 if (!dest_doc) |
365 return FALSE; | 365 return FALSE; |
366 | 366 |
367 CPDF_Document* pSrcDoc = CPDFDocumentFromFPDFDocument(src_doc); | 367 CPDF_Document* pSrcDoc = CPDFDocumentFromFPDFDocument(src_doc); |
368 if (!pSrcDoc) | 368 if (!pSrcDoc) |
369 return FALSE; | 369 return FALSE; |
370 | 370 |
371 std::vector<uint16_t> pageArray; | 371 std::vector<uint16_t> pageArray; |
| 372 // TODO(dsinclair): Verify this works for XFA documents. |
372 int nCount = pSrcDoc->GetPageCount(); | 373 int nCount = pSrcDoc->GetPageCount(); |
373 if (pagerange) { | 374 if (pagerange) { |
374 if (!ParserPageRangeString(pagerange, &pageArray, nCount)) | 375 if (!ParserPageRangeString(pagerange, &pageArray, nCount)) |
375 return FALSE; | 376 return FALSE; |
376 } else { | 377 } else { |
377 for (int i = 1; i <= nCount; ++i) { | 378 for (int i = 1; i <= nCount; ++i) { |
378 pageArray.push_back(i); | 379 pageArray.push_back(i); |
379 } | 380 } |
380 } | 381 } |
381 | 382 |
(...skipping 17 matching lines...) Expand all Loading... |
399 if (!pSrcDict) | 400 if (!pSrcDict) |
400 return FALSE; | 401 return FALSE; |
401 | 402 |
402 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); | 403 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); |
403 if (!pDstDict) | 404 if (!pDstDict) |
404 return FALSE; | 405 return FALSE; |
405 | 406 |
406 pDstDict->SetFor("ViewerPreferences", pSrcDict->CloneDirectObject()); | 407 pDstDict->SetFor("ViewerPreferences", pSrcDict->CloneDirectObject()); |
407 return TRUE; | 408 return TRUE; |
408 } | 409 } |
OLD | NEW |