Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 | } |