• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 
7 #include "../../include/fpdfdoc/fpdf_doc.h"
CPDF_ViewerPreferences(CPDF_Document * pDoc)8 CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document *pDoc): m_pDoc(pDoc)
9 {
10 }
~CPDF_ViewerPreferences()11 CPDF_ViewerPreferences::~CPDF_ViewerPreferences()
12 {
13 }
IsDirectionR2L() const14 FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const
15 {
16     CPDF_Dictionary *pDict = m_pDoc->GetRoot();
17     pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
18     if (!pDict)	{
19         return FALSE;
20     }
21     return FX_BSTRC("R2L") == pDict->GetString(FX_BSTRC("Direction"));
22 }
PrintScaling() const23 FX_BOOL CPDF_ViewerPreferences::PrintScaling() const
24 {
25     CPDF_Dictionary *pDict = m_pDoc->GetRoot();
26     pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
27     if (!pDict)	{
28         return TRUE;
29     }
30     return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling"));
31 }
NumCopies() const32 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 1;
38     }
39     return pDict->GetInteger(FX_BSTRC("NumCopies"));
40 }
PrintPageRange() const41 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 }
Duplex() const52 CFX_ByteString CPDF_ViewerPreferences::Duplex() const
53 {
54     CPDF_Dictionary *pDict = m_pDoc->GetRoot();
55     pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
56     if (!pDict) {
57         return FX_BSTRC("None");
58     }
59     return pDict->GetString(FX_BSTRC("Duplex"));
60 }
61