KReport

KReportLabelSizeInfo.cpp
1 /* This file is part of the KDE project
2  * Copyright (C) 2001-2007 by OpenMFG, LLC ([email protected])
3  * Copyright (C) 2007-2008 by Adam Pigg ([email protected])
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #include "KReportLabelSizeInfo.h"
20 
21 static KReportLabelSizeInfo s_labels[] = {
22 //"LABEL_NAME","Paper Size","COLUMNS","ROWS","WIDTH","HEIGHT","STARTXOFFSET","STARTYOFFSET","HORIZONTALGAP","VERTICALGAP"
23  KReportLabelSizeInfo("Avery 5263", "Letter", 2, 5, 400, 200, 25, 50, 0, 0),
24  KReportLabelSizeInfo("Avery 5264", "Letter", 2, 3, 400, 333, 25, 75, 0, 0),
25  KReportLabelSizeInfo("Avery 8460", "Letter", 3, 10, 262, 100, 32, 50, 0, 0),
26  KReportLabelSizeInfo("CILS ALP1-9200-1", "Letter", 3, 7, 200, 100, 62, 62, 81, 50),
27  KReportLabelSizeInfo() // Null Label Size
28 };
29 
30 KReportLabelSizeInfo KReportLabelSizeInfo::find(const QString & name)
31 {
32  int i = 0;
33  while (!s_labels[i].isNull() && s_labels[i].m_name != name)
34  i++;
35  return s_labels[i];
36 }
37 
38 QStringList KReportLabelSizeInfo::labelNames()
39 {
40  QStringList l;
41  for (int i = 0; !s_labels[i].isNull(); i++)
42  l.append(s_labels[i].m_name);
43  return l;
44 }
45 
46 KReportLabelSizeInfo::KReportLabelSizeInfo(const char *n, const char *p, int c,
47  int r, int w, int h, int sx, int sy, int xg,
48  int yg)
49 {
50  m_name = QLatin1String(n);
51  m_paper = QLatin1String(p);
52 
53  m_columns = c;
54  m_rows = r;
55 
56  m_width = w;
57  m_height = h;
58 
59  m_startx = sx;
60  m_starty = sy;
61 
62  m_xgap = xg;
63  m_ygap = yg;
64 
65  m_null = false;
66 }
67 
68 KReportLabelSizeInfo::KReportLabelSizeInfo()
69 {
70  m_columns = 0;
71  m_rows = 0;
72 
73  m_width = 0;
74  m_height = 0;
75 
76  m_startx = 0;
77  m_starty = 0;
78 
79  m_xgap = 0;
80  m_ygap = 0;
81 
82  m_null = true;
83 }
84 
85 KReportLabelSizeInfo::~KReportLabelSizeInfo()
86 {
87 }
88 
89 QString KReportLabelSizeInfo::name() const
90 {
91  return m_name;
92 }
93 
94 QString KReportLabelSizeInfo::paper() const
95 {
96  return m_paper;
97 }
98 
99 int KReportLabelSizeInfo::columns() const
100 {
101  return m_columns;
102 }
103 int KReportLabelSizeInfo::rows() const
104 {
105  return m_rows;
106 }
107 
108 int KReportLabelSizeInfo::width() const
109 {
110  return m_width;
111 }
112 
113 int KReportLabelSizeInfo::height() const
114 {
115  return m_height;
116 }
117 
118 int KReportLabelSizeInfo::startX() const
119 {
120  return m_startx;
121 }
122 
123 int KReportLabelSizeInfo::startY() const
124 {
125  return m_starty;
126 }
127 
128 int KReportLabelSizeInfo::xGap() const
129 {
130  return m_xgap;
131 }
132 
133 int KReportLabelSizeInfo::yGap() const
134 {
135  return m_ygap;
136 }
137 
138 bool KReportLabelSizeInfo::isNull() const
139 {
140  return m_null;
141 }
void append(const T &value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:17:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.