Chromium Code Reviews| Index: core/src/fpdfdoc/doc_viewerPreferences.cpp |
| diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp |
| index 617485cfc27b6e5b5d55da488991673826e65fbe..51909ce183f16cf8d4d70411e8ec84880cab373f 100644 |
| --- a/core/src/fpdfdoc/doc_viewerPreferences.cpp |
| +++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp |
| @@ -29,3 +29,46 @@ FX_BOOL CPDF_ViewerPreferences::PrintScaling() const |
| } |
| return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling")); |
| } |
| +FX_INT32 CPDF_ViewerPreferences::NumCopies() const |
| +{ |
| + CPDF_Dictionary *pDict = m_pDoc->GetRoot(); |
| + pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); |
| + if (!pDict) { |
| + return FALSE; |
| + } |
| + return pDict->GetInteger(FX_BSTRC("NumCopies")); |
| +} |
| +CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const |
| +{ |
| + CPDF_Dictionary *pDict = m_pDoc->GetRoot(); |
| + CPDF_Array *pRange = NULL; |
| + pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); |
| + if (!pDict) { |
| + return pRange; |
| + } |
| + pRange = pDict->GetArray(FX_BSTRC("PrintPageRange")); |
| + return pRange; |
| +} |
| +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.
|
| +{ |
| + CPDF_Dictionary *pDict = m_pDoc->GetRoot(); |
| + CFX_ByteString duplex; |
| + DuplexType type; |
|
Vitaly Buka (NO REVIEWS)
2014/06/25 18:02:24
no need "type" variable.
Nikhil
2014/06/26 10:21:38
Done.
|
| + pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences")); |
| + if (!pDict) { |
| + return type; |
| + } |
| + |
| + // Extract and map Duplex property. |
| + duplex = pDict->GetString(FX_BSTRC("Duplex")); |
| + if (FX_BSTRC("None") == duplex) |
| + type = None; |
|
Vitaly Buka (NO REVIEWS)
2014/06/25 18:02:24
return immediatly
Nikhil
2014/06/26 10:21:38
Done.
|
| + if (FX_BSTRC("Simplex") == duplex) |
| + type = Simplex; |
| + if (FX_BSTRC("DuplexFlipShortEdge") == duplex) |
| + type = DuplexFlipShortEdge; |
| + if (FX_BSTRC("DuplexFlipLongEdge") == duplex) |
| + type = DuplexFlipLongEdge; |
| + |
| + return type; |
| +} |