| 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 "core/include/fpdfdoc/fpdf_doc.h" | 7 #include "core/include/fpdfdoc/fpdf_doc.h" |
| 8 | 8 |
| 9 CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc) | 9 CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc) |
| 10 : m_pDoc(pDoc) {} | 10 : m_pDoc(pDoc) {} |
| 11 CPDF_ViewerPreferences::~CPDF_ViewerPreferences() {} | 11 CPDF_ViewerPreferences::~CPDF_ViewerPreferences() {} |
| 12 FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const { | 12 FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const { |
| 13 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); | 13 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); |
| 14 pDict = pDict->GetDict("ViewerPreferences"); | 14 pDict = pDict->GetDictBy("ViewerPreferences"); |
| 15 if (!pDict) { | 15 if (!pDict) { |
| 16 return FALSE; | 16 return FALSE; |
| 17 } | 17 } |
| 18 return "R2L" == pDict->GetString("Direction"); | 18 return "R2L" == pDict->GetStringBy("Direction"); |
| 19 } | 19 } |
| 20 FX_BOOL CPDF_ViewerPreferences::PrintScaling() const { | 20 FX_BOOL CPDF_ViewerPreferences::PrintScaling() const { |
| 21 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); | 21 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); |
| 22 pDict = pDict->GetDict("ViewerPreferences"); | 22 pDict = pDict->GetDictBy("ViewerPreferences"); |
| 23 if (!pDict) { | 23 if (!pDict) { |
| 24 return TRUE; | 24 return TRUE; |
| 25 } | 25 } |
| 26 return "None" != pDict->GetString("PrintScaling"); | 26 return "None" != pDict->GetStringBy("PrintScaling"); |
| 27 } | 27 } |
| 28 int32_t CPDF_ViewerPreferences::NumCopies() const { | 28 int32_t CPDF_ViewerPreferences::NumCopies() const { |
| 29 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); | 29 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); |
| 30 pDict = pDict->GetDict("ViewerPreferences"); | 30 pDict = pDict->GetDictBy("ViewerPreferences"); |
| 31 if (!pDict) { | 31 if (!pDict) { |
| 32 return 1; | 32 return 1; |
| 33 } | 33 } |
| 34 return pDict->GetInteger("NumCopies"); | 34 return pDict->GetIntegerBy("NumCopies"); |
| 35 } | 35 } |
| 36 CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const { | 36 CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const { |
| 37 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); | 37 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); |
| 38 CPDF_Array* pRange = NULL; | 38 CPDF_Array* pRange = NULL; |
| 39 pDict = pDict->GetDict("ViewerPreferences"); | 39 pDict = pDict->GetDictBy("ViewerPreferences"); |
| 40 if (!pDict) { | 40 if (!pDict) { |
| 41 return pRange; | 41 return pRange; |
| 42 } | 42 } |
| 43 pRange = pDict->GetArray("PrintPageRange"); | 43 pRange = pDict->GetArrayBy("PrintPageRange"); |
| 44 return pRange; | 44 return pRange; |
| 45 } | 45 } |
| 46 CFX_ByteString CPDF_ViewerPreferences::Duplex() const { | 46 CFX_ByteString CPDF_ViewerPreferences::Duplex() const { |
| 47 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); | 47 CPDF_Dictionary* pDict = m_pDoc->GetRoot(); |
| 48 pDict = pDict->GetDict("ViewerPreferences"); | 48 pDict = pDict->GetDictBy("ViewerPreferences"); |
| 49 if (!pDict) { | 49 if (!pDict) { |
| 50 return "None"; | 50 return "None"; |
| 51 } | 51 } |
| 52 return pDict->GetString("Duplex"); | 52 return pDict->GetStringBy("Duplex"); |
| 53 } | 53 } |
| OLD | NEW |