xlou | a428812 | 2018-04-14 00:03:33 | [diff] [blame^] | 1 | // Copyright 2018 The Chromium 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 | #ifndef PRINTING_NUP_PARAMETERS_H_ |
| 6 | #define PRINTING_NUP_PARAMETERS_H_ |
| 7 | |
| 8 | #include "printing/printing_export.h" |
| 9 | |
| 10 | namespace printing { |
| 11 | |
| 12 | class PRINTING_EXPORT NupParameters { |
| 13 | public: |
| 14 | NupParameters(); |
| 15 | |
| 16 | // Whether or not the input |num_pages_per_sheet| is a supported N-up value. |
| 17 | // Supported values are: 1 2 4 6 9 16 |
| 18 | static bool IsSupported(int num_pages_per_sheet); |
| 19 | |
| 20 | // Orientation of the to-be-generated N-up PDF document. |
| 21 | bool landscape() const { return landscape_; }; |
| 22 | int num_pages_on_x_axis() const { return num_pages_on_x_axis_; }; |
| 23 | int num_pages_on_y_axis() const { return num_pages_on_y_axis_; }; |
| 24 | |
| 25 | // Calculates the |num_pages_on_x_axis_|, |num_pages_on_y_axis_| and |
| 26 | // |landscape_| based on the input. |is_source_landscape| is true if the |
| 27 | // source document orientation is landscape. |
| 28 | // Callers should check |num_pages_per_sheet| values with IsSupported() first, |
| 29 | // and only pass in supported values. |
| 30 | void SetParameters(int num_pages_per_sheet, bool is_source_landscape); |
| 31 | |
| 32 | // Turns off N-up mode by resetting |num_pages_on_x_axis| = 1, |
| 33 | // |num_pages_on_y_axis| = 1, and |landscape_| = false |
| 34 | void Clear(); |
| 35 | |
| 36 | private: |
| 37 | int num_pages_on_x_axis_; |
| 38 | int num_pages_on_y_axis_; |
| 39 | bool landscape_; |
| 40 | }; |
| 41 | |
| 42 | } // namespace printing |
| 43 | |
| 44 | #endif // PRINTING_NUP_PARAMETERS_H_ |