1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/widget/gtk/nsPaperPS.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,43 @@ 1.4 +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* ex: set tabstop=8 softtabstop=4 shiftwidth=4 expandtab: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "mozilla/ArrayUtils.h" 1.11 + 1.12 +#include "nsPaperPS.h" 1.13 +#include "plstr.h" 1.14 +#include "nsCoord.h" 1.15 +#include "nsMemory.h" 1.16 + 1.17 +using namespace mozilla; 1.18 + 1.19 +const nsPaperSizePS_ nsPaperSizePS::mList[] = 1.20 +{ 1.21 +#define SIZE_MM(x) (x) 1.22 +#define SIZE_INCH(x) ((x) * MM_PER_INCH_FLOAT) 1.23 + { "A5", SIZE_MM(148), SIZE_MM(210), true }, 1.24 + { "A4", SIZE_MM(210), SIZE_MM(297), true }, 1.25 + { "A3", SIZE_MM(297), SIZE_MM(420), true }, 1.26 + { "Letter", SIZE_INCH(8.5), SIZE_INCH(11), false }, 1.27 + { "Legal", SIZE_INCH(8.5), SIZE_INCH(14), false }, 1.28 + { "Tabloid", SIZE_INCH(11), SIZE_INCH(17), false }, 1.29 + { "Executive", SIZE_INCH(7.5), SIZE_INCH(10), false }, 1.30 +#undef SIZE_INCH 1.31 +#undef SIZE_MM 1.32 +}; 1.33 + 1.34 +const unsigned int nsPaperSizePS::mCount = ArrayLength(mList); 1.35 + 1.36 +bool 1.37 +nsPaperSizePS::Find(const char *aName) 1.38 +{ 1.39 + for (int i = mCount; i--; ) { 1.40 + if (!PL_strcasecmp(aName, mList[i].name)) { 1.41 + mCurrent = i; 1.42 + return true; 1.43 + } 1.44 + } 1.45 + return false; 1.46 +}