File indexing completed on 2024-04-28 04:41:57

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
0003  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2.1 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013  * Lesser General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Lesser General Public
0016  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 #include "KReportLabelSizeInfo.h"
0020 
0021 static KReportLabelSizeInfo s_labels[] = {
0022 //"LABEL_NAME","Paper Size","COLUMNS","ROWS","WIDTH","HEIGHT","STARTXOFFSET","STARTYOFFSET","HORIZONTALGAP","VERTICALGAP"
0023     KReportLabelSizeInfo("Avery 5263", "Letter", 2, 5, 400, 200, 25, 50, 0, 0),
0024     KReportLabelSizeInfo("Avery 5264", "Letter", 2, 3, 400, 333, 25, 75, 0, 0),
0025     KReportLabelSizeInfo("Avery 8460", "Letter", 3, 10, 262, 100, 32, 50, 0, 0),
0026     KReportLabelSizeInfo("CILS ALP1-9200-1", "Letter", 3, 7, 200, 100, 62, 62, 81, 50),
0027     KReportLabelSizeInfo()               // Null Label Size
0028 };
0029 
0030 KReportLabelSizeInfo KReportLabelSizeInfo::find(const QString & name)
0031 {
0032     int i = 0;
0033     while (!s_labels[i].isNull() && s_labels[i].m_name != name)
0034         i++;
0035     return s_labels[i];
0036 }
0037 
0038 QStringList KReportLabelSizeInfo::labelNames()
0039 {
0040     QStringList l;
0041     for (int i = 0; !s_labels[i].isNull(); i++)
0042         l.append(s_labels[i].m_name);
0043     return l;
0044 }
0045 
0046 KReportLabelSizeInfo::KReportLabelSizeInfo(const char *n, const char *p, int c,
0047                              int r, int w, int h, int sx, int sy, int xg,
0048                              int yg)
0049 {
0050     m_name = QLatin1String(n);
0051     m_paper = QLatin1String(p);
0052 
0053     m_columns = c;
0054     m_rows = r;
0055 
0056     m_width = w;
0057     m_height = h;
0058 
0059     m_startx = sx;
0060     m_starty = sy;
0061 
0062     m_xgap = xg;
0063     m_ygap = yg;
0064 
0065     m_null = false;
0066 }
0067 
0068 KReportLabelSizeInfo::KReportLabelSizeInfo()
0069 {
0070     m_columns = 0;
0071     m_rows = 0;
0072 
0073     m_width = 0;
0074     m_height = 0;
0075 
0076     m_startx = 0;
0077     m_starty = 0;
0078 
0079     m_xgap = 0;
0080     m_ygap = 0;
0081 
0082     m_null = true;
0083 }
0084 
0085 KReportLabelSizeInfo::~KReportLabelSizeInfo()
0086 {
0087 }
0088 
0089 QString KReportLabelSizeInfo::name() const
0090 {
0091     return m_name;
0092 }
0093 
0094 QString KReportLabelSizeInfo::paper() const
0095 {
0096     return m_paper;
0097 }
0098 
0099 int KReportLabelSizeInfo::columns() const
0100 {
0101     return m_columns;
0102 }
0103 int KReportLabelSizeInfo::rows() const
0104 {
0105     return m_rows;
0106 }
0107 
0108 int KReportLabelSizeInfo::width() const
0109 {
0110     return m_width;
0111 }
0112 
0113 int KReportLabelSizeInfo::height() const
0114 {
0115     return m_height;
0116 }
0117 
0118 int KReportLabelSizeInfo::startX() const
0119 {
0120     return m_startx;
0121 }
0122 
0123 int KReportLabelSizeInfo::startY() const
0124 {
0125     return m_starty;
0126 }
0127 
0128 int KReportLabelSizeInfo::xGap() const
0129 {
0130     return m_xgap;
0131 }
0132 
0133 int KReportLabelSizeInfo::yGap() const
0134 {
0135     return m_ygap;
0136 }
0137 
0138 bool KReportLabelSizeInfo::isNull() const
0139 {
0140     return m_null;
0141 }