LCOV - code coverage report
Current view: top level - i18nutil/source/utility - paper.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 131 0.0 %
Date: 2014-04-14 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10