michael@0: /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* ex: set tabstop=8 softtabstop=4 shiftwidth=4 expandtab: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "mozilla/ArrayUtils.h" michael@0: michael@0: #include "nsPaperPS.h" michael@0: #include "plstr.h" michael@0: #include "nsCoord.h" michael@0: #include "nsMemory.h" michael@0: michael@0: using namespace mozilla; michael@0: michael@0: const nsPaperSizePS_ nsPaperSizePS::mList[] = michael@0: { michael@0: #define SIZE_MM(x) (x) michael@0: #define SIZE_INCH(x) ((x) * MM_PER_INCH_FLOAT) michael@0: { "A5", SIZE_MM(148), SIZE_MM(210), true }, michael@0: { "A4", SIZE_MM(210), SIZE_MM(297), true }, michael@0: { "A3", SIZE_MM(297), SIZE_MM(420), true }, michael@0: { "Letter", SIZE_INCH(8.5), SIZE_INCH(11), false }, michael@0: { "Legal", SIZE_INCH(8.5), SIZE_INCH(14), false }, michael@0: { "Tabloid", SIZE_INCH(11), SIZE_INCH(17), false }, michael@0: { "Executive", SIZE_INCH(7.5), SIZE_INCH(10), false }, michael@0: #undef SIZE_INCH michael@0: #undef SIZE_MM michael@0: }; michael@0: michael@0: const unsigned int nsPaperSizePS::mCount = ArrayLength(mList); michael@0: michael@0: bool michael@0: nsPaperSizePS::Find(const char *aName) michael@0: { michael@0: for (int i = mCount; i--; ) { michael@0: if (!PL_strcasecmp(aName, mList[i].name)) { michael@0: mCurrent = i; michael@0: return true; michael@0: } michael@0: } michael@0: return false; michael@0: }