xref: /trunk/main/i18npool/source/paper/paper.cxx (revision 11774565)
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 Slide
91     { MM2MM100( 210),    MM2MM100( 280 ),    NULL,  NULL }, // Screen (4:3)
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     { MM2MM100( 157.5),  MM2MM100( 280 ),    NULL,  NULL }, // Screen (16:9)
155     { MM2MM100( 175),    MM2MM100( 280 ),    NULL,  NULL }  // Screen (16:10)
156 };
157 
158 static const size_t nTabSize = sizeof(aDinTab) / sizeof(aDinTab[0]);
159 
160 #define MAXSLOPPY 21
161 
doSloppyFit()162 bool PaperInfo::doSloppyFit()
163 {
164     if (m_eType != PAPER_USER)
165         return true;
166 
167     for ( size_t i = 0; i < nTabSize; ++i )
168     {
169         if (i == PAPER_USER) continue;
170 
171         long lDiffW = labs(aDinTab[i].m_nWidth - m_nPaperWidth);
172         long lDiffH = labs(aDinTab[i].m_nHeight - m_nPaperHeight);
173 
174         if ( lDiffW < MAXSLOPPY && lDiffH < MAXSLOPPY )
175         {
176             m_nPaperWidth = aDinTab[i].m_nWidth;
177             m_nPaperHeight = aDinTab[i].m_nHeight;
178             m_eType = (Paper)i;
179             return true;
180         }
181     }
182 
183     return false;
184 }
185 
sloppyEqual(const PaperInfo & rOther) const186 bool PaperInfo::sloppyEqual(const PaperInfo &rOther) const
187 {
188     return
189     (
190       (labs(m_nPaperWidth - rOther.m_nPaperWidth) < MAXSLOPPY) &&
191       (labs(m_nPaperHeight - rOther.m_nPaperHeight) < MAXSLOPPY)
192     );
193 }
194 
sloppyFitPageDimension(long nDimension)195 long PaperInfo::sloppyFitPageDimension(long nDimension)
196 {
197     for ( size_t i = 0; i < nTabSize; ++i )
198     {
199         if (i == PAPER_USER) continue;
200         long lDiff;
201 
202         lDiff = labs(aDinTab[i].m_nWidth - nDimension);
203         if ( lDiff < MAXSLOPPY )
204             return aDinTab[i].m_nWidth;
205 
206         lDiff = labs(aDinTab[i].m_nHeight - nDimension);
207         if ( lDiff < MAXSLOPPY )
208             return aDinTab[i].m_nHeight;
209     }
210     return nDimension;
211 }
212 
getSystemDefaultPaper()213 PaperInfo PaperInfo::getSystemDefaultPaper()
214 {
215     using ::com::sun::star::uno::Reference;
216     using ::com::sun::star::lang::XMultiServiceFactory;
217     using ::com::sun::star::uno::UNO_QUERY_THROW;
218     using ::com::sun::star::uno::Sequence;
219     using ::com::sun::star::uno::Any;
220     using ::com::sun::star::container::XNameAccess;
221     using ::com::sun::star::uno::Exception;
222 #   define CREATE_OUSTRING( ascii ) \
223         rtl::OUString::intern( RTL_CONSTASCII_USTRINGPARAM( ascii ) )
224 
225     rtl::OUString aLocaleStr;
226 
227     Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
228     Reference< XMultiServiceFactory > xConfigProv(
229         xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ),
230         UNO_QUERY_THROW );
231 
232     Sequence< Any > aArgs( 1 );
233     aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.Setup/L10N/" );
234     Reference< XNameAccess > xConfigNA( xConfigProv->createInstanceWithArguments(
235         CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW );
236     try
237     {
238         // try user-defined locale setting
239         xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= aLocaleStr;
240     }
241     catch( Exception& ) {}
242 
243 #ifdef UNX
244     // if set to "use system", get papersize from system
245     if (aLocaleStr.getLength() == 0)
246     {
247         static bool bInitialized = false;
248         static PaperInfo aInstance(PAPER_A4);
249 
250         if (bInitialized)
251             return aInstance;
252 
253         // try libpaper
254         // #i78617# workaround missing paperconf command
255         FILE* pPipe = popen( "sh -c paperconf 2>/dev/null", "r" );
256         if( pPipe )
257         {
258             Paper ePaper = PAPER_USER;
259 
260             char aBuffer[ 1024 ];
261             aBuffer[0] = 0;
262             char *pBuffer = fgets( aBuffer, sizeof(aBuffer), pPipe );
263             pclose( pPipe );
264 
265             if (pBuffer && *pBuffer != 0)
266             {
267                 rtl::OString aPaper(pBuffer);
268                 aPaper = aPaper.trim();
269                 static struct { const char *pName; Paper ePaper; } aCustoms [] =
270                 {
271                     { "B0",    PAPER_B0_ISO },
272                     { "B1",    PAPER_B1_ISO },
273                     { "B2",    PAPER_B2_ISO },
274                     { "B3",    PAPER_B3_ISO },
275                     { "B4",    PAPER_B4_ISO },
276                     { "B5",    PAPER_B5_ISO },
277                     { "B6",    PAPER_B6_ISO },
278                     { "B7",    PAPER_B7_ISO },
279                     { "B8",    PAPER_B8_ISO },
280                     { "B9",    PAPER_B9_ISO },
281                     { "B10",   PAPER_B10_ISO },
282                     { "folio", PAPER_FANFOLD_LEGAL_DE },
283                     { "flsa",  PAPER_FANFOLD_LEGAL_DE },
284                     { "flse",  PAPER_FANFOLD_LEGAL_DE }
285                 };
286 
287                 bool bHalve = false;
288 
289                 size_t nExtraTabSize = sizeof(aCustoms) / sizeof(aCustoms[0]);
290                 for (size_t i = 0; i < nExtraTabSize; ++i)
291                 {
292                     if (rtl_str_compareIgnoreAsciiCase(aCustoms[i].pName, aPaper.getStr()) == 0)
293                     {
294                         ePaper = aCustoms[i].ePaper;
295                         break;
296                     }
297                 }
298 
299                 if (ePaper == PAPER_USER)
300                 {
301                     bHalve = !rtl_str_shortenedCompareIgnoreAsciiCase_WithLength(
302                         aPaper.getStr(), aPaper.getLength(), "half", 4, 4);
303                     if (bHalve)
304                         aPaper = aPaper.copy(4);
305                     ePaper = PaperInfo::fromPSName(aPaper);
306                 }
307 
308                 if (ePaper != PAPER_USER)
309                 {
310                     aInstance = PaperInfo(ePaper);
311                     if (bHalve)
312                         aInstance = PaperInfo(aInstance.getHeight()/2, aInstance.getWidth());
313                     bInitialized = true;
314                     return aInstance;
315                 }
316             }
317         }
318 
319 #if defined(LC_PAPER) && defined(_GNU_SOURCE)
320 
321         union paperword { char *string; int word; };
322 
323         // try LC_PAPER
324         paperword w, h;
325         w.string = nl_langinfo(_NL_PAPER_WIDTH);
326         h.string = nl_langinfo(_NL_PAPER_HEIGHT);
327 
328         // glibc stores sizes as integer mm units
329         w.word *= 100;
330         h.word *= 100;
331 
332         for ( size_t i = 0; i < nTabSize; ++i )
333         {
334             if (i == PAPER_USER) continue;
335 
336             // glibc stores sizes as integer mm units, and so is inaccurate. To
337             // find a standard paper size we calculate the standard paper sizes
338             // into equally inaccurate mm and compare
339             long width = (aDinTab[i].m_nWidth + 50) / 100;
340             long height = (aDinTab[i].m_nHeight + 50) / 100;
341 
342             if (width == w.word/100 && height == h.word/100)
343             {
344                 w.word = aDinTab[i].m_nWidth;
345                 h.word = aDinTab[i].m_nHeight;
346                 break;
347             }
348         }
349 
350         aInstance = PaperInfo(w.word, h.word);
351         bInitialized = true;
352         return aInstance;
353 #endif
354     }
355 #endif
356 
357     try
358     {
359         // if set to "use system", try to get locale from system
360         if( aLocaleStr.getLength() == 0 )
361         {
362             aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.System/L10N/" );
363             xConfigNA.set( xConfigProv->createInstanceWithArguments(
364                 CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ),
365                 UNO_QUERY_THROW );
366             xConfigNA->getByName( CREATE_OUSTRING( "Locale" ) ) >>= aLocaleStr;
367         }
368     }
369     catch( Exception& ) {}
370 
371     if (aLocaleStr.getLength() == 0)
372         aLocaleStr = CREATE_OUSTRING("en-US");
373 
374     // convert locale string to locale struct
375     ::com::sun::star::lang::Locale aSysLocale;
376     sal_Int32 nDashPos = aLocaleStr.indexOf( '-' );
377     if( nDashPos < 0 ) nDashPos = aLocaleStr.getLength();
378     aSysLocale.Language = aLocaleStr.copy( 0, nDashPos );
379     if( nDashPos + 1 < aLocaleStr.getLength() )
380         aSysLocale.Country = aLocaleStr.copy( nDashPos + 1 );
381 
382     return PaperInfo::getDefaultPaperForLocale(aSysLocale);
383 }
384 
PaperInfo(Paper eType)385 PaperInfo::PaperInfo(Paper eType) : m_eType(eType)
386 {
387     OSL_ENSURE( sizeof(aDinTab) / sizeof(aDinTab[0]) == NUM_PAPER_ENTRIES,
388             "mismatch between array entries and enum values" );
389 
390     m_nPaperWidth = aDinTab[m_eType].m_nWidth;
391     m_nPaperHeight = aDinTab[m_eType].m_nHeight;
392 }
393 
PaperInfo(long nPaperWidth,long nPaperHeight)394 PaperInfo::PaperInfo(long nPaperWidth, long nPaperHeight)
395     : m_eType(PAPER_USER),
396       m_nPaperWidth(nPaperWidth),
397       m_nPaperHeight(nPaperHeight)
398 {
399     for ( size_t i = 0; i < nTabSize; ++i )
400     {
401         if (
402              (nPaperWidth == aDinTab[i].m_nWidth) &&
403              (nPaperHeight == aDinTab[i].m_nHeight)
404            )
405         {
406             m_eType = static_cast<Paper>(i);
407             break;
408         }
409     }
410 }
411 
toPSName(Paper ePaper)412 rtl::OString PaperInfo::toPSName(Paper ePaper)
413 {
414     return static_cast<size_t>(ePaper) < nTabSize ?
415         rtl::OString(aDinTab[ePaper].m_pPSName) : rtl::OString();
416 }
417 
fromPSName(const rtl::OString & rName)418 Paper PaperInfo::fromPSName(const rtl::OString &rName)
419 {
420     if (!rName.getLength())
421         return PAPER_USER;
422 
423     for ( size_t i = 0; i < nTabSize; ++i )
424     {
425         if (aDinTab[i].m_pPSName &&
426           !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pPSName, rName.getStr()))
427         {
428             return static_cast<Paper>(i);
429         }
430         else if (aDinTab[i].m_pAltPSName &&
431           !rtl_str_compareIgnoreAsciiCase(aDinTab[i].m_pAltPSName, rName.getStr()))
432         {
433             return static_cast<Paper>(i);
434         }
435     }
436 
437     return PAPER_USER;
438 }
439 
440 //https://wiki.openoffice.org/wiki/DefaultPaperSize
441 //http://www.unicode.org/cldr/data/charts/supplemental/territory_language_information.html
442 //http://sourceware.org/git/?p=glibc.git;a=tree;f=localedata/locales
443 //https://en.wikipedia.org/wiki/Paper_size
444 //http://msdn.microsoft.com/en-us/library/cc195164.aspx
getDefaultPaperForLocale(const::com::sun::star::lang::Locale & rLocale)445 PaperInfo PaperInfo::getDefaultPaperForLocale(
446     const ::com::sun::star::lang::Locale & rLocale)
447 {
448     Paper eType = PAPER_A4;
449 
450     if (
451         //United States, Letter
452         !rLocale.Country.compareToAscii("US") ||
453         //Puerto Rico:
454         //    http://unicode.org/cldr/trac/ticket/1710
455         //    http://sources.redhat.com/ml/libc-hacker/2001-07/msg00046.html
456         !rLocale.Country.compareToAscii("PR") ||
457         //Canada:
458         //    http://sources.redhat.com/ml/libc-hacker/2001-07/msg00053.html
459         !rLocale.Country.compareToAscii("CA") ||
460         //Venuzuela:
461         //    http://unicode.org/cldr/trac/ticket/1710
462         //    https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00019.html
463         !rLocale.Country.compareToAscii("VE") ||
464         //Chile:
465         //    http://unicode.org/cldr/trac/ticket/1710
466         //    https://www.redhat.com/archives/fedora-devel-list/2008-August/msg00240.html
467         !rLocale.Country.compareToAscii("CL") ||
468         //Mexico:
469         //    http://unicode.org/cldr/trac/ticket/1710
470         //    http://qa.openoffice.org/issues/show_bug.cgi?id=49739
471         !rLocale.Country.compareToAscii("MX") ||
472         //Colombia:
473         //    http://unicode.org/cldr/trac/ticket/1710
474         //    http://qa.openoffice.org/issues/show_bug.cgi?id=69703
475         !rLocale.Country.compareToAscii("CO") ||
476         //Philippines:
477         //    http://unicode.org/cldr/trac/ticket/1710
478         //    http://ubuntuliving.blogspot.com/2008/07/default-paper-size-in-evince.html
479         //    http://www.gov.ph/faqs/driverslicense.asp
480         !rLocale.Country.compareToAscii("PH") ||
481         //Belize:
482         //    http://unicode.org/cldr/trac/ticket/2585
483         //    http://www.belize.gov.bz/ct.asp?xItem=1666&ctNode=486&mp=27
484         !rLocale.Country.compareToAscii("BZ") ||
485         //Costa Rica:
486         //    http://unicode.org/cldr/trac/ticket/2585
487         //    http://sources.redhat.com/bugzilla/show_bug.cgi?id=11258
488         !rLocale.Country.compareToAscii("CR") ||
489         //Guatemala:
490         //    http://unicode.org/cldr/trac/ticket/2585
491         //    http://sources.redhat.com/bugzilla/show_bug.cgi?id=10936
492         !rLocale.Country.compareToAscii("GT") ||
493         //Nicaragua:
494         //    http://unicode.org/cldr/trac/ticket/2585
495         !rLocale.Country.compareToAscii("NI") ||
496         //Panama:
497         //    http://unicode.org/cldr/trac/ticket/2585
498         //    http://www.minsa.gob.pa/minsa/tl_files/documents/baner_informativo/INSTRUMENTO%20DE%20INVESTIGACION%20DE%20RAAV%202009.pdf
499         !rLocale.Country.compareToAscii("PA") ||
500         //El Salvador:
501         //    http://unicode.org/cldr/trac/ticket/2585
502         //    http://www.tse.gob.sv
503         !rLocale.Country.compareToAscii("SV")
504        )
505     {
506         eType = PAPER_LETTER;
507     }
508 
509     return eType;
510 }
511 
512 /* vim: set noet sw=4 ts=4: */
513