xref: /trunk/main/i18npool/inc/i18npool/paper.hxx (revision 635e0213)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef INCLUDED_I18NPOOL_PAPER_HXX
25 #define INCLUDED_I18NPOOL_PAPER_HXX
26 
27 #include <sal/config.h>
28 
29 #include "i18npool/i18npooldllapi.h"
30 #include <rtl/string.hxx>
31 #include <com/sun/star/lang/Locale.hpp>
32 
33 //!! WARNING: be aware of cui/source/tabpages/page.h where someone had the broken idea
34 //!! of duplicating the values of this enum in order to use those defines within
35 //!! src files.
36 //!! Thus don't reorder the enum values here without changing the code there as well.
37 enum Paper
38 {
39 	PAPER_A0,
40 	PAPER_A1,
41 	PAPER_A2,
42 	PAPER_A3,
43 	PAPER_A4,
44 	PAPER_A5,
45 	PAPER_B4_ISO,
46 	PAPER_B5_ISO,
47 	PAPER_LETTER,
48 	PAPER_LEGAL,
49 	PAPER_TABLOID,
50 	PAPER_USER,
51 	PAPER_B6_ISO,
52 	PAPER_ENV_C4,
53 	PAPER_ENV_C5,
54 	PAPER_ENV_C6,
55 	PAPER_ENV_C65,
56 	PAPER_ENV_DL,
57 	PAPER_SLIDE_DIA,
58 	PAPER_SCREEN_4_BY_3,
59 	PAPER_C,
60 	PAPER_D,
61 	PAPER_E,
62 	PAPER_EXECUTIVE,
63 	PAPER_FANFOLD_LEGAL_DE,
64 	PAPER_ENV_MONARCH,
65 	PAPER_ENV_PERSONAL,
66 	PAPER_ENV_9,
67 	PAPER_ENV_10,
68 	PAPER_ENV_11,
69 	PAPER_ENV_12,
70 	PAPER_KAI16,
71 	PAPER_KAI32,
72 	PAPER_KAI32BIG,
73 	PAPER_B4_JIS,
74 	PAPER_B5_JIS,
75 	PAPER_B6_JIS,
76 	PAPER_LEDGER,
77 	PAPER_STATEMENT,
78 	PAPER_QUARTO,
79 	PAPER_10x14,
80 	PAPER_ENV_14,
81 	PAPER_ENV_C3,
82 	PAPER_ENV_ITALY,
83 	PAPER_FANFOLD_US,
84 	PAPER_FANFOLD_DE,
85 	PAPER_POSTCARD_JP,
86 	PAPER_9x11,
87 	PAPER_10x11,
88 	PAPER_15x11,
89 	PAPER_ENV_INVITE,
90 	PAPER_A_PLUS,
91 	PAPER_B_PLUS,
92 	PAPER_LETTER_PLUS,
93 	PAPER_A4_PLUS,
94 	PAPER_DOUBLEPOSTCARD_JP,
95 	PAPER_A6,
96 	PAPER_12x11,
97 	PAPER_A7,
98 	PAPER_A8,
99 	PAPER_A9,
100 	PAPER_A10,
101 	PAPER_B0_ISO,
102 	PAPER_B1_ISO,
103 	PAPER_B2_ISO,
104 	PAPER_B3_ISO,
105 	PAPER_B7_ISO,
106 	PAPER_B8_ISO,
107 	PAPER_B9_ISO,
108 	PAPER_B10_ISO,
109 	PAPER_ENV_C2,
110 	PAPER_ENV_C7,
111 	PAPER_ENV_C8,
112 	PAPER_ARCHA,
113 	PAPER_ARCHB,
114 	PAPER_ARCHC,
115 	PAPER_ARCHD,
116 	PAPER_ARCHE,
117 	PAPER_SCREEN_16_BY_9,
118 	PAPER_SCREEN_16_BY_10
119 };
120 
121 // defined for 'equal size' test with the implementation array
122 #define NUM_PAPER_ENTRIES	(PAPER_SCREEN_16_BY_10 - PAPER_A0 + 1)
123 
124 // Paper
125 
126 class I18NPOOL_DLLPUBLIC PaperInfo
127 {
128 	Paper m_eType;
129 	long m_nPaperWidth; // width in 100thMM
130 	long m_nPaperHeight; // height in 100thMM
131 public:
132 	PaperInfo(Paper eType);
133 	PaperInfo(long nPaperWidth, long nPaperHeight);
134 
getPaper() const135 	Paper getPaper() const { return m_eType; }
getWidth() const136 	long getWidth() const { return m_nPaperWidth; }
getHeight() const137 	long getHeight() const { return m_nPaperHeight; }
138 	bool sloppyEqual(const PaperInfo &rOther) const;
139 	bool doSloppyFit();
140 
141 	static PaperInfo getSystemDefaultPaper();
142 	static PaperInfo getDefaultPaperForLocale(const ::com::sun::star::lang::Locale & rLocale);
143 
144 	static Paper fromPSName(const rtl::OString &rName);
145 	static rtl::OString toPSName(Paper eType);
146 
147 	static long sloppyFitPageDimension(long nDimension);
148 };
149 
150 #endif // INCLUDED_I18NPOOL_PAPER_HXX
151