diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-29 02:36:26 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-29 02:36:26 +0000 |
commit | c48bee274f6c6869430bdda4ce771c8cdabf736f (patch) | |
tree | 7ce89dceab0e9dd2d2a7f7426a429f68201a8782 /printing/page_setup.cc | |
parent | e555f205eb8931da7fdf0f4cb4a01a24c3e2bf8a (diff) | |
download | chromium_src-c48bee274f6c6869430bdda4ce771c8cdabf736f.zip chromium_src-c48bee274f6c6869430bdda4ce771c8cdabf736f.tar.gz chromium_src-c48bee274f6c6869430bdda4ce771c8cdabf736f.tar.bz2 |
Print Preview: Implement basic settings.
BUG=57902
TEST=Run with --enable-print-preview, make sure orientation and color settings work.
Review URL: http://codereview.chromium.org/6736014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'printing/page_setup.cc')
-rw-r--r-- | printing/page_setup.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/printing/page_setup.cc b/printing/page_setup.cc index 6d4ef1d..9ac3e520 100644 --- a/printing/page_setup.cc +++ b/printing/page_setup.cc @@ -1,9 +1,11 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "printing/page_setup.h" +#include <algorithm> + #include "base/logging.h" namespace printing { @@ -125,4 +127,17 @@ void PageSetup::SetRequestedMargins(const PageMargins& requested_margins) { Init(physical_size_, printable_area_, text_height_); } +void PageSetup::FlipOrientation() { + if (physical_size_.width() && physical_size_.height()) { + gfx::Size new_size(physical_size_.height(), physical_size_.width()); + int new_y = physical_size_.width() - + (printable_area_.width() + printable_area_.x()); + gfx::Rect new_printable_area(printable_area_.y(), + new_y, + printable_area_.height(), + printable_area_.width()); + Init(new_size, new_printable_area, text_height_); + } +} + } // namespace printing |