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/. */
13 struct nsPaperSizePS_
{
17 bool isMetric
; // Present to the user in metric, if possible
22 /** ---------------------------------------------------
25 nsPaperSizePS() { mCurrent
= 0; }
27 /** ---------------------------------------------------
28 * @return true if the cursor points past the last item.
30 bool AtEnd() { return mCurrent
>= mCount
; }
32 /** ---------------------------------------------------
33 * Position the cursor at the beginning of the paper size list.
36 void First() { mCurrent
= 0; }
38 /** ---------------------------------------------------
39 * Advance the cursor to the next item.
43 NS_ASSERTION(!AtEnd(), "Invalid current item");
47 /** ---------------------------------------------------
48 * Point the cursor to the entry with the given paper name.
49 * @return true if pointing to a valid entry.
51 bool Find(const char *aName
);
53 /** ---------------------------------------------------
54 * @return a pointer to the name of the current paper size
57 NS_PRECONDITION(!AtEnd(), "Invalid current item");
58 return mList
[mCurrent
].name
;
61 /** ---------------------------------------------------
62 * @return the width of the page in millimeters
65 NS_PRECONDITION(!AtEnd(), "Invalid current item");
66 return mList
[mCurrent
].width_mm
;
69 /** ---------------------------------------------------
70 * @return the height of the page in millimeters
73 NS_PRECONDITION(!AtEnd(), "Invalid current item");
74 return mList
[mCurrent
].height_mm
;
77 /** ---------------------------------------------------
78 * @return true if the paper should be presented to
79 * the user in metric units.
82 NS_PRECONDITION(!AtEnd(), "Invalid current item");
83 return mList
[mCurrent
].isMetric
;
87 unsigned int mCurrent
;
88 static const nsPaperSizePS_ mList
[];
89 static const unsigned int mCount
;