Subversion Repositories Scribus

Rev

Rev 375 | Go to most recent revision | Details | 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
 
135
void gtParagraphStyle::setTabValue(double newTabValue)
136
{
137
        tabValues.append(newTabValue);
138
}
139
 
140
void   gtParagraphStyle::removeTabValue(double valueToRemove)
141
{
142
        // @todo Implement this method
143
}
144
 
145
bool gtParagraphStyle::hasDropCap()
146
{
147
        return dropCap;
148
}
149
 
150
void gtParagraphStyle::setDropCap(bool newDropCap)
151
{
152
        dropCap = newDropCap;
153
}
154
 
155
void gtParagraphStyle::setDropCap(int newHeight)
156
{
157
        setDropCap(true);
158
        dropCapHeight = newHeight;
159
}
160
 
161
int gtParagraphStyle::getDropCapHeight()
162
{
163
        return dropCapHeight;
164
}
165
 
166
void   gtParagraphStyle::setDropCapHeight(int newHeight)
167
{
168
        dropCapHeight = newHeight;
169
}
170
 
171
bool gtParagraphStyle::isAdjToBaseline()
172
{
173
        return adjToBaseline;
174
}
175
 
176
void gtParagraphStyle::setAdjToBaseline(bool newAdjToBaseline)
177
{
178
        adjToBaseline = newAdjToBaseline;
179
}
180
 
181
void gtParagraphStyle::getStyle(gtStyle* style)
182
{
183
        *style = gtStyle(*this);
184
}
185
 
186
gtParagraphStyle::~gtParagraphStyle()
187
{
188
 
189
}