Scribus
Open source desktop publishing at your fingertips
pagesize.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 /***************************************************************************
8  begin : Feb 2005
9  copyright : (C) 2005 by Craig Bradney
10  email : cbradney@zip.com.au
11  ***************************************************************************/
12 
13 /***************************************************************************
14  * *
15  * This program is free software; you can redistribute it and/or modify *
16  * it under the terms of the GNU General Public License as published by *
17  * the Free Software Foundation; either version 2 of the License, or *
18  * (at your option) any later version. *
19  * *
20  ***************************************************************************/
21 
22 #ifndef PAGESIZE_H
23 #define PAGESIZE_H
24 
25 #include <QMap>
26 #include <QString>
27 #include "scribusapi.h"
28 #include "units.h"
29 
31 {
32  double width;
33  double height;
34  QString trSizeName;
35  int pageUnitIndex;
36 };
37 
38 typedef QMap<QString, PageSizeInfo > PageSizeInfoMap;
39 
40 class SCRIBUS_API PageSize
41 {
42 public:
43  PageSize(const QString);
44  PageSize(const double, const double);
45 
46  QString name() const { return m_pageSizeName; }
47  QString nameTR() const { return m_trPageSizeName; }
48  double width() const { return m_width; }
49  double height() const { return m_height; }
50  double originalWidth() const { return m_width*unitGetRatioFromIndex(m_pageUnitIndex); }
51  double originalHeight() const { return m_height*unitGetRatioFromIndex(m_pageUnitIndex); }
52  QString originalUnit() const { return unitGetSuffixFromIndex(m_pageUnitIndex); }
53  QStringList sizeList() const;
54  QStringList sizeTRList() const;
55  QStringList activeSizeList() const;
56  QStringList activeSizeTRList() const;
57  void generateSizeList();
58  void printSizeList();
59  QStringList untransPageSizeList(const QStringList &transList);
60 
61 private:
62  QMap<QString, PageSizeInfo > pageSizeList;
63  double m_width;
64  double m_height;
65  int m_pageUnitIndex;
66  QString m_pageSizeName;
67  QString m_trPageSizeName;
68 };
69 
70 #endif
71 
Definition: pagesize.h:30
Definition: pagesize.h:40