Back to index

scribus-ng  1.3.4.dfsg+svn20071115
pagesize.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /***************************************************************************
00008     begin                : Feb 2005
00009     copyright            : (C) 2005 by Craig Bradney
00010     email                : cbradney@zip.com.au
00011  ***************************************************************************/
00012 
00013 /***************************************************************************
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
00019  *                                                                         *
00020  ***************************************************************************/
00021  
00022 #ifndef PAGESIZE_H
00023 #define PAGESIZE_H
00024 
00025 #include <qmap.h>
00026 #include <qstring.h>
00027 #include "scribusapi.h"
00028 #include "units.h"
00029 
00030 struct PageSizeInfo
00031 {
00032        double width;
00033        double height;
00034        QString trSizeName;
00035        int pageUnitIndex;
00036 };
00037 
00038 typedef QMap<QString, PageSizeInfo > PageSizeInfoMap;
00039 
00040 class SCRIBUS_API PageSize
00041 {
00042 public:
00043        PageSize(const QString);
00044        PageSize(const double, const double);
00045               
00046        QString name() const { return m_pageSizeName; }
00047        QString nameTR() const { return m_trPageSizeName; }
00048        double width() const { return m_width; }
00049        double height() const { return m_height; }
00050        double originalWidth() const { return m_width*unitGetRatioFromIndex(m_pageUnitIndex); }
00051        double originalHeight() const { return m_height*unitGetRatioFromIndex(m_pageUnitIndex); }
00052        QStringList sizeList() const;
00053        QStringList sizeTRList() const;
00054        void generateSizeList();
00055        void printSizeList();
00056 
00057 private:
00058        QMap<QString, PageSizeInfo > pageSizeList;
00059        double m_width;
00060        double m_height;
00061        int m_pageUnitIndex;
00062        QString m_pageSizeName;
00063        QString m_trPageSizeName;
00064 };
00065 
00066 #endif
00067