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

Side by Side Diff: core/src/fpdfdoc/doc_viewerPreferences.cpp

Issue 1194933003: Make CPDF_Object::GetString() a virtual method. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: rebase Created 5 years, 5 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
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 "../../include/fpdfdoc/fpdf_doc.h" 7 #include "../../include/fpdfdoc/fpdf_doc.h"
8 CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document *pDoc): m_pDoc(pDoc ) 8 CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document *pDoc): m_pDoc(pDoc )
9 { 9 {
10 } 10 }
11 CPDF_ViewerPreferences::~CPDF_ViewerPreferences() 11 CPDF_ViewerPreferences::~CPDF_ViewerPreferences()
12 { 12 {
13 } 13 }
14 FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const 14 FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const
15 { 15 {
16 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); 16 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
17 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); 17 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
18 if (!pDict)»{ 18 if (!pDict)
19 return FALSE; 19 return FALSE;
20 } 20 return pDict->GetStringAt("Direction") == "R2L";
21 return FX_BSTRC("R2L") == pDict->GetString(FX_BSTRC("Direction"));
22 } 21 }
23 FX_BOOL CPDF_ViewerPreferences::PrintScaling() const 22 FX_BOOL CPDF_ViewerPreferences::PrintScaling() const
24 { 23 {
25 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); 24 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
26 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); 25 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
27 if (!pDict)»{ 26 if (!pDict)
28 return TRUE; 27 return TRUE;
29 } 28 return pDict->GetStringAt("PrintScaling") != "None";
30 return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling"));
31 } 29 }
32 int32_t CPDF_ViewerPreferences::NumCopies() const 30 int32_t CPDF_ViewerPreferences::NumCopies() const
33 { 31 {
34 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); 32 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
35 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); 33 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
36 if (!pDict) { 34 if (!pDict) {
37 return 1; 35 return 1;
38 } 36 }
39 return pDict->GetInteger(FX_BSTRC("NumCopies")); 37 return pDict->GetInteger(FX_BSTRC("NumCopies"));
40 } 38 }
41 CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const 39 CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const
42 { 40 {
43 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); 41 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
44 CPDF_Array *pRange = NULL; 42 CPDF_Array *pRange = NULL;
45 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); 43 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
46 if (!pDict) { 44 if (!pDict) {
47 return pRange; 45 return pRange;
48 } 46 }
49 pRange = pDict->GetArray(FX_BSTRC("PrintPageRange")); 47 pRange = pDict->GetArray(FX_BSTRC("PrintPageRange"));
50 return pRange; 48 return pRange;
51 } 49 }
52 CFX_ByteString CPDF_ViewerPreferences::Duplex() const 50 CFX_ByteString CPDF_ViewerPreferences::Duplex() const
53 { 51 {
54 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); 52 CPDF_Dictionary *pDict = m_pDoc->GetRoot();
55 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); 53 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
56 if (!pDict) { 54 if (!pDict) {
57 return FX_BSTRC("None"); 55 return FX_BSTRC("None");
58 } 56 }
59 return pDict->GetString(FX_BSTRC("Duplex")); 57 return pDict->GetStringAt("Duplex");
60 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698