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/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 } |
(...skipping 11 matching lines...) Expand all Loading... | |
22 } | 22 } |
23 FX_BOOL CPDF_ViewerPreferences::PrintScaling() const | 23 FX_BOOL CPDF_ViewerPreferences::PrintScaling() const |
24 { | 24 { |
25 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); | 25 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); |
26 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); | 26 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); |
27 if (!pDict) { | 27 if (!pDict) { |
28 return TRUE; | 28 return TRUE; |
29 } | 29 } |
30 return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling")); | 30 return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling")); |
31 } | 31 } |
32 FX_INT32 CPDF_ViewerPreferences::NumCopies() const | |
33 { | |
34 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); | |
35 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); | |
36 if (!pDict) { | |
37 return FALSE; | |
38 } | |
39 return pDict->GetInteger(FX_BSTRC("NumCopies")); | |
40 } | |
41 CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const | |
42 { | |
43 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); | |
44 CPDF_Array *pRange = NULL; | |
45 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); | |
46 if (!pDict) { | |
47 return pRange; | |
48 } | |
49 pRange = pDict->GetArray(FX_BSTRC("PrintPageRange")); | |
50 return pRange; | |
51 } | |
52 FX_INT32 CPDF_ViewerPreferences::Duplex() const | |
Bo Xu
2014/06/29 20:58:16
This function should return a CFX_ByteString like
Nikhil
2014/07/07 08:54:18
Done.
| |
53 { | |
54 CPDF_Dictionary *pDict = m_pDoc->GetRoot(); | |
55 CFX_ByteString duplex; | |
56 DuplexType type; | |
Vitaly Buka (NO REVIEWS)
2014/06/25 18:02:24
no need "type" variable.
Nikhil
2014/06/26 10:21:38
Done.
| |
57 pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); | |
58 if (!pDict) { | |
59 return type; | |
60 } | |
61 | |
62 // Extract and map Duplex property. | |
63 duplex = pDict->GetString(FX_BSTRC("Duplex")); | |
64 if (FX_BSTRC("None") == duplex) | |
65 type = None; | |
Vitaly Buka (NO REVIEWS)
2014/06/25 18:02:24
return immediatly
Nikhil
2014/06/26 10:21:38
Done.
| |
66 if (FX_BSTRC("Simplex") == duplex) | |
67 type = Simplex; | |
68 if (FX_BSTRC("DuplexFlipShortEdge") == duplex) | |
69 type = DuplexFlipShortEdge; | |
70 if (FX_BSTRC("DuplexFlipLongEdge") == duplex) | |
71 type = DuplexFlipLongEdge; | |
72 | |
73 return type; | |
74 } | |
OLD | NEW |