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 "../include/fpdfppo.h" | 7 #include "../include/fpdfppo.h" |
8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 | 9 |
10 class CPDF_PageOrganizer | 10 class CPDF_PageOrganizer |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #endif | 57 #endif |
58 DInfoDict->SetAt("Producer", new CPDF_String(producerstr)); | 58 DInfoDict->SetAt("Producer", new CPDF_String(producerstr)); |
59 | 59 |
60 //Set type//////////////////////////////////////////////////////////////
// | 60 //Set type//////////////////////////////////////////////////////////////
// |
61 CFX_ByteString cbRootType = pNewRoot->GetString("Type",""); | 61 CFX_ByteString cbRootType = pNewRoot->GetString("Type",""); |
62 if( cbRootType.Equal("") ) | 62 if( cbRootType.Equal("") ) |
63 { | 63 { |
64 pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); | 64 pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); |
65 } | 65 } |
66 | 66 |
67 » CPDF_Dictionary* pNewPages = (CPDF_Dictionary*)pNewRoot->GetElement("Pag
es")->GetDirect(); | 67 » CPDF_Dictionary* pNewPages = (CPDF_Dictionary*)(pNewRoot->GetElement("Pa
ges")? pNewRoot->GetElement("Pages")->GetDirect() : NULL); |
68 if(!pNewPages) | 68 if(!pNewPages) |
69 { | 69 { |
70 pNewPages = new CPDF_Dictionary; | 70 pNewPages = new CPDF_Dictionary; |
71 FX_DWORD NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages); | 71 FX_DWORD NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages); |
72 pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPage
sON)); | 72 pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPage
sON)); |
73 } | 73 } |
74 | 74 |
75 CFX_ByteString cbPageType = pNewPages->GetString("Type",""); | 75 CFX_ByteString cbPageType = pNewPages->GetString("Type",""); |
76 if(cbPageType.Equal("")) | 76 if(cbPageType.Equal("")) |
77 { | 77 { |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 size_t dwNewObjNum = 0; | 304 size_t dwNewObjNum = 0; |
305 | 305 |
306 pMapPtrToPtr->Lookup((FX_LPVOID)dwObjnum, (FX_LPVOID&)dwNewObjNum); | 306 pMapPtrToPtr->Lookup((FX_LPVOID)dwObjnum, (FX_LPVOID&)dwNewObjNum); |
307 if(dwNewObjNum) | 307 if(dwNewObjNum) |
308 { | 308 { |
309 return (int)dwNewObjNum; | 309 return (int)dwNewObjNum; |
310 } | 310 } |
311 else | 311 else |
312 { | 312 { |
313 CPDF_Object* pClone = pRef->GetDirect()->Clone(); | 313 CPDF_Object* pClone = pRef->GetDirect()->Clone(); |
314 » » if(!pClone)» » » return 0; | 314 » » if(!pClone)» » » |
| 315 » » » return 0; |
315 | 316 |
316 if(pClone->GetType() == PDFOBJ_DICTIONARY) | 317 if(pClone->GetType() == PDFOBJ_DICTIONARY) |
317 { | 318 { |
318 CPDF_Dictionary* pDictClone = (CPDF_Dictionary*)pClone; | 319 CPDF_Dictionary* pDictClone = (CPDF_Dictionary*)pClone; |
319 if(pDictClone->KeyExist("Type")) | 320 if(pDictClone->KeyExist("Type")) |
320 { | 321 { |
321 CFX_ByteString strType = pDictClone->GetString("
Type"); | 322 CFX_ByteString strType = pDictClone->GetString("
Type"); |
322 if(!FXSYS_stricmp(strType, "Pages")) | 323 if(!FXSYS_stricmp(strType, "Pages")) |
323 { | 324 { |
324 pDictClone->Release(); | 325 pDictClone->Release(); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 if(!pSrcDict) | 452 if(!pSrcDict) |
452 return FALSE; | 453 return FALSE; |
453 CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc; | 454 CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc; |
454 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); | 455 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); |
455 if(!pDstDict) | 456 if(!pDstDict) |
456 return FALSE; | 457 return FALSE; |
457 pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE)); | 458 pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE)); |
458 return TRUE; | 459 return TRUE; |
459 } | 460 } |
460 | 461 |
OLD | NEW |