widget/gtk/nsPaperPS.cpp

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* ex: set tabstop=8 softtabstop=4 shiftwidth=4 expandtab: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #include "mozilla/ArrayUtils.h"
michael@0 8
michael@0 9 #include "nsPaperPS.h"
michael@0 10 #include "plstr.h"
michael@0 11 #include "nsCoord.h"
michael@0 12 #include "nsMemory.h"
michael@0 13
michael@0 14 using namespace mozilla;
michael@0 15
michael@0 16 const nsPaperSizePS_ nsPaperSizePS::mList[] =
michael@0 17 {
michael@0 18 #define SIZE_MM(x) (x)
michael@0 19 #define SIZE_INCH(x) ((x) * MM_PER_INCH_FLOAT)
michael@0 20 { "A5", SIZE_MM(148), SIZE_MM(210), true },
michael@0 21 { "A4", SIZE_MM(210), SIZE_MM(297), true },
michael@0 22 { "A3", SIZE_MM(297), SIZE_MM(420), true },
michael@0 23 { "Letter", SIZE_INCH(8.5), SIZE_INCH(11), false },
michael@0 24 { "Legal", SIZE_INCH(8.5), SIZE_INCH(14), false },
michael@0 25 { "Tabloid", SIZE_INCH(11), SIZE_INCH(17), false },
michael@0 26 { "Executive", SIZE_INCH(7.5), SIZE_INCH(10), false },
michael@0 27 #undef SIZE_INCH
michael@0 28 #undef SIZE_MM
michael@0 29 };
michael@0 30
michael@0 31 const unsigned int nsPaperSizePS::mCount = ArrayLength(mList);
michael@0 32
michael@0 33 bool
michael@0 34 nsPaperSizePS::Find(const char *aName)
michael@0 35 {
michael@0 36 for (int i = mCount; i--; ) {
michael@0 37 if (!PL_strcasecmp(aName, mList[i].name)) {
michael@0 38 mCurrent = i;
michael@0 39 return true;
michael@0 40 }
michael@0 41 }
michael@0 42 return false;
michael@0 43 }

mercurial