| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_PRINTING_WIN_PRINTING_CONTEXT_H__ | 5 #ifndef CHROME_BROWSER_PRINTING_WIN_PRINTING_CONTEXT_H__ |
| 6 #define CHROME_BROWSER_PRINTING_WIN_PRINTING_CONTEXT_H__ | 6 #define CHROME_BROWSER_PRINTING_WIN_PRINTING_CONTEXT_H__ |
| 7 | 7 |
| 8 #include <ocidl.h> | 8 #include <ocidl.h> |
| 9 #include <commdlg.h> | 9 #include <commdlg.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 OK, | 24 OK, |
| 25 CANCEL, | 25 CANCEL, |
| 26 FAILED, | 26 FAILED, |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 PrintingContext(); | 29 PrintingContext(); |
| 30 ~PrintingContext(); | 30 ~PrintingContext(); |
| 31 | 31 |
| 32 // Asks the user what printer and format should be used to print. Updates the | 32 // Asks the user what printer and format should be used to print. Updates the |
| 33 // context with the select device settings. | 33 // context with the select device settings. |
| 34 Result AskUserForSettings(HWND window, int max_pages); | 34 Result AskUserForSettings(HWND window, int max_pages, bool has_selection); |
| 35 | 35 |
| 36 // Selects the user's default printer and format. Updates the context with the | 36 // Selects the user's default printer and format. Updates the context with the |
| 37 // default device settings. | 37 // default device settings. |
| 38 Result UseDefaultSettings(); | 38 Result UseDefaultSettings(); |
| 39 | 39 |
| 40 // Initializes with predefined settings. | 40 // Initializes with predefined settings. |
| 41 Result InitWithSettings(const PrintSettings& settings); | 41 Result InitWithSettings(const PrintSettings& settings); |
| 42 | 42 |
| 43 // Reinitializes the settings to uninitialized for object reuse. | 43 // Reinitializes the settings to uninitialized for object reuse. |
| 44 void ResetSettings(); | 44 void ResetSettings(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 74 | 74 |
| 75 const PrintSettings& settings() const { | 75 const PrintSettings& settings() const { |
| 76 return settings_; | 76 return settings_; |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 // Class that manages the PrintDlgEx() callbacks. This is meant to be a | 80 // Class that manages the PrintDlgEx() callbacks. This is meant to be a |
| 81 // temporary object used during the Print... dialog display. | 81 // temporary object used during the Print... dialog display. |
| 82 class CallbackHandler; | 82 class CallbackHandler; |
| 83 | 83 |
| 84 // Does bookeeping when an error occurs. | 84 // Does bookkeeping when an error occurs. |
| 85 PrintingContext::Result OnErrror(); | 85 PrintingContext::Result OnError(); |
| 86 | 86 |
| 87 // Used in response to the user cancelling the printing. | 87 // Used in response to the user canceling the printing. |
| 88 static BOOL CALLBACK AbortProc(HDC hdc, int nCode); | 88 static BOOL CALLBACK AbortProc(HDC hdc, int nCode); |
| 89 | 89 |
| 90 // Reads the settings from the selected device context. Updates settings_ and | 90 // Reads the settings from the selected device context. Updates settings_ and |
| 91 // its margins. | 91 // its margins. |
| 92 bool InitializeSettings(const DEVMODE& dev_mode, | 92 bool InitializeSettings(const DEVMODE& dev_mode, |
| 93 const std::wstring& new_device_name, | 93 const std::wstring& new_device_name, |
| 94 const PRINTPAGERANGE* ranges, | 94 const PRINTPAGERANGE* ranges, |
| 95 int number_ranges); | 95 int number_ranges, |
| 96 bool selection_only); |
| 96 | 97 |
| 97 // Retrieves the printer's default low-level settings. hdc_ is allocated with | 98 // Retrieves the printer's default low-level settings. hdc_ is allocated with |
| 98 // this call. | 99 // this call. |
| 99 bool GetPrinterSettings(HANDLE printer, | 100 bool GetPrinterSettings(HANDLE printer, |
| 100 const std::wstring& device_name); | 101 const std::wstring& device_name); |
| 101 | 102 |
| 102 // Allocates the HDC for a specific DEVMODE. | 103 // Allocates the HDC for a specific DEVMODE. |
| 103 bool AllocateContext(const std::wstring& printer_name, | 104 bool AllocateContext(const std::wstring& printer_name, |
| 104 const DEVMODE* dev_mode); | 105 const DEVMODE* dev_mode); |
| 105 | 106 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 129 | 130 |
| 130 // Did the user cancel the print job. | 131 // Did the user cancel the print job. |
| 131 volatile bool abort_printing_; | 132 volatile bool abort_printing_; |
| 132 | 133 |
| 133 DISALLOW_EVIL_CONSTRUCTORS(PrintingContext); | 134 DISALLOW_EVIL_CONSTRUCTORS(PrintingContext); |
| 134 }; | 135 }; |
| 135 | 136 |
| 136 } // namespace printing | 137 } // namespace printing |
| 137 | 138 |
| 138 #endif // CHROME_BROWSER_PRINTING_WIN_PRINTING_CONTEXT_H__ | 139 #endif // CHROME_BROWSER_PRINTING_WIN_PRINTING_CONTEXT_H__ |
| OLD | NEW |