vitalybuka | f9d0c0c | 2014-09-09 19:53:33 | [diff] [blame] | 1 | // Copyright 2014 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_PRINTING_CONTEXT_SYSTEM_DIALOG_WIN_H_ |
| 6 | #define PRINTING_PRINTING_CONTEXT_SYSTEM_DIALOG_WIN_H_ |
| 7 | |
Lei Zhang | 01a1d3c0 | 2019-05-21 04:59:10 | [diff] [blame] | 8 | #include <ocidl.h> // NOLINT(build/include_order) |
| 9 | |
| 10 | #include <commdlg.h> // Must come after ocidl.h. |
vitalybuka | f9d0c0c | 2014-09-09 19:53:33 | [diff] [blame] | 11 | |
| 12 | #include <string> |
| 13 | |
avi | 126e93c | 2015-12-21 21:48:16 | [diff] [blame] | 14 | #include "base/macros.h" |
vitalybuka | f9d0c0c | 2014-09-09 19:53:33 | [diff] [blame] | 15 | #include "printing/printing_context_win.h" |
| 16 | #include "ui/gfx/native_widget_types.h" |
| 17 | |
| 18 | namespace printing { |
| 19 | |
thestig | e85e6b6 | 2016-08-25 00:00:06 | [diff] [blame] | 20 | class PRINTING_EXPORT PrintingContextSystemDialogWin |
vitalybuka | f9d0c0c | 2014-09-09 19:53:33 | [diff] [blame] | 21 | : public PrintingContextWin { |
| 22 | public: |
thestig | e85e6b6 | 2016-08-25 00:00:06 | [diff] [blame] | 23 | explicit PrintingContextSystemDialogWin(Delegate* delegate); |
| 24 | ~PrintingContextSystemDialogWin() override; |
vitalybuka | f9d0c0c | 2014-09-09 19:53:33 | [diff] [blame] | 25 | |
| 26 | // PrintingContext implementation. |
Vladislav Kuzkokov | 48ceab2 | 2018-02-14 16:29:28 | [diff] [blame] | 27 | void AskUserForSettings(int max_pages, |
| 28 | bool has_selection, |
| 29 | bool is_scripted, |
| 30 | PrintSettingsCallback callback) override; |
vitalybuka | f9d0c0c | 2014-09-09 19:53:33 | [diff] [blame] | 31 | |
| 32 | private: |
| 33 | friend class MockPrintingContextWin; |
| 34 | |
| 35 | virtual HRESULT ShowPrintDialog(PRINTDLGEX* options); |
| 36 | |
| 37 | // Reads the settings from the selected device context. Updates settings_ and |
| 38 | // its margins. |
mgiuca | 8ca5918 | 2015-07-08 02:10:21 | [diff] [blame] | 39 | bool InitializeSettingsWithRanges(const DEVMODE& dev_mode, |
| 40 | const std::wstring& new_device_name, |
| 41 | const PRINTPAGERANGE* ranges, |
| 42 | int number_ranges, |
| 43 | bool selection_only); |
vitalybuka | f9d0c0c | 2014-09-09 19:53:33 | [diff] [blame] | 44 | |
| 45 | // Parses the result of a PRINTDLGEX result. |
| 46 | Result ParseDialogResultEx(const PRINTDLGEX& dialog_options); |
vitalybuka | f9d0c0c | 2014-09-09 19:53:33 | [diff] [blame] | 47 | |
thestig | e85e6b6 | 2016-08-25 00:00:06 | [diff] [blame] | 48 | DISALLOW_COPY_AND_ASSIGN(PrintingContextSystemDialogWin); |
vitalybuka | f9d0c0c | 2014-09-09 19:53:33 | [diff] [blame] | 49 | }; |
| 50 | |
| 51 | } // namespace printing |
| 52 | |
| 53 | #endif // PRINTING_PRINTING_CONTEXT_SYSTEM_DIALOG_WIN_H_ |