1 // Copyright 2016 The PDFium Authors 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 #ifndef CORE_FPDFDOC_CPDF_VIEWERPREFERENCES_H_ 8 #define CORE_FPDFDOC_CPDF_VIEWERPREFERENCES_H_ 9 10 #include <stdint.h> 11 12 #include "core/fxcrt/bytestring.h" 13 #include "core/fxcrt/retain_ptr.h" 14 #include "core/fxcrt/unowned_ptr.h" 15 #include "third_party/abseil-cpp/absl/types/optional.h" 16 17 class CPDF_Array; 18 class CPDF_Dictionary; 19 class CPDF_Document; 20 21 class CPDF_ViewerPreferences { 22 public: 23 explicit CPDF_ViewerPreferences(const CPDF_Document* pDoc); 24 ~CPDF_ViewerPreferences(); 25 26 bool IsDirectionR2L() const; 27 bool PrintScaling() const; 28 int32_t NumCopies() const; 29 RetainPtr<const CPDF_Array> PrintPageRange() const; 30 ByteString Duplex() const; 31 32 // Gets the entry for |bsKey|. 33 absl::optional<ByteString> GenericName(const ByteString& bsKey) const; 34 35 private: 36 RetainPtr<const CPDF_Dictionary> GetViewerPreferences() const; 37 38 UnownedPtr<const CPDF_Document> const m_pDoc; 39 }; 40 41 #endif // CORE_FPDFDOC_CPDF_VIEWERPREFERENCES_H_ 42