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

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

mercurial