3
* Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
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.
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.
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/>.
18
#include "krscriptfield.h"
22
Field::Field(KoReportItemField *f)
32
QString Field::source()
34
return m_field->itemDataSource();
37
void Field::setSource(const QString& s)
39
m_field->setItemDataSource(s);
42
int Field::horizontalAlignment()
44
QString a = m_field->m_horizontalAlignment->value().toString();
46
if (a.toLower() == "left") {
48
} else if (a.toLower() == "center") {
50
} else if (a.toLower() == "right") {
55
void Field::setHorizonalAlignment(int a)
59
m_field->m_horizontalAlignment->setValue("left");
62
m_field->m_horizontalAlignment->setValue("center");
65
m_field->m_horizontalAlignment->setValue("right");
68
m_field->m_horizontalAlignment->setValue("left");
73
int Field::verticalAlignment()
75
QString a = m_field->m_horizontalAlignment->value().toString();
77
if (a.toLower() == "top") {
79
} else if (a.toLower() == "middle") {
81
} else if (a.toLower() == "bottom") {
86
void Field::setVerticalAlignment(int a)
90
m_field->m_verticalAlignment->setValue("top");
93
m_field->m_verticalAlignment->setValue("middle");
96
m_field->m_verticalAlignment->setValue("bottom");
99
m_field->m_verticalAlignment->setValue("middle");
104
QColor Field::backgroundColor()
106
return m_field->m_backgroundColor->value().value<QColor>();
108
void Field::setBackgroundColor(const QColor& c)
110
m_field->m_backgroundColor->setValue(c);
113
QColor Field::foregroundColor()
115
return m_field->m_foregroundColor->value().value<QColor>();
117
void Field::setForegroundColor(const QColor& c)
119
m_field->m_foregroundColor->setValue(c);
122
int Field::backgroundOpacity()
124
return m_field->m_backgroundOpacity->value().toInt();
126
void Field::setBackgroundOpacity(int o)
128
m_field->m_backgroundOpacity->setValue(o);
131
QColor Field::lineColor()
133
return m_field->m_lineColor->value().value<QColor>();
135
void Field::setLineColor(const QColor& c)
137
m_field->m_lineColor->setValue(c);
140
int Field::lineWeight()
142
return m_field->m_lineWeight->value().toInt();
144
void Field::setLineWeight(int w)
146
m_field->m_lineWeight->setValue(w);
149
int Field::lineStyle()
151
return m_field->m_lineStyle->value().toInt();
153
void Field::setLineStyle(int s)
155
if (s < 0 || s > 5) {
158
m_field->m_lineStyle->setValue(s);
161
QPointF Field::position()
163
return m_field->m_pos.toPoint();
165
void Field::setPosition(const QPointF &p)
167
m_field->m_pos.setPointPos(p);
172
return m_field->m_size.toPoint();
174
void Field::setSize(const QSizeF &s)
176
m_field->m_size.setPointSize(s);