]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/paper.cpp
fix also wxPen to use wxPenStyle,wxPenJoin,wxPenCap enums instead of plain int; remov...
[wxWidgets.git] / src / common / paper.cpp
index e02dcdc39fbf5d3062952ce0ebf63755f513928b..bc29b2acc19093209c3a116d643165ffa43f33b2 100644 (file)
@@ -1,55 +1,47 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        paper.cpp
+// Name:        src/common/paper.cpp
 // Purpose:     Paper size classes
-// Author:      Julian Smart 
+// Author:      Julian Smart
 // Modified by:
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
-// Licence:    wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "paper.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-#pragma hdrstop
+    #pragma hdrstop
 #endif
 
-#include "wx/defs.h"
-
 #if wxUSE_PRINTING_ARCHITECTURE
 
-
 #ifndef WX_PRECOMP
-#include "wx/utils.h"
-#include "wx/settings.h"
-#include "wx/intl.h"
+    #if defined(__WXMSW__)
+        #include "wx/msw/wrapcdlg.h"
+    #endif // MSW
+    #include "wx/utils.h"
+    #include "wx/settings.h"
+    #include "wx/intl.h"
+    #include "wx/module.h"
 #endif
 
 #include "wx/paper.h"
-#include "wx/module.h"
 
 #include <stdlib.h>
 #include <string.h>
 
 #ifdef __WXMSW__
-#include <windows.h>
-#include <commdlg.h>
-
-#ifndef __WIN32__
-#include <print.h>
-#endif
-
+    #ifndef __WIN32__
+        #include <print.h>
+    #endif
 #endif
  // End __WXMSW__
 
 IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
+// IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
 
 /*
  * Paper size database for all platforms
@@ -59,7 +51,7 @@ wxPrintPaperType::wxPrintPaperType()
 {
     m_paperId = wxPAPER_NONE;
     m_platformId = 0;
-    m_paperName = wxT("");
+    m_paperName = wxEmptyString;
     m_width = 0;
     m_height = 0;
 }
@@ -83,22 +75,25 @@ wxSize wxPrintPaperType::GetSizeDeviceUnits() const
  * Print paper database for PostScript
  */
 
+WX_DECLARE_LIST(wxPrintPaperType, wxPrintPaperTypeList);
+#include "wx/listimpl.cpp"
+WX_DEFINE_LIST(wxPrintPaperTypeList)
+
 wxPrintPaperDatabase* wxThePrintPaperDatabase = (wxPrintPaperDatabase*) NULL;
 
-wxPrintPaperDatabase::wxPrintPaperDatabase():wxList(wxKEY_STRING)
+wxPrintPaperDatabase::wxPrintPaperDatabase()
 {
-    DeleteContents(TRUE);
+    m_map = new wxStringToPrintPaperTypeHashMap;
+    m_list = new wxPrintPaperTypeList;
 }
 
-void wxPrintPaperDatabase::CreateDatabase()
+wxPrintPaperDatabase::~wxPrintPaperDatabase()
 {
-/*
-  AddPaperType(wxTRANSLATE("A4 210 x 297 mm"), 210, 297);
-  AddPaperType(wxTRANSLATE("A3 297 x 420 mm"), 297, 420);
-  AddPaperType(wxTRANSLATE("Letter 8 1/2 x 11 in"), 216, 279);
-  AddPaperType(wxTRANSLATE("Legal 8 1/2 x 14 in"), 216, 356);
-*/
+    ClearDatabase();
+}
 
+void wxPrintPaperDatabase::CreateDatabase()
+{
     WXADDPAPER(wxPAPER_LETTER,             DMPAPER_LETTER,             wxTRANSLATE("Letter, 8 1/2 x 11 in"), 2159, 2794);
     WXADDPAPER(wxPAPER_LEGAL,              DMPAPER_LEGAL,              wxTRANSLATE("Legal, 8 1/2 x 14 in"), 2159, 3556);
     WXADDPAPER(wxPAPER_A4,                 DMPAPER_A4,                 wxTRANSLATE("A4 sheet, 210 x 297 mm"), 2100, 2970);
@@ -141,100 +136,155 @@ void wxPrintPaperDatabase::CreateDatabase()
     WXADDPAPER(wxPAPER_FANFOLD_STD_GERMAN, DMPAPER_FANFOLD_STD_GERMAN, wxTRANSLATE("German Std Fanfold, 8 1/2 x 12 in"), 2159, 3048);
     WXADDPAPER(wxPAPER_FANFOLD_LGL_GERMAN, DMPAPER_FANFOLD_LGL_GERMAN, wxTRANSLATE("German Legal Fanfold, 8 1/2 x 13 in"), 2159, 3302);
 
-/* Another time!
-#ifdef __WIN95__
-    WXADDPAPER(wxPAPER_ISO_B4,             DMPAPER_ISO_B4,             "B4 (ISO) 250 x 353 mm",
-    WXADDPAPER(wxPAPER_JAPANESE_POSTCARD,  DMPAPER_JAPANESE_POSTCARD,  "Japanese Postcard 100 x 148 mm",
-    WXADDPAPER(wxPAPER_9X11,               DMPAPER_9X11,               "9 x 11 in",
-    WXADDPAPER(wxPAPER_10X11,              DMPAPER_10X11,              "10 x 11 in",
-    WXADDPAPER(wxPAPER_15X11,              DMPAPER_15X11,              "15 x 11 in",
-    WXADDPAPER(wxPAPER_ENV_INVITE,         DMPAPER_ENV_INVITE,         "Envelope Invite 220 x 220 mm",
-    // What does \275 mean?
-//    WXADDPAPER(wxPAPER_LETTER_EXTRA,       DMPAPER_LETTER_EXTRA,       "Letter Extra 9 \275 x 12 in",
-//    WXADDPAPER(wxPAPER_LEGAL_EXTRA,        DMPAPER_LEGAL_EXTRA,        "Legal Extra 9 \275 x 15 in",
-    WXADDPAPER(wxPAPER_TABLOID_EXTRA,      DMPAPER_TABLOID_EXTRA,      "Tabloid Extra 11.69 x 18 in",
-    WXADDPAPER(wxPAPER_A4_EXTRA,           DMPAPER_A4_EXTRA,           "A4 Extra 9.27 x 12.69 in",
-//    WXADDPAPER(wxPAPER_LETTER_TRANSVERSE,  DMPAPER_LETTER_TRANSVERSE,  "Letter Transverse 8 \275 x 11 in",
-    WXADDPAPER(wxPAPER_A4_TRANSVERSE,      DMPAPER_A4_TRANSVERSE,      "A4 Transverse 210 x 297 mm",
-//    WXADDPAPER(wxPAPER_LETTER_EXTRA_TRANSVERSE, DMPAPER_LETTER_EXTRA_TRANSVERSE, "Letter Extra Transverse 9\275 x 12 in",
-    WXADDPAPER(wxPAPER_A_PLUS,             DMPAPER_A_PLUS,             "SuperA/SuperA/A4 227 x 356 mm",
-    WXADDPAPER(wxPAPER_B_PLUS,             DMPAPER_B_PLUS,             "SuperB/SuperB/A3 305 x 487 mm",
-    WXADDPAPER(wxPAPER_LETTER_PLUS,        DMPAPER_LETTER_PLUS,        "Letter Plus 8.5 x 12.69 in",
-    WXADDPAPER(wxPAPER_A4_PLUS,            DMPAPER_A4_PLUS,            "A4 Plus 210 x 330 mm",
-    WXADDPAPER(wxPAPER_A5_TRANSVERSE,      DMPAPER_A5_TRANSVERSE,      "A5 Transverse 148 x 210 mm",
-    WXADDPAPER(wxPAPER_B5_TRANSVERSE,      DMPAPER_B5_TRANSVERSE,      "B5 (JIS) Transverse 182 x 257 mm",
-    WXADDPAPER(wxPAPER_A3_EXTRA,           DMPAPER_A3_EXTRA,           "A3 Extra 322 x 445 mm",
-    WXADDPAPER(wxPAPER_A5_EXTRA,           DMPAPER_A5_EXTRA,           "A5 Extra 174 x 235 mm",
-    WXADDPAPER(wxPAPER_B5_EXTRA,           DMPAPER_B5_EXTRA,           "B5 (ISO) Extra 201 x 276 mm",
-    WXADDPAPER(wxPAPER_A2,                 DMPAPER_A2,                 "A2 420 x 594 mm",
-    WXADDPAPER(wxPAPER_A3_TRANSVERSE,      DMPAPER_A3_TRANSVERSE,      "A3 Transverse 297 x 420 mm",
-    WXADDPAPER(wxPAPER_A3_EXTRA_TRANSVERSE DMPAPER_A3_EXTRA_TRANSVERSE "A3 Extra Transverse 322 x 445 mm",
-#endif
-*/
+    WXADDPAPER(wxPAPER_ISO_B4,             DMPAPER_ISO_B4,             wxTRANSLATE("B4 (ISO) 250 x 353 mm"), 2500, 2530);
+    WXADDPAPER(wxPAPER_JAPANESE_POSTCARD,  DMPAPER_JAPANESE_POSTCARD,  wxTRANSLATE("Japanese Postcard 100 x 148 mm"), 1000, 1480);
+    WXADDPAPER(wxPAPER_9X11,               DMPAPER_9X11,               wxTRANSLATE("9 x 11 in"), 2286, 2794);
+    WXADDPAPER(wxPAPER_10X11,              DMPAPER_10X11,              wxTRANSLATE("10 x 11 in"), 2540, 2794);
+    WXADDPAPER(wxPAPER_15X11,              DMPAPER_15X11,              wxTRANSLATE("15 x 11 in"), 3810, 2794);
+    WXADDPAPER(wxPAPER_ENV_INVITE,         DMPAPER_ENV_INVITE,         wxTRANSLATE("Envelope Invite 220 x 220 mm"), 2200, 2200);
+    WXADDPAPER(wxPAPER_LETTER_EXTRA,       DMPAPER_LETTER_EXTRA,       wxTRANSLATE("Letter Extra 9 1/2 x 12 in"), 2413, 3048);
+    WXADDPAPER(wxPAPER_LEGAL_EXTRA,        DMPAPER_LEGAL_EXTRA,        wxTRANSLATE("Legal Extra 9 1/2 x 15 in"), 2413, 3810);
+    WXADDPAPER(wxPAPER_TABLOID_EXTRA,      DMPAPER_TABLOID_EXTRA,      wxTRANSLATE("Tabloid Extra 11.69 x 18 in"), 2969, 4572);
+    WXADDPAPER(wxPAPER_A4_EXTRA,           DMPAPER_A4_EXTRA,           wxTRANSLATE("A4 Extra 9.27 x 12.69 in"), 2355, 3223);
+    WXADDPAPER(wxPAPER_LETTER_TRANSVERSE,  DMPAPER_LETTER_TRANSVERSE,  wxTRANSLATE("Letter Transverse 8 1/2 x 11 in"), 2159, 2794);
+    WXADDPAPER(wxPAPER_A4_TRANSVERSE,      DMPAPER_A4_TRANSVERSE,      wxTRANSLATE("A4 Transverse 210 x 297 mm"), 2100, 2970);
+    WXADDPAPER(wxPAPER_LETTER_EXTRA_TRANSVERSE, DMPAPER_LETTER_EXTRA_TRANSVERSE, wxTRANSLATE("Letter Extra Transverse 9.275 x 12 in"), 2355, 3048);
+    WXADDPAPER(wxPAPER_A_PLUS,             DMPAPER_A_PLUS,             wxTRANSLATE("SuperA/SuperA/A4 227 x 356 mm"), 2270, 3560);
+    WXADDPAPER(wxPAPER_B_PLUS,             DMPAPER_B_PLUS,             wxTRANSLATE("SuperB/SuperB/A3 305 x 487 mm"), 3050, 4870);
+    WXADDPAPER(wxPAPER_LETTER_PLUS,        DMPAPER_LETTER_PLUS,        wxTRANSLATE("Letter Plus 8 1/2 x 12.69 in"), 2159, 3223);
+    WXADDPAPER(wxPAPER_A4_PLUS,            DMPAPER_A4_PLUS,            wxTRANSLATE("A4 Plus 210 x 330 mm"), 2100, 3300);
+    WXADDPAPER(wxPAPER_A5_TRANSVERSE,      DMPAPER_A5_TRANSVERSE,      wxTRANSLATE("A5 Transverse 148 x 210 mm"), 1480, 2100);
+    WXADDPAPER(wxPAPER_B5_TRANSVERSE,      DMPAPER_B5_TRANSVERSE,      wxTRANSLATE("B5 (JIS) Transverse 182 x 257 mm"), 1820, 2570);
+    WXADDPAPER(wxPAPER_A3_EXTRA,           DMPAPER_A3_EXTRA,           wxTRANSLATE("A3 Extra 322 x 445 mm"), 3220, 4450);
+    WXADDPAPER(wxPAPER_A5_EXTRA,           DMPAPER_A5_EXTRA,           wxTRANSLATE("A5 Extra 174 x 235 mm"), 1740, 2350);
+    WXADDPAPER(wxPAPER_B5_EXTRA,           DMPAPER_B5_EXTRA,           wxTRANSLATE("B5 (ISO) Extra 201 x 276 mm"), 2010, 2760);
+    WXADDPAPER(wxPAPER_A2,                 DMPAPER_A2,                 wxTRANSLATE("A2 420 x 594 mm"), 4200, 5940);
+    WXADDPAPER(wxPAPER_A3_TRANSVERSE,      DMPAPER_A3_TRANSVERSE,      wxTRANSLATE("A3 Transverse 297 x 420 mm"), 2970, 4200);
+    WXADDPAPER(wxPAPER_A3_EXTRA_TRANSVERSE,DMPAPER_A3_EXTRA_TRANSVERSE,wxTRANSLATE("A3 Extra Transverse 322 x 445 mm"), 3220, 4450);
+
+    WXADDPAPER(wxPAPER_DBL_JAPANESE_POSTCARD, 69,                       wxTRANSLATE("Japanese Double Postcard 200 x 148 mm"), 2000, 1480);
+    WXADDPAPER(wxPAPER_A6,                  70,                         wxTRANSLATE("A6 105 x 148 mm"), 1050, 1480);
+    WXADDPAPER(wxPAPER_JENV_KAKU2,          71,                         wxTRANSLATE("Japanese Envelope Kaku #2"), 2400, 3320);
+    WXADDPAPER(wxPAPER_JENV_KAKU3,          72,                         wxTRANSLATE("Japanese Envelope Kaku #3"), 2160, 2770);
+    WXADDPAPER(wxPAPER_JENV_CHOU3,          73,                         wxTRANSLATE("Japanese Envelope Chou #3"), 1200, 2350);
+    WXADDPAPER(wxPAPER_JENV_CHOU4,          74,                         wxTRANSLATE("Japanese Envelope Chou #4"), 900, 2050);
+    WXADDPAPER(wxPAPER_LETTER_ROTATED,      75,                         wxTRANSLATE("Letter Rotated 11 x 8 1/2 in"), 2794, 2159);
+    WXADDPAPER(wxPAPER_A3_ROTATED,          76,                         wxTRANSLATE("A3 Rotated 420 x 297 mm"), 4200, 2970);
+    WXADDPAPER(wxPAPER_A4_ROTATED,          77,                         wxTRANSLATE("A4 Rotated 297 x 210 mm"), 2970, 2100);
+    WXADDPAPER(wxPAPER_A5_ROTATED,          78,                         wxTRANSLATE("A5 Rotated 210 x 148 mm"), 2100, 1480);
+    WXADDPAPER(wxPAPER_B4_JIS_ROTATED,      79,                         wxTRANSLATE("B4 (JIS) Rotated 364 x 257 mm"), 3640, 2570);
+    WXADDPAPER(wxPAPER_B5_JIS_ROTATED,      80,                         wxTRANSLATE("B5 (JIS) Rotated 257 x 182 mm"), 2570, 1820);
+    WXADDPAPER(wxPAPER_JAPANESE_POSTCARD_ROTATED, 81,                   wxTRANSLATE("Japanese Postcard Rotated 148 x 100 mm"), 1480, 1000);
+    WXADDPAPER(wxPAPER_DBL_JAPANESE_POSTCARD_ROTATED, 82,               wxTRANSLATE("Double Japanese Postcard Rotated 148 x 200 mm"), 1480, 2000);
+    WXADDPAPER(wxPAPER_A6_ROTATED,          83,                         wxTRANSLATE("A6 Rotated 148 x 105 mm"), 1480, 1050);
+    WXADDPAPER(wxPAPER_JENV_KAKU2_ROTATED,  84,                         wxTRANSLATE("Japanese Envelope Kaku #2 Rotated"), 3320, 2400);
+    WXADDPAPER(wxPAPER_JENV_KAKU3_ROTATED,  85,                         wxTRANSLATE("Japanese Envelope Kaku #3 Rotated"), 2770, 2160);
+    WXADDPAPER(wxPAPER_JENV_CHOU3_ROTATED,  86,                         wxTRANSLATE("Japanese Envelope Chou #3 Rotated"), 2350, 1200);
+    WXADDPAPER(wxPAPER_JENV_CHOU4_ROTATED,  87,                         wxTRANSLATE("Japanese Envelope Chou #4 Rotated"), 2050, 900);
+    WXADDPAPER(wxPAPER_B6_JIS,              88,                         wxTRANSLATE("B6 (JIS) 128 x 182 mm"), 1280, 1820);
+    WXADDPAPER(wxPAPER_B6_JIS_ROTATED,      89,                         wxTRANSLATE("B6 (JIS) Rotated 182 x 128 mm"), 1920, 1280);
+    WXADDPAPER(wxPAPER_12X11,               90,                         wxTRANSLATE("12 x 11 in"), 3048, 2794);
+    WXADDPAPER(wxPAPER_JENV_YOU4,           91,                         wxTRANSLATE("Japanese Envelope You #4"), 2350, 1050);
+    WXADDPAPER(wxPAPER_JENV_YOU4_ROTATED,   92,                         wxTRANSLATE("Japanese Envelope You #4 Rotated"), 1050, 2350);
+    WXADDPAPER(wxPAPER_P16K,                93,                         wxTRANSLATE("PRC 16K 146 x 215 mm"), 1460, 2150);
+    WXADDPAPER(wxPAPER_P32K,                94,                         wxTRANSLATE("PRC 32K 97 x 151 mm"), 970, 1510);
+    WXADDPAPER(wxPAPER_P32KBIG,             95,                         wxTRANSLATE("PRC 32K(Big) 97 x 151 mm"), 970, 1510);
+    WXADDPAPER(wxPAPER_PENV_1,              96,                         wxTRANSLATE("PRC Envelope #1 102 x 165 mm"), 1020, 1650);
+    WXADDPAPER(wxPAPER_PENV_2,              97,                         wxTRANSLATE("PRC Envelope #2 102 x 176 mm"), 1020, 1760);
+    WXADDPAPER(wxPAPER_PENV_3,              98,                         wxTRANSLATE("PRC Envelope #3 125 x 176 mm"), 1250, 1760);
+    WXADDPAPER(wxPAPER_PENV_4,              99,                         wxTRANSLATE("PRC Envelope #4 110 x 208 mm"), 1100, 2080);
+    WXADDPAPER(wxPAPER_PENV_5,              100,                        wxTRANSLATE("PRC Envelope #5 110 x 220 mm"), 1100, 2200);
+    WXADDPAPER(wxPAPER_PENV_6,              101,                        wxTRANSLATE("PRC Envelope #6 120 x 230 mm"), 1200, 2300);
+    WXADDPAPER(wxPAPER_PENV_7,              102,                        wxTRANSLATE("PRC Envelope #7 160 x 230 mm"), 1600, 2300);
+    WXADDPAPER(wxPAPER_PENV_8,              103,                        wxTRANSLATE("PRC Envelope #8 120 x 309 mm"), 1200, 3090);
+    WXADDPAPER(wxPAPER_PENV_9,              104,                        wxTRANSLATE("PRC Envelope #9 229 x 324 mm"), 2290, 3240);
+    WXADDPAPER(wxPAPER_PENV_10,             105,                        wxTRANSLATE("PRC Envelope #10 324 x 458 mm"), 3240, 4580);
+    WXADDPAPER(wxPAPER_P16K_ROTATED,        106,                        wxTRANSLATE("PRC 16K Rotated"), 2150, 1460);
+    WXADDPAPER(wxPAPER_P32K_ROTATED,        107,                        wxTRANSLATE("PRC 32K Rotated"), 1510, 970);
+    WXADDPAPER(wxPAPER_P32KBIG_ROTATED,     108,                        wxTRANSLATE("PRC 32K(Big) Rotated"), 1510, 970);
+    WXADDPAPER(wxPAPER_PENV_1_ROTATED,      109,                        wxTRANSLATE("PRC Envelope #1 Rotated 165 x 102 mm"), 1650, 1020);
+    WXADDPAPER(wxPAPER_PENV_2_ROTATED,      110,                        wxTRANSLATE("PRC Envelope #2 Rotated 176 x 102 mm"), 1760, 1020);
+    WXADDPAPER(wxPAPER_PENV_3_ROTATED,      111,                        wxTRANSLATE("PRC Envelope #3 Rotated 176 x 125 mm"), 1760, 1250);
+    WXADDPAPER(wxPAPER_PENV_4_ROTATED,      112,                        wxTRANSLATE("PRC Envelope #4 Rotated 208 x 110 mm"), 2080, 1100);
+    WXADDPAPER(wxPAPER_PENV_5_ROTATED,      113,                        wxTRANSLATE("PRC Envelope #5 Rotated 220 x 110 mm"), 2200, 1100);
+    WXADDPAPER(wxPAPER_PENV_6_ROTATED,      114,                        wxTRANSLATE("PRC Envelope #6 Rotated 230 x 120 mm"), 2300, 1200);
+    WXADDPAPER(wxPAPER_PENV_7_ROTATED,      115,                        wxTRANSLATE("PRC Envelope #7 Rotated 230 x 160 mm"), 2300, 1600);
+    WXADDPAPER(wxPAPER_PENV_8_ROTATED,      116,                        wxTRANSLATE("PRC Envelope #8 Rotated 309 x 120 mm"), 3090, 1200);
+    WXADDPAPER(wxPAPER_PENV_9_ROTATED,      117,                        wxTRANSLATE("PRC Envelope #9 Rotated 324 x 229 mm"), 3240, 2290);
+    WXADDPAPER(wxPAPER_PENV_10_ROTATED,     118,                        wxTRANSLATE("PRC Envelope #10 Rotated 458 x 324 mm"), 4580, 3240);
 }
 
 void wxPrintPaperDatabase::ClearDatabase()
 {
-    Clear();
+    delete m_list;
+    WX_CLEAR_HASH_MAP(wxStringToPrintPaperTypeHashMap, *m_map);
+    delete m_map;
 }
 
 void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, const wxString& name, int w, int h)
 {
-    Append(name, new wxPrintPaperType(paperId, 0, name, w, h));
+    wxPrintPaperType* tmp = new wxPrintPaperType(paperId, 0, name, w, h);
+    (*m_map)[name] = tmp;
+    m_list->push_back(tmp);
 }
 
 void wxPrintPaperDatabase::AddPaperType(wxPaperSize paperId, int platformId, const wxString& name, int w, int h)
 {
-    Append(name, new wxPrintPaperType(paperId, platformId, name, w, h));
+    wxPrintPaperType* tmp = new wxPrintPaperType(paperId, platformId, name, w, h);
+    (*m_map)[name] = tmp;
+    m_list->push_back(tmp);
 }
 
 wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxString& name)
 {
-    wxNode *node = Find(name);
-    if (node)
-        return (wxPrintPaperType *)node->GetData();
+    wxStringToPrintPaperTypeHashMap::iterator it = m_map->find(name);
+    if (it != m_map->end())
+        return it->second;
     else
-        return (wxPrintPaperType *) NULL;
+        return NULL;
 }
 
 wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(wxPaperSize id)
 {
-    wxNode *node = GetFirst();
-    while (node)
+    typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+    for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
     {
-        wxPrintPaperType* paperType = (wxPrintPaperType*) node->GetData();
+        wxPrintPaperType* paperType = it->second;
         if (paperType->GetId() == id)
             return paperType;
-        node = node->GetNext();
     }
-    return (wxPrintPaperType *) NULL;
+
+    return NULL;
 }
 
 wxPrintPaperType *wxPrintPaperDatabase::FindPaperTypeByPlatformId(int id)
 {
-    wxNode *node = GetFirst();
-    while (node)
+    typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+    for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
     {
-        wxPrintPaperType* paperType = (wxPrintPaperType*) node->GetData();
+        wxPrintPaperType* paperType = it->second;
         if (paperType->GetPlatformId() == id)
             return paperType;
-        node = node->GetNext();
     }
-    return (wxPrintPaperType *) NULL;
+
+    return NULL;
 }
 
 wxPrintPaperType *wxPrintPaperDatabase::FindPaperType(const wxSize& sz)
 {
-    wxNode *node = GetFirst();
-    while (node)
+    typedef wxStringToPrintPaperTypeHashMap::iterator iterator;
+
+    for (iterator it = m_map->begin(), en = m_map->end(); it != en; ++it)
     {
-        wxPrintPaperType* paperType = (wxPrintPaperType*) node->GetData();
+        wxPrintPaperType* paperType = it->second;
         wxSize paperSize = paperType->GetSize() ;
         if ( abs( paperSize.x - sz.x ) < 10 && abs( paperSize.y - sz.y ) < 10 )
             return paperType;
-        node = node->GetNext();
     }
-    return (wxPrintPaperType *) NULL;
+
+    return NULL;
 }
 
 // Convert name to size id
@@ -264,7 +314,7 @@ wxSize wxPrintPaperDatabase::GetSize(wxPaperSize paperId)
     if (type)
         return type->GetSize();
     else
-        return wxSize(0, 0);
+        return wxSize(0,0);
 }
 
 // Get the paper size
@@ -277,6 +327,17 @@ wxPaperSize wxPrintPaperDatabase::GetSize(const wxSize& size)
         return wxPAPER_NONE;
 }
 
+// QUICK and DIRTY
+size_t wxPrintPaperDatabase::GetCount() const
+{
+    return m_list->GetCount();
+}
+
+wxPrintPaperType* wxPrintPaperDatabase::Item(size_t index) const
+{
+    return m_list->Item(index)->GetData();
+}
+
 // A module to allow initialization/cleanup of print paper
 // things without calling these functions from app.cpp.
 
@@ -300,7 +361,7 @@ bool wxPrintPaperModule::OnInit()
     wxThePrintPaperDatabase = new wxPrintPaperDatabase;
     wxThePrintPaperDatabase->CreateDatabase();
 
-    return TRUE;
+    return true;
 }
 
 void wxPrintPaperModule::OnExit()
@@ -310,4 +371,3 @@ void wxPrintPaperModule::OnExit()
 }
 
 #endif // wxUSE_PRINTING_ARCHITECTURE
-