Line data Source code
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/. */
6 :
7 : #include "mozilla/ArrayUtils.h"
8 :
9 : #include "nsPaperPS.h"
10 : #include "plstr.h"
11 : #include "nsCoord.h"
12 : #include "nsMemory.h"
13 :
14 : using namespace mozilla;
15 :
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 : };
30 :
31 : const unsigned int nsPaperSizePS::mCount = ArrayLength(mList);
32 :
33 : bool
34 0 : nsPaperSizePS::Find(const char *aName)
35 : {
36 0 : for (int i = mCount; i--; ) {
37 0 : if (!PL_strcasecmp(aName, mList[i].name)) {
38 0 : mCurrent = i;
39 0 : return true;
40 : }
41 : }
42 0 : return false;
43 : }
|