Subversion Repositories Scribus

Rev

Rev 364 | Rev 411 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
364 Franz 1
/***************************************************************************
2
 *   Copyright (C) 2004 by Riku Leino                                      *
3
 *   tsoots@welho.com                                                      *
4
 *                                                                         *
5
 *   This program is free software; you can redistribute it and/or modify  *
6
 *   it under the terms of the GNU General Public License as published by  *
7
 *   the Free Software Foundation; either version 2 of the License, or     *
8
 *   (at your option) any later version.                                   *
9
 *                                                                         *
10
 *   This program 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         *
13
 *   GNU General Public License for more details.                          *
14
 *                                                                         *
15
 *   You should have received a copy of the GNU General Public License     *
16
 *   along with this program; if not, write to the                         *
17
 *   Free Software Foundation, Inc.,                                       *
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
19
 ***************************************************************************/
20
 
21
#include "gtparagraphstyle.h"
22
 
23
gtParagraphStyle::gtParagraphStyle(QString name) : gtStyle(name)
24
{
25
        init();
26
}
27
 
28
gtParagraphStyle::gtParagraphStyle(const gtParagraphStyle& p) : gtStyle(p)
29
{
30
        lineSpacing     = p.lineSpacing;
31
        alignment       = p.alignment;
32
        indent          = p.indent;
33
        firstLineIndent = p.firstLineIndent;
34
        spaceAbove      = p.spaceAbove;
35
        spaceBelow      = p.spaceBelow;
36
        dropCap         = p.dropCap;
37
        dropCapHeight   = p.dropCapHeight;
38
        adjToBaseline   = p.adjToBaseline;
39
}
40
 
41
gtParagraphStyle::gtParagraphStyle(const gtStyle& s) : gtStyle(s)
42
{
43
        init();
44
}
45
 
46
void gtParagraphStyle::init()
47
{
48
        lineSpacing     = 15;
49
        alignment       = LEFT;
50
        indent          = 0;
51
        firstLineIndent = 0;
52
        spaceAbove      = 0;
53
        spaceBelow      = 0;
54
        dropCap         = false;
55
        dropCapHeight   = 2;
56
        adjToBaseline   = false;
57
}
58
 
59
QString gtParagraphStyle::target()
60
{
61
        return QString("paragraph");
62
}
63
 
64
double gtParagraphStyle::getLineSpacing()
65
{
66
        return lineSpacing;
67
}
68
 
69
void gtParagraphStyle::setLineSpacing(double newLineSpacing)
70
{
71
        lineSpacing = newLineSpacing;
72
}
73
 
74
int gtParagraphStyle::getAlignment()
75
{
76
        return alignment;
77
}
78
 
79
void gtParagraphStyle::setAlignment(Alignment newAlignment)
80
{
81
        alignment = newAlignment;
82
}
83
 
84
void gtParagraphStyle::setAlignment(int newAlignment)
85
{
86
        if ((newAlignment > -1) && (newAlignment < AlignmentMAX))
87
                alignment = newAlignment;
88
}
89
 
90
double gtParagraphStyle::getIndent()
91
{
92
        return indent;
93
}
94
 
95
void gtParagraphStyle::setIndent(double newIndent)
96
{
97
        indent = newIndent;
98
}
99
 
100
double gtParagraphStyle::getFirstLineIndent()
101
{
102
        return firstLineIndent;
103
}
104
 
105
void gtParagraphStyle::setFirstLineIndent(double newFirstLineIndent)
106
{
107
        firstLineIndent = newFirstLineIndent;
108
}
109
 
110
double gtParagraphStyle::getSpaceAbove()
111
{
112
        return spaceAbove;
113
}
114
 
115
void gtParagraphStyle::setSpaceAbove(double newSpaceAbove)
116
{
117
        spaceAbove = newSpaceAbove;
118
}
119
 
120
double gtParagraphStyle::getSpaceBelow()
121
{
122
        return spaceBelow;
123
}
124
 
125
void gtParagraphStyle::setSpaceBelow(double newSpaceBelow)
126
{
127
        spaceBelow = newSpaceBelow;
128
}
129
 
130
QValueList<double>* gtParagraphStyle::getTabValues()
131
{
132
        return &tabValues;
133
}
134
 
375 Franz 135
void gtParagraphStyle::setTabValue(double newTabValue, TabType ttype)
364 Franz 136
{
375 Franz 137
        tabValues.append(static_cast<double>(ttype));
364 Franz 138
        tabValues.append(newTabValue);
139
}
140
 
141
bool gtParagraphStyle::hasDropCap()
142
{
143
        return dropCap;
144
}
145
 
146
void gtParagraphStyle::setDropCap(bool newDropCap)
147
{
148
        dropCap = newDropCap;
149
}
150
 
151
void gtParagraphStyle::setDropCap(int newHeight)
152
{
153
        setDropCap(true);
154
        dropCapHeight = newHeight;
155
}
156
 
157
int gtParagraphStyle::getDropCapHeight()
158
{
159
        return dropCapHeight;
160
}
161
 
162
void   gtParagraphStyle::setDropCapHeight(int newHeight)
163
{
164
        dropCapHeight = newHeight;
165
}
166
 
167
bool gtParagraphStyle::isAdjToBaseline()
168
{
169
        return adjToBaseline;
170
}
171
 
172
void gtParagraphStyle::setAdjToBaseline(bool newAdjToBaseline)
173
{
174
        adjToBaseline = newAdjToBaseline;
175
}
176
 
177
void gtParagraphStyle::getStyle(gtStyle* style)
178
{
179
        *style = gtStyle(*this);
180
}
181
 
182
gtParagraphStyle::~gtParagraphStyle()
183
{
184
 
185
}