LCOV - code coverage report
Current view: directory - widget/gtk2 - nsPaperPS.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 8 2 25.0 %
Date: 2012-06-02 Functions: 4 2 50.0 %

       1                 : /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 : /* ex: set tabstop=8 softtabstop=4 shiftwidth=4 expandtab: */
       3                 : /* ***** BEGIN LICENSE BLOCK *****
       4                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       5                 :  *
       6                 :  * The contents of this file are subject to the Mozilla Public License Version
       7                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       8                 :  * the License. You may obtain a copy of the License at
       9                 :  * http://www.mozilla.org/MPL/
      10                 :  *
      11                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      12                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      13                 :  * for the specific language governing rights and limitations under the
      14                 :  * License.
      15                 :  *
      16                 :  * The Original Code is developed for mozilla. The tables of paper sizes
      17                 :  * and paper orientations are based on tables from nsPostScriptObj.h.
      18                 :  *
      19                 :  * The Initial Developer of the Original Code is
      20                 :  * Kenneth Herron <kherron@newsguy.com>.
      21                 :  * Portions created by the Initial Developer are Copyright (C) 2004
      22                 :  * the Initial Developer. All Rights Reserved.
      23                 :  *
      24                 :  * Contributor(s):
      25                 :  *
      26                 :  * Alternatively, the contents of this file may be used under the terms of
      27                 :  * either the GNU General Public License Version 2 or later (the "GPL"), or
      28                 :  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      29                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      30                 :  * of those above. If you wish to allow use of your version of this file only
      31                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      32                 :  * use your version of this file under the terms of the MPL, indicate your
      33                 :  * decision by deleting the provisions above and replace them with the notice
      34                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      35                 :  * the provisions above, a recipient may use your version of this file under
      36                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      37                 :  *
      38                 :  * ***** END LICENSE BLOCK ***** */
      39                 : 
      40                 : #include "mozilla/Util.h"
      41                 :  
      42                 : #include "nsPaperPS.h"
      43                 : #include "plstr.h"
      44                 : #include "nsCoord.h"
      45                 : #include "nsMemory.h"
      46                 : 
      47                 : using namespace mozilla;
      48                 : 
      49                 : const nsPaperSizePS_ nsPaperSizePS::mList[] =
      50                 : {
      51                 : #define SIZE_MM(x)      (x)
      52                 : #define SIZE_INCH(x)    ((x) * MM_PER_INCH_FLOAT)
      53                 :     { "A5",             SIZE_MM(148),   SIZE_MM(210),   true },
      54                 :     { "A4",             SIZE_MM(210),   SIZE_MM(297),   true },
      55                 :     { "A3",             SIZE_MM(297),   SIZE_MM(420),   true },
      56                 :     { "Letter",         SIZE_INCH(8.5), SIZE_INCH(11),  false },
      57                 :     { "Legal",          SIZE_INCH(8.5), SIZE_INCH(14),  false },
      58                 :     { "Tabloid",        SIZE_INCH(11),  SIZE_INCH(17),  false },
      59                 :     { "Executive",      SIZE_INCH(7.5), SIZE_INCH(10),  false },
      60                 : #undef SIZE_INCH
      61                 : #undef SIZE_MM
      62                 : };
      63                 : 
      64            1464 : const unsigned int nsPaperSizePS::mCount = ArrayLength(mList);
      65                 : 
      66                 : bool
      67               0 : nsPaperSizePS::Find(const char *aName)
      68                 : {
      69               0 :     for (int i = mCount; i--; ) {
      70               0 :         if (!PL_strcasecmp(aName, mList[i].name)) {
      71               0 :             mCurrent = i;
      72               0 :             return true;
      73                 :         }
      74                 :     }
      75               0 :     return false;
      76            4392 : }

Generated by: LCOV version 1.7