~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to libs/koreport/common/labelsizeinfo.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

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