1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_I18NUTIL_PAPER_HXX
21 #define INCLUDED_I18NUTIL_PAPER_HXX
22 
23 #include <i18nutil/i18nutildllapi.h>
24 #include <rtl/string.hxx>
25 
26 namespace com { namespace sun { namespace star { namespace lang { struct Locale; } } } }
27 
28 //!! The values of the following enumerators must correspond to the array position
29 //!! of the respective paper size in the file i18nutil/source/utility/paper.cxx
30 //!! Thus don't reorder the enum values here without changing the code there as well.
31 enum Paper
32 {
33     PAPER_A0,
34     PAPER_A1,
35     PAPER_A2,
36     PAPER_A3,
37     PAPER_A4,
38     PAPER_A5,
39     PAPER_B4_ISO,
40     PAPER_B5_ISO,
41     PAPER_LETTER,
42     PAPER_LEGAL,
43     PAPER_TABLOID,
44     PAPER_USER,
45     PAPER_B6_ISO,
46     PAPER_ENV_C4,
47     PAPER_ENV_C5,
48     PAPER_ENV_C6,
49     PAPER_ENV_C65,
50     PAPER_ENV_DL,
51     PAPER_SLIDE_DIA,
52     PAPER_SCREEN_4_3,
53     PAPER_C,
54     PAPER_D,
55     PAPER_E,
56     PAPER_EXECUTIVE,
57     PAPER_FANFOLD_LEGAL_DE,
58     PAPER_ENV_MONARCH,
59     PAPER_ENV_PERSONAL,
60     PAPER_ENV_9,
61     PAPER_ENV_10,
62     PAPER_ENV_11,
63     PAPER_ENV_12,
64     PAPER_KAI16,
65     PAPER_KAI32,
66     PAPER_KAI32BIG,
67     PAPER_B4_JIS,
68     PAPER_B5_JIS,
69     PAPER_B6_JIS,
70     PAPER_LEDGER,
71     PAPER_STATEMENT,
72     PAPER_QUARTO,
73     PAPER_10x14,
74     PAPER_ENV_14,
75     PAPER_ENV_C3,
76     PAPER_ENV_ITALY,
77     PAPER_FANFOLD_US,
78     PAPER_FANFOLD_DE,
79     PAPER_POSTCARD_JP,
80     PAPER_9x11,
81     PAPER_10x11,
82     PAPER_15x11,
83     PAPER_ENV_INVITE,
84     PAPER_A_PLUS,
85     PAPER_B_PLUS,
86     PAPER_LETTER_PLUS,
87     PAPER_A4_PLUS,
88     PAPER_DOUBLEPOSTCARD_JP,
89     PAPER_A6,
90     PAPER_12x11,
91     PAPER_A7,
92     PAPER_A8,
93     PAPER_A9,
94     PAPER_A10,
95     PAPER_B0_ISO,
96     PAPER_B1_ISO,
97     PAPER_B2_ISO,
98     PAPER_B3_ISO,
99     PAPER_B7_ISO,
100     PAPER_B8_ISO,
101     PAPER_B9_ISO,
102     PAPER_B10_ISO,
103     PAPER_ENV_C2,
104     PAPER_ENV_C7,
105     PAPER_ENV_C8,
106     PAPER_ARCHA,
107     PAPER_ARCHB,
108     PAPER_ARCHC,
109     PAPER_ARCHD,
110     PAPER_ARCHE,
111     PAPER_SCREEN_16_9,
112     PAPER_SCREEN_16_10,
113     PAPER_16K_195x270,
114     PAPER_16K_197x273
115 };
116 
117 // defined for 'equal size' test with the implementation array
118 #define NUM_PAPER_ENTRIES   (PAPER_16K_197x273 - PAPER_A0 + 1)
119 
120 
121 class I18NUTIL_DLLPUBLIC PaperInfo
122 {
123     Paper m_eType;
124     long m_nPaperWidth;     // width in 100thMM
125     long m_nPaperHeight;    // height in 100thMM
126 public:
127     PaperInfo(Paper eType);
128     PaperInfo(long nPaperWidth, long nPaperHeight);
129 
getPaper() const130     Paper getPaper() const { return m_eType; }
getWidth() const131     long getWidth() const { return m_nPaperWidth; }
getHeight() const132     long getHeight() const { return m_nPaperHeight; }
133     bool sloppyEqual(const PaperInfo &rOther) const;
134     void doSloppyFit();
135 
136     static PaperInfo getSystemDefaultPaper();
137     static PaperInfo getDefaultPaperForLocale(const css::lang::Locale & rLocale);
138 
139     static Paper fromPSName(const OString &rName);
140     static OString toPSName(Paper eType);
141 
142     static long sloppyFitPageDimension(long nDimension);
143 };
144 
145 #endif // INCLUDED_I18NUTIL_PAPER_HXX
146 
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
148