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