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 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
9 | 9 |
10 class CPDF_PageOrganizer | 10 class CPDF_PageOrganizer |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo(); | 46 CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo(); |
47 | 47 |
48 if(!DInfoDict) | 48 if(!DInfoDict) |
49 return FALSE; | 49 return FALSE; |
50 | 50 |
51 CFX_ByteString producerstr; | 51 CFX_ByteString producerstr; |
52 producerstr.Format("PDFium"); | 52 producerstr.Format("PDFium"); |
53 DInfoDict->SetAt("Producer", new CPDF_String(producerstr)); | 53 DInfoDict->SetAt("Producer", new CPDF_String(producerstr)); |
54 | 54 |
55 //Set type//////////////////////////////////////////////////////////////
// | 55 //Set type//////////////////////////////////////////////////////////////
// |
56 » CFX_ByteString cbRootType = pNewRoot->GetString("Type",""); | 56 » CFX_ByteString cbRootType = pNewRoot->GetStringAt("Type", ""); |
57 if( cbRootType.Equal("") ) | 57 if( cbRootType.Equal("") ) |
58 { | 58 { |
59 pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); | 59 pNewRoot->SetAt("Type", new CPDF_Name("Catalog")); |
60 } | 60 } |
61 | 61 |
62 CPDF_Dictionary* pNewPages = (CPDF_Dictionary*)(pNewRoot->GetElement("Pa
ges")? pNewRoot->GetElement("Pages")->GetDirect() : NULL); | 62 CPDF_Dictionary* pNewPages = (CPDF_Dictionary*)(pNewRoot->GetElement("Pa
ges")? pNewRoot->GetElement("Pages")->GetDirect() : NULL); |
63 if(!pNewPages) | 63 if(!pNewPages) |
64 { | 64 { |
65 pNewPages = new CPDF_Dictionary; | 65 pNewPages = new CPDF_Dictionary; |
66 FX_DWORD NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages); | 66 FX_DWORD NewPagesON = pDestPDFDoc->AddIndirectObject(pNewPages); |
67 pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPage
sON)); | 67 pNewRoot->SetAt("Pages", new CPDF_Reference(pDestPDFDoc, NewPage
sON)); |
68 } | 68 } |
69 | 69 |
70 » CFX_ByteString cbPageType = pNewPages->GetString("Type",""); | 70 » CFX_ByteString cbPageType = pNewPages->GetStringAt("Type", ""); |
71 if(cbPageType.Equal("")) | 71 if(cbPageType.Equal("")) |
72 { | 72 { |
73 pNewPages->SetAt("Type", new CPDF_Name("Pages")); | 73 pNewPages->SetAt("Type", new CPDF_Name("Pages")); |
74 } | 74 } |
75 | 75 |
76 CPDF_Array* pKeysArray = pNewPages->GetArray("Kids"); | 76 CPDF_Array* pKeysArray = pNewPages->GetArray("Kids"); |
77 if(pKeysArray == NULL) | 77 if(pKeysArray == NULL) |
78 { | 78 { |
79 CPDF_Array* pNewKids = new CPDF_Array; | 79 CPDF_Array* pNewKids = new CPDF_Array; |
80 FX_DWORD Kidsobjnum = -1; | 80 FX_DWORD Kidsobjnum = -1; |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 if(!pClone) | 318 if(!pClone) |
319 { | 319 { |
320 return 0; | 320 return 0; |
321 } | 321 } |
322 | 322 |
323 if(pClone->GetType() == PDFOBJ_DICTIONARY) | 323 if(pClone->GetType() == PDFOBJ_DICTIONARY) |
324 { | 324 { |
325 CPDF_Dictionary* pDictClone = (CPDF_Dictionary*)pClone; | 325 CPDF_Dictionary* pDictClone = (CPDF_Dictionary*)pClone; |
326 if(pDictClone->KeyExist("Type")) | 326 if(pDictClone->KeyExist("Type")) |
327 { | 327 { |
328 » » » » CFX_ByteString strType = pDictClone->GetString("
Type"); | 328 » » » » CFX_ByteString strType = |
| 329 pDictClone->GetStringAt("Type"); |
329 if(!FXSYS_stricmp(strType, "Pages")) | 330 if(!FXSYS_stricmp(strType, "Pages")) |
330 { | 331 { |
331 pDictClone->Release(); | 332 pDictClone->Release(); |
332 return 4; | 333 return 4; |
333 } | 334 } |
334 else if(!FXSYS_stricmp(strType, "Page")) | 335 else if(!FXSYS_stricmp(strType, "Page")) |
335 { | 336 { |
336 pDictClone->Release(); | 337 pDictClone->Release(); |
337 return 0; | 338 return 0; |
338 } | 339 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 if(!pSrcDict) | 459 if(!pSrcDict) |
459 return FALSE; | 460 return FALSE; |
460 CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc; | 461 CPDF_Document* pDstDoc = (CPDF_Document*)dest_doc; |
461 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); | 462 CPDF_Dictionary* pDstDict = pDstDoc->GetRoot(); |
462 if(!pDstDict) | 463 if(!pDstDict) |
463 return FALSE; | 464 return FALSE; |
464 pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE)); | 465 pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE)); |
465 return TRUE; | 466 return TRUE; |
466 } | 467 } |
467 | 468 |
OLD | NEW |