OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "printing/printed_document.h" | 5 #include "printing/printed_document.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 const std::wstring& line = settings.overlays.GetOverlay(x, y); | 192 const std::wstring& line = settings.overlays.GetOverlay(x, y); |
193 if (line.empty()) { | 193 if (line.empty()) { |
194 return; | 194 return; |
195 } | 195 } |
196 std::wstring output(PageOverlays::ReplaceVariables(line, *this, page)); | 196 std::wstring output(PageOverlays::ReplaceVariables(line, *this, page)); |
197 if (output.empty()) { | 197 if (output.empty()) { |
198 // May happen if document name or url is empty. | 198 // May happen if document name or url is empty. |
199 return; | 199 return; |
200 } | 200 } |
201 const gfx::Size string_size(font.GetStringWidth(output), font.height()); | 201 const gfx::Size string_size(font.GetStringWidth(output), font.GetHeight()); |
202 gfx::Rect bounding; | 202 gfx::Rect bounding; |
203 bounding.set_height(string_size.height()); | 203 bounding.set_height(string_size.height()); |
204 const gfx::Rect& overlay_area( | 204 const gfx::Rect& overlay_area( |
205 settings.page_setup_device_units().overlay_area()); | 205 settings.page_setup_device_units().overlay_area()); |
206 // Hard code .25 cm interstice between overlays. Make sure that some space is | 206 // Hard code .25 cm interstice between overlays. Make sure that some space is |
207 // kept between each headers. | 207 // kept between each headers. |
208 const int interstice = ConvertUnit(250, kHundrethsMMPerInch, | 208 const int interstice = ConvertUnit(250, kHundrethsMMPerInch, |
209 settings.device_units_per_inch()); | 209 settings.device_units_per_inch()); |
210 const int max_width = overlay_area.width() / 3 - interstice; | 210 const int max_width = overlay_area.width() / 3 - interstice; |
211 const int actual_width = std::min(string_size.width(), max_width); | 211 const int actual_width = std::min(string_size.width(), max_width); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 date_ = win_util::FormatSystemDate(systemtime, std::wstring()); | 326 date_ = win_util::FormatSystemDate(systemtime, std::wstring()); |
327 time_ = win_util::FormatSystemTime(systemtime, std::wstring()); | 327 time_ = win_util::FormatSystemTime(systemtime, std::wstring()); |
328 #else // OS_WIN | 328 #else // OS_WIN |
329 Time now = Time::Now(); | 329 Time now = Time::Now(); |
330 date_ = base::TimeFormatShortDateNumeric(now); | 330 date_ = base::TimeFormatShortDateNumeric(now); |
331 time_ = base::TimeFormatTimeOfDay(now); | 331 time_ = base::TimeFormatTimeOfDay(now); |
332 #endif // OS_WIN | 332 #endif // OS_WIN |
333 } | 333 } |
334 | 334 |
335 } // namespace printing | 335 } // namespace printing |
OLD | NEW |