xref: /aoo41x/main/i18npool/source/paper/paper.cxx (revision 449ab281)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_i18npool.hxx"
26 
27 #include <osl/diagnose.h>
28 #include <sal/config.h>
29 #include <rtl/ustring.hxx>
30 #include <rtl/string.hxx>
31 #include <comphelper/processfactory.hxx>
32 #include <com/sun/star/i18n/ScriptType.hpp>
33 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
34 #include <com/sun/star/container/XNameAccess.hpp>
35 
36 #include "i18npool/mslangid.hxx"
37 #include "i18npool/paper.hxx"
38 
39 #include <utility>
40 #include <cstdlib>
41 
42 #ifdef UNX
43 #include <stdio.h>
44 #include <string.h>
45 #include <locale.h>
46 #include <langinfo.h>
47 #endif
48 
49 struct PageDesc
50 {
51     long m_nWidth;
52     long m_nHeight;
53     const char *m_pPSName;
54     const char *m_pAltPSName;
55 };
56 
57 #define PT2MM100( v ) \
58     (long)(((v) * 35.27777778) + 0.5)
59 
60 #define IN2MM100( v ) \
61     ((long)(((v) * 2540) + 0.5))
62 
63 #define MM2MM100( v ) \
64     ((long)((v) * 100))
65 
66 //PostScript Printer Description File Format Specification
67 //http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
68 //http://www.y-adagio.com/public/committees/docsii/doc_00-49/symp_ulaan/china_ppr.pdf (Kai)
69 //http://www.sls.psi.ch/controls/help/howto/Howto_Print_a_A0_Poster_at_WSLA_012_2.pdf (Dia)
70 static PageDesc aDinTab[] =
71 {
72     { MM2MM100( 841 ),   MM2MM100( 1189 ),   "A0",  NULL },
73     { MM2MM100( 594 ),   MM2MM100( 841 ),    "A1",  NULL },
74     { MM2MM100( 420 ),   MM2MM100( 594 ),    "A2",  NULL },
75     { MM2MM100( 297 ),   MM2MM100( 420 ),    "A3",  NULL },
76     { MM2MM100( 210 ),   MM2MM100( 297 ),    "A4",  NULL },
77     { MM2MM100( 148 ),   MM2MM100( 210 ),    "A5",  NULL },
78     { MM2MM100( 250 ),   MM2MM100( 353 ),    "ISOB4",  NULL },
79     { MM2MM100( 176 ),   MM2MM100( 250 ),    "ISOB5",  NULL },
80     { IN2MM100( 8.5 ),   IN2MM100( 11 ),     "Letter",  "Note" },
81     { IN2MM100( 8.5 ),   IN2MM100( 14 ),     "Legal",  NULL },
82     { IN2MM100( 11 ),    IN2MM100( 17 ),     "Tabloid",  "11x17" },
83     { 0,                 0,                  NULL, NULL }, //User
84     { MM2MM100( 125 ),   MM2MM100( 176 ),    "ISOB6",  NULL },
85     { MM2MM100( 229 ),   MM2MM100( 324 ),    "EnvC4",  "C4" },
86     { MM2MM100( 162 ),   MM2MM100( 229 ),    "EnvC5",  "C5" },
87     { MM2MM100( 114 ),   MM2MM100( 162 ),    "EnvC6",  "C6" },
88     { MM2MM100( 114 ),   MM2MM100( 229 ),    "EnvC65", NULL },
89     { MM2MM100( 110 ),   MM2MM100( 220 ),    "EnvDL",  "DL" },
90     { MM2MM100( 180),    MM2MM100( 270 ),    NULL,  NULL }, //Dia
91     { MM2MM100( 210),    MM2MM100( 280 ),    NULL,  NULL }, //Screen
92     { IN2MM100( 17 ),    IN2MM100( 22 ),     "AnsiC",  "CSheet" },
93     { IN2MM100( 22 ),    IN2MM100( 34 ),     "AnsiD",  "DSheet" },
94     { IN2MM100( 34 ),    IN2MM100( 44 ),     "AnsiE",  "ESheet" },
95     { IN2MM100( 7.25 ),  IN2MM100( 10.5 ),   "Executive",  NULL },
96     //"Folio" is a different size in the PPD documentation than 8.5x11
97     //This "FanFoldGermanLegal" is known in the Philippines as
98     //"Legal" paper or "Long Bond Paper".  The "Legal" name causing untold
99     //misery, given the differently sized US "Legal" paper
100     { IN2MM100( 8.5 ),   IN2MM100( 13 ),     "FanFoldGermanLegal",  NULL },
101     { IN2MM100( 3.875 ), IN2MM100( 7.5 ),    "EnvMonarch", "Monarch" },
102     { IN2MM100( 3.625 ), IN2MM100( 6.5 ),    "EnvPersonal",  "Personal" },
103     { IN2MM100( 3.875 ), IN2MM100( 8.875 ),  "Env9",  NULL },
104     { IN2MM100( 4.125 ), IN2MM100( 9.5 ),    "Env10",  "Comm10" },
105     { IN2MM100( 4.5 ),   IN2MM100( 10.375 ), "Env11",  NULL },
106     { IN2MM100( 4.75 ),  IN2MM100( 11 ),     "Env12",  NULL },
107     { MM2MM100( 184 ),   MM2MM100( 260 ),    NULL,  NULL }, //Kai16
108     { MM2MM100( 130 ),   MM2MM100( 184 ),    NULL,  NULL }, //Kai32
109     { MM2MM100( 140 ),   MM2MM100( 203 ),    NULL,  NULL }, //BigKai32
110     { MM2MM100( 257 ),   MM2MM100( 364 ),    "B4",  NULL }, //JIS
111     { MM2MM100( 182 ),   MM2MM100( 257 ),    "B5",  NULL }, //JIS
112     { MM2MM100( 128 ),   MM2MM100( 182 ),    "B6",  NULL }, //JIS
113     { IN2MM100( 17 ),    IN2MM100( 11 ),     "Ledger",  NULL },
114     { IN2MM100( 5.5 ),   IN2MM100( 8.5 ),    "Statement",  NULL },
115     { PT2MM100( 610 ),   PT2MM100( 780 ),    "Quarto",  NULL },
116     { IN2MM100( 10 ),    IN2MM100( 14 ),     "10x14",  NULL },
117     { IN2MM100( 5.5 ),   IN2MM100( 11.5 ),   "Env14",  NULL },
118     { MM2MM100( 324 ),   MM2MM100( 458 ),    "EnvC3",  "C3" },
119     { MM2MM100( 110 ),   MM2MM100( 230 ),    "EnvItalian",  NULL },
120     { IN2MM100( 14.875 ),IN2MM100( 11 ),     "FanFoldUS",  NULL },
121     { IN2MM100( 8.5 ),   IN2MM100( 13 ),     "FanFoldGerman",  NULL },
122     { MM2MM100( 100 ),   MM2MM100( 148 ),    "Postcard",  NULL },
123     { IN2MM100( 9 ),     IN2MM100( 11 ),     "9x11",  NULL },
124     { IN2MM100( 10 ),    IN2MM100( 11 ),     "10x11",  NULL },
125     { IN2MM100( 15 ),    IN2MM100( 11 ),     "15x11",  NULL },
126     { MM2MM100( 220 ),   MM2MM100( 220 ),    "EnvInvite",  NULL },
127     { MM2MM100( 227 ),   MM2MM100( 356 ),    "SuperA",  NULL },
128     { MM2MM100( 305 ),   MM2MM100( 487 ),    "SuperB",  NULL },
129     { IN2MM100( 8.5 ),   IN2MM100( 12.69 ),  "LetterPlus",  NULL },
130     { MM2MM100( 210 ),   MM2MM100( 330 ),    "A4Plus",  NULL },
131     { MM2MM100( 200 ),   MM2MM100( 148 ),    "DoublePostcard",  NULL },
132     { MM2MM100( 105 ),   MM2MM100( 148 ),    "A6",  NULL },
133     { IN2MM100( 12 ),    IN2MM100( 11 ),     "12x11",  NULL },
134     { MM2MM100( 74 ),    MM2MM100( 105 ),    "A7",  NULL },
135     { MM2MM100( 52 ),    MM2MM100( 74 ),     "A8",  NULL },
136     { MM2MM100( 37 ),    MM2MM100( 52 ),     "A9",  NULL },
137     { MM2MM100( 26 ),    MM2MM100( 37 ),     "A10",  NULL },
138     { MM2MM100( 1000 ),  MM2MM100( 1414 ),   "ISOB0",  NULL },
139     { MM2MM100( 707 ),   MM2MM100( 1000 ),   "ISOB1",  NULL },
140     { MM2MM100( 500 ),   MM2MM100( 707 ),    "ISOB2",  NULL },
141     { MM2MM100( 353 ),   MM2MM100( 500 ),    "ISOB3",  NULL },
142     { MM2MM100( 88 ),    MM2MM100( 125 ),    "ISOB7",  NULL },
143     { MM2MM100( 62 ),    MM2MM100( 88 ),     "ISOB8",  NULL },
144     { MM2MM100( 44 ),    MM2MM100( 62 ),     "ISOB9",  NULL },
145     { MM2MM100( 31 ),    MM2MM100( 44 ),     "ISOB10", NULL },
146     { MM2MM100( 458 ),   MM2MM100( 648 ),    "EnvC2",  "C2" },
147     { MM2MM100( 81 ),    MM2MM100( 114 ),    "EnvC7",  "C7" },
148     { MM2MM100( 57 ),    MM2MM100( 81 ),     "EnvC8",  "C8" },
149     { IN2MM100( 9 ),     IN2MM100( 12 ),     "ARCHA",  NULL },
150     { IN2MM100( 12 ),    IN2MM100( 18 ),     "ARCHB",  NULL },
151     { IN2MM100( 18 ),    IN2MM100( 24 ),     "ARCHC",  NULL },
152     { IN2MM100( 24 ),    IN2MM100( 36 ),     "ARCHD",  NULL },
153     { IN2MM100( 36 ),    IN2MM100( 48 ),     "ARCHE",  NULL }
154 };
155 
156 static const size_t nTabSize = sizeof(aDinTab) / sizeof(aDinTab[0]);
157 
158 #define MAXSLOPPY 21
159 
doSloppyFit()160 bool PaperInfo::doSloppyFit()
161 {
162     if (m_eType != PAPER_USER)
163         return true;
164 
165     for ( size_t i = 0; i < nTabSize; ++i )
166     {
167         if (i == PAPER_USER) continue;
168 
169         long lDiffW = labs(aDinTab[i].m_nWidth - m_nPaperWidth);
170         long lDiffH = labs(aDinTab[i].m_nHeight - m_nPaperHeight);
171 
172         if ( lDiffW < MAXSLOPPY && lDiffH < MAXSLOPPY )
173         {
174             m_nPaperWidth = aDinTab[i].m_nWidth;
175             m_nPaperHeight = aDinTab[i].m_nHeight;
176             m_eType = (Paper)i;
177             return true;
178         }
179     }
180 
181     return false;
182 }
183 
sloppyEqual(const PaperInfo & rOther) const184 bool PaperInfo::sloppyEqual(const PaperInfo &rOther) const
185 {
186     return
187     (
188       (labs(m_nPaperWidth - rOther.m_nPaperWidth) < MAXSLOPPY) &&
189       (labs(m_nPaperHeight - rOther.m_nPaperHeight) < MAXSLOPPY)
190     );
191 }
192 
sloppyFitPageDimension(long nDimension)193 long PaperInfo::sloppyFitPageDimension(long nDimension)
194 {
195     for ( size_t i = 0; i < nTabSize; ++i )
196     {
197         if (i == PAPER_USER) continue;
198         long lDiff;
199 
200         lDiff = labs(aDinTab[i].m_nWidth - nDimension);
201         if ( lDiff < MAXSLOPPY )
202             return aDinTab[i].m_nWidth;
203 
204         lDiff = labs(aDinTab[i].m_nHeight - nDimension);
205         if ( lDiff < MAXSLOPPY )
206             return aDinTab[i].m_nHeight;
207     }
208     return nDimension;
209 }
210 
getSystemDefaultPaper()211 PaperInfo PaperInfo::getSystemDefaultPaper()
212 {
213     using ::com::sun::star::uno::Reference;
214     using ::com::sun::star::lang::XMultiServiceFactory;
215     using ::com::sun::star::uno::UNO_QUERY_THROW;
216     using ::com::sun::star::uno::Sequence;
217     using ::com::sun::star::uno::Any;
218     using ::com::sun::star::container::XNameAccess;
219     using ::com::sun::star::uno::Exception;
220 #   define CREATE_OUSTRING( ascii ) \
221         rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
222 
223     rtl::OUString aLocaleStr;
224 
225     Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
226     Reference< XMultiServiceFactory > xConfigProv(
227         xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ),
228         UNO_QUERY_THROW );
229 
230     Sequence< Any > aArgs( 1 );
231     aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.Setup/L10N/" );
232     Reference< XNameAccess > xConfigNA( xConfigProv->createInstanceWithArguments(
233         CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW );
234     try
235     {
236         // try user-defined locale setting
237         xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= aLocaleStr;
238     }
239     catch( Exception& ) {}
240 
241 #ifdef UNX
242     // if set to "use system", get papersize from system
243     if (aLocaleStr.getLength() == 0)
244     {
245         static bool bInitialized = false;
246         static PaperInfo aInstance(PAPER_A4);
247 
248         if (bInitialized)
249             return aInstance;
250 
251         // try libpaper
252         // #i78617# workaround missing paperconf command
253         FILE* pPipe = popen( "sh -c paperconf 2>/dev/null", "r" );
254         if( pPipe )
255         {
256             Paper ePaper = PAPER_USER;
257 
258             char aBuffer[ 1024 ];
259             aBuffer[0] = 0;
260             char *pBuffer = fgets( aBuffer, sizeof(aBuffer), pPipe );
261             pclose( pPipe );
262 
263             if (pBuffer && *pBuffer != 0)
264             {
265                 rtl::OString aPaper(pBuffer);
266                 aPaper = aPaper.trim();
267                 static struct { const char *pName; Paper ePaper; } aCustoms [] =
268                 {
269                     { "B0",   PAPER_B0_ISO },
270                     { "B1",   PAPER_B1_ISO },
271                     { "B2",   PAPER_B2_ISO },
272                     { "B3",   PAPER_B3_ISO },
273                     { "B4",   PAPER_B4_ISO },
274                     { "B5",   PAPER_B5_ISO },
275                     { "B6",   PAPER_B6_ISO },
276                     { "B7",   PAPER_B7_ISO },
277                     { "B8",   PAPER_B8_ISO },
278                     { "B9",   PAPER_B9_ISO },
279                     { "B10",  PAPER_B10_ISO },
280                     { "folio", PAPER_FANFOLD_LEGAL_DE },
281                     { "flsa",  PAPER_FANFOLD_LEGAL_DE },
282                     { "flse",  PAPER_FANFOLD_LEGAL_DE }
283                 };
284 
285                 bool bHalve = false;
286 
287                 size_t nExtraTabSize = sizeof(aCustoms) / sizeof(aCustoms[0]);
288                 for (size_t i = 0; i < nExtraTabSize; ++i)
289                 {
290                     if (rtl_str_compareIgnoreAsciiCase(aCustoms[i].pName, aPaper.getStr()) == 0)
291                     {
292                         ePaper = aCustoms[i].ePaper;
293                         break;
294                     }
295                 }
296 
297                 if (ePaper == PAPER_USER)
298                 {
299                     bHalve = !rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
300                         aPaper.getStr(), aPaper.getLength(),  "half", 4, 4);
301                     if (bHalve)
302                         aPaper = aPaper.copy(4);
303                     ePaper = PaperInfo::fromPSName(aPaper);
304                 }
305 
306                 if (ePaper != PAPER_USER)
307                 {
308                     aInstance = PaperInfo(ePaper);
309                     if (bHalve)
310                         aInstance = PaperInfo(aInstance.getHeight()/2, aInstance.getWidth());
311                     bInitialized = true;
312                     return aInstance;
313                 }
314             }
315         }
316 
317 #if defined(LC_PAPER) && defined(_GNU_SOURCE)
318 
319         union paperword { char *string; int word; };
320 
321         // try LC_PAPER
322         paperword w, h;
323         w.string = nl_langinfo(_NL_PAPER_WIDTH);
324         h.string = nl_langinfo(_NL_PAPER_HEIGHT);
325 
326         //glibc stores sizes as integer mm units
327         w.word *= 100;
328         h.word *= 100;
329 
330         for ( size_t i = 0; i < nTabSize; ++i )
331         {
332             if (i == PAPER_USER) continue;
333 
334             //glibc stores sizes as integer mm units, and so is inaccurate. To
335             //find a standard paper size we calculate the standard paper sizes
336             //into equally inaccurate mm and compare
337             long width = (aDinTab[i].m_nWidth + 50) / 100;
338             long height = (aDinTab[i].m_nHeight + 50) / 100;
339 
340             if (width == w.word/100 && height == h.word/100)
341             {
342                 w.word = aDinTab[i].m_nWidth;
343                 h.word = aDinTab[i].m_nHeight;
344                 break;
345             }
346         }
347 
348         aInstance = PaperInfo(w.word, h.word);
349         bInitialized = true;
350         return aInstance;
351 #endif
352     }
353 #endif
354 
355     try
356     {
357         // if set to "use system", try to get locale from system
358         if( aLocaleStr.getLength() == 0 )
359         {
360             aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.System/L10N/" );
361             xConfigNA.set( xConfigProv->createInstanceWithArguments(
362                 CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ),
363                 UNO_QUERY_THROW );
364             xConfigNA->getByName( CREATE_OUSTRING( "Locale" ) ) >>= aLocaleStr;
365         }
366     }
367     catch( Exception& ) {}
368 
369     if (aLocaleStr.getLength() == 0)
370         aLocaleStr = CREATE_OUSTRING("en-US");
371 
372     // convert locale string to locale struct
373     ::com::sun::star::lang::Locale aSysLocale;
374     sal_Int32 nDashPos = aLocaleStr.indexOf( '-' );
375     if( nDashPos < 0 ) nDashPos = aLocaleStr.getLength();
376     aSysLocale.Language = aLocaleStr.copy( 0, nDashPos );
377     if( nDashPos + 1 < aLocaleStr.getLength() )
378         aSysLocale.Country = aLocaleStr.copy( nDashPos + 1 );
379 
380     return PaperInfo::getDefaultPaperForLocale(aSysLocale);
381 }
382 
PaperInfo(Paper eType)383 PaperInfo::PaperInfo(Paper eType) : m_eType(eType)
384 {
385     OSL_ENSURE( sizeof(aDinTab) / sizeof(aDinTab[0]) == NUM_PAPER_ENTRIES,
386             "mismatch between array entries and enum values" );
387 
388     m_nPaperWidth = aDinTab[m_eType].m_nWidth;
389     m_nPaperHeight = aDinTab[m_eType].m_nHeight;
390 }
391 
PaperInfo(long nPaperWidth,long nPaperHeight)392 PaperInfo::PaperInfo(long nPaperWidth, long nPaperHeight)
393     : m_eType(PAPER_USER),
394       m_nPaperWidth(nPaperWidth),
395       m_nPaperHeight(nPaperHeight)
396 {
397     for ( size_t i = 0; i < nTabSize; ++i )
398     {
399         if (
400              (nPaperWidth == aDinTab[i].m_nWidth) &&
401              (nPaperHeight == aDinTab[i].m_nHeight)
402            )
403         {
404             m_eType = static_cast<Paper>(i);
405             break;
406         }
407     }
408 }
409 
toPSName(Paper ePaper)410 rtl::OString PaperInfo::toPSName(Paper ePaper)
411 {
412     return static_cast<size_t>(ePaper) < nTabSize ?
413         rtl::OString(aDinTab[ePaper].m_pPSName) : rtl::OString();
414 }
415 
fromPSName(const rtl::OString & rName)416 Paper PaperInfo::fromPSName(const rtl::OString &rName)
417 {
418     if (!rName.getLength())
419         return PAPER_USER;
420 
421     for ( size_t i = 0; i < nTabSize; ++i )
422     {
423         if (aDinTab[i].m_pPSName &&
424           !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pPSName, rName.getStr()))
425         {
426             return static_cast<Paper>(i);
427         }
428         else if (aDinTab[i].m_pAltPSName &&
429           !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pAltPSName, rName.getStr()))
430         {
431             return static_cast<Paper>(i);
432         }
433     }
434 
435     return PAPER_USER;
436 }
437 
438 //http://wiki.services.openoffice.org/wiki/DefaultPaperSize
439 //http://www.unicode.org/cldr/data/charts/supplemental/territory_language_information.html
440 //http://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales
441 //http://en.wikipedia.org/wiki/Paper_size
442 //http://msdn.microsoft.com/en-us/library/cc195164.aspx
getDefaultPaperForLocale(const::com::sun::star::lang::Locale & rLocale)443 PaperInfo PaperInfo::getDefaultPaperForLocale(
444     const ::com::sun::star::lang::Locale & rLocale)
445 {
446     Paper eType = PAPER_A4;
447 
448     if (
449         //United States, Letter
450         !rLocale.Country.compareToAscii("US") ||
451         //Puerto Rico:
452         //    http://unicode.org/cldr/trac/ticket/1710
453         //    http://sources.redhat.com/ml/libc-hacker/2001-07/msg00046.html
454         !rLocale.Country.compareToAscii("PR") ||
455         //Canada:
456         //    http://sources.redhat.com/ml/libc-hacker/2001-07/msg00053.html
457         !rLocale.Country.compareToAscii("CA") ||
458         //Venuzuela:
459         //    http://unicode.org/cldr/trac/ticket/1710
460         //    https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00019.html
461         !rLocale.Country.compareToAscii("VE") ||
462         //Chile:
463         //    http://unicode.org/cldr/trac/ticket/1710
464         //    https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00240.html
465         !rLocale.Country.compareToAscii("CL") ||
466         //Mexico:
467         //    http://unicode.org/cldr/trac/ticket/1710
468         //    http://qa.openoffice.org/issues/show_bug.cgi?id=49739
469         !rLocale.Country.compareToAscii("MX") ||
470         //Colombia:
471         //    http://unicode.org/cldr/trac/ticket/1710
472         //    http://qa.openoffice.org/issues/show_bug.cgi?id=69703
473         !rLocale.Country.compareToAscii("CO") ||
474         //Philippines:
475         //    http://unicode.org/cldr/trac/ticket/1710
476         //    http://ubuntuliving.blogspot.com/2008/07/default-paper-size-in-evince.html
477         //    http://www.gov.ph/faqs/driverslicense.asp
478         !rLocale.Country.compareToAscii("PH") ||
479         //Belize:
480         //    http://unicode.org/cldr/trac/ticket/2585
481         //    http://www.belize.gov.bz/ct.asp?xItem=1666&ctNode=486&mp=27
482         !rLocale.Country.compareToAscii("BZ") ||
483         //Costa Rica:
484         //    http://unicode.org/cldr/trac/ticket/2585
485         //    http://sources.redhat.com/bugzilla/show_bug.cgi?id=11258
486         !rLocale.Country.compareToAscii("CR") ||
487         //Guatemala:
488         //    http://unicode.org/cldr/trac/ticket/2585
489         //    http://sources.redhat.com/bugzilla/show_bug.cgi?id=10936
490         !rLocale.Country.compareToAscii("GT") ||
491         //Nicaragua:
492         //    http://unicode.org/cldr/trac/ticket/2585
493         !rLocale.Country.compareToAscii("NI") ||
494         //Panama:
495         //    http://unicode.org/cldr/trac/ticket/2585
496         //    http://www.minsa.gob.pa/minsa/tl_files/documents/baner_informativo/INSTRUMENTO%20DE%20INVESTIGACION%20DE%20RAAV%202009.pdf
497         !rLocale.Country.compareToAscii("PA") ||
498         //El Salvador:
499         //    http://unicode.org/cldr/trac/ticket/2585
500         //    http://www.tse.gob.sv
501         !rLocale.Country.compareToAscii("SV")
502        )
503     {
504         eType = PAPER_LETTER;
505     }
506 
507     return eType;
508 }
509 
510 /* vi:set tabstop=4 shiftwidth=4 expandtab: */
511