2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ex: set tabstop=8 softtabstop=4 shiftwidth=4 expandtab: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-10 22:50:08 -07:00
|
|
|
#include "mozilla/Util.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsPaperPS.h"
|
|
|
|
#include "plstr.h"
|
2010-08-13 02:57:57 -07:00
|
|
|
#include "nsCoord.h"
|
2011-05-21 13:04:44 -07:00
|
|
|
#include "nsMemory.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-10 22:50:08 -07:00
|
|
|
using namespace mozilla;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
const nsPaperSizePS_ nsPaperSizePS::mList[] =
|
|
|
|
{
|
|
|
|
#define SIZE_MM(x) (x)
|
2010-08-13 02:57:57 -07:00
|
|
|
#define SIZE_INCH(x) ((x) * MM_PER_INCH_FLOAT)
|
2011-10-03 00:56:21 -07:00
|
|
|
{ "A5", SIZE_MM(148), SIZE_MM(210), true },
|
|
|
|
{ "A4", SIZE_MM(210), SIZE_MM(297), true },
|
|
|
|
{ "A3", SIZE_MM(297), SIZE_MM(420), true },
|
|
|
|
{ "Letter", SIZE_INCH(8.5), SIZE_INCH(11), false },
|
|
|
|
{ "Legal", SIZE_INCH(8.5), SIZE_INCH(14), false },
|
|
|
|
{ "Tabloid", SIZE_INCH(11), SIZE_INCH(17), false },
|
|
|
|
{ "Executive", SIZE_INCH(7.5), SIZE_INCH(10), false },
|
2007-03-22 10:30:00 -07:00
|
|
|
#undef SIZE_INCH
|
|
|
|
#undef SIZE_MM
|
|
|
|
};
|
|
|
|
|
2011-10-10 22:50:08 -07:00
|
|
|
const unsigned int nsPaperSizePS::mCount = ArrayLength(mList);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2007-03-22 10:30:00 -07:00
|
|
|
nsPaperSizePS::Find(const char *aName)
|
|
|
|
{
|
|
|
|
for (int i = mCount; i--; ) {
|
|
|
|
if (!PL_strcasecmp(aName, mList[i].name)) {
|
|
|
|
mCurrent = i;
|
2011-10-03 00:56:21 -07:00
|
|
|
return true;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|
|
|
|
}
|
2011-10-03 00:56:21 -07:00
|
|
|
return false;
|
2007-03-22 10:30:00 -07:00
|
|
|
}
|