Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
4430 cbradney 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
364 Franz 7
/***************************************************************************
8
 *   Copyright (C) 2004 by Riku Leino                                      *
1184 tsoots 9
 *   tsoots@gmail.com                                                      *
364 Franz 10
 *                                                                         *
11
 *   This program is free software; you can redistribute it and/or modify  *
12
 *   it under the terms of the GNU General Public License as published by  *
13
 *   the Free Software Foundation; either version 2 of the License, or     *
14
 *   (at your option) any later version.                                   *
15
 *                                                                         *
16
 *   This program is distributed in the hope that it will be useful,       *
17
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
18
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
19
 *   GNU General Public License for more details.                          *
20
 *                                                                         *
21
 *   You should have received a copy of the GNU General Public License     *
22
 *   along with this program; if not, write to the                         *
23
 *   Free Software Foundation, Inc.,                                       *
24
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
25
 ***************************************************************************/
26
 
27
#include "gtparagraphstyle.h"
2714 craig 28
#include "scribusstructs.h"
364 Franz 29
 
30
gtParagraphStyle::gtParagraphStyle(QString name) : gtStyle(name)
31
{
32
        init();
33
}
34
 
35
gtParagraphStyle::gtParagraphStyle(const gtParagraphStyle& p) : gtStyle(p)
36
{
10111 jghali 37
        defaultStyle    = false;
364 Franz 38
        lineSpacing     = p.lineSpacing;
39
        alignment       = p.alignment;
40
        indent          = p.indent;
41
        firstLineIndent = p.firstLineIndent;
42
        spaceAbove      = p.spaceAbove;
43
        spaceBelow      = p.spaceBelow;
44
        dropCap         = p.dropCap;
45
        dropCapHeight   = p.dropCapHeight;
46
        adjToBaseline   = p.adjToBaseline;
411 Franz 47
        autoLineSpacing = p.autoLineSpacing;
48
        isVisible       = p.isVisible;
364 Franz 49
}
50
 
51
gtParagraphStyle::gtParagraphStyle(const gtStyle& s) : gtStyle(s)
52
{
53
        init();
54
}
55
 
56
void gtParagraphStyle::init()
57
{
10111 jghali 58
        defaultStyle    = false;
364 Franz 59
        lineSpacing     = 15;
60
        alignment       = LEFT;
61
        indent          = 0;
62
        firstLineIndent = 0;
63
        spaceAbove      = 0;
64
        spaceBelow      = 0;
65
        dropCap         = false;
66
        dropCapHeight   = 2;
67
        adjToBaseline   = false;
411 Franz 68
        autoLineSpacing = false;
69
        isVisible       = true;
364 Franz 70
}
71
 
72
QString gtParagraphStyle::target()
73
{
74
        return QString("paragraph");
75
}
76
 
10111 jghali 77
bool gtParagraphStyle::isDefaultStyle()
78
{
79
        return defaultStyle;
80
}
81
 
82
void gtParagraphStyle::setDefaultStyle(bool defStyle)
83
{
84
        defaultStyle = defStyle;
85
}
86
 
364 Franz 87
double gtParagraphStyle::getLineSpacing()
88
{
89
        return lineSpacing;
90
}
91
 
92
void gtParagraphStyle::setLineSpacing(double newLineSpacing)
93
{
94
        lineSpacing = newLineSpacing;
95
}
96
 
411 Franz 97
bool gtParagraphStyle::getAutoLineSpacing()
98
{
99
        return autoLineSpacing;
100
}
101
 
102
void gtParagraphStyle::setAutoLineSpacing(bool newALS)
103
{
104
        autoLineSpacing = newALS;
105
}
106
 
364 Franz 107
int gtParagraphStyle::getAlignment()
108
{
109
        return alignment;
110
}
111
 
112
void gtParagraphStyle::setAlignment(Alignment newAlignment)
113
{
114
        alignment = newAlignment;
115
}
116
 
117
void gtParagraphStyle::setAlignment(int newAlignment)
118
{
119
        if ((newAlignment > -1) && (newAlignment < AlignmentMAX))
120
                alignment = newAlignment;
121
}
122
 
123
double gtParagraphStyle::getIndent()
124
{
125
        return indent;
126
}
127
 
128
void gtParagraphStyle::setIndent(double newIndent)
129
{
130
        indent = newIndent;
131
}
132
 
133
double gtParagraphStyle::getFirstLineIndent()
134
{
135
        return firstLineIndent;
136
}
137
 
138
void gtParagraphStyle::setFirstLineIndent(double newFirstLineIndent)
139
{
140
        firstLineIndent = newFirstLineIndent;
141
}
142
 
143
double gtParagraphStyle::getSpaceAbove()
144
{
145
        return spaceAbove;
146
}
147
 
148
void gtParagraphStyle::setSpaceAbove(double newSpaceAbove)
149
{
150
        spaceAbove = newSpaceAbove;
151
}
152
 
153
double gtParagraphStyle::getSpaceBelow()
154
{
155
        return spaceBelow;
156
}
157
 
158
void gtParagraphStyle::setSpaceBelow(double newSpaceBelow)
159
{
160
        spaceBelow = newSpaceBelow;
161
}
162
 
9797 avox 163
QList<ParagraphStyle::TabRecord>* gtParagraphStyle::getTabValues()
364 Franz 164
{
165
        return &tabValues;
166
}
167
 
375 Franz 168
void gtParagraphStyle::setTabValue(double newTabValue, TabType ttype)
364 Franz 169
{
5184 avox 170
        ParagraphStyle::TabRecord tb;
2282 fschmid 171
        tb.tabPosition = newTabValue;
172
        tb.tabType = ttype;
173
        tb.tabFillChar =  QChar();
174
        tabValues.append(tb);
364 Franz 175
}
176
 
177
bool gtParagraphStyle::hasDropCap()
178
{
179
        return dropCap;
180
}
181
 
182
void gtParagraphStyle::setDropCap(bool newDropCap)
183
{
184
        dropCap = newDropCap;
185
}
186
 
187
void gtParagraphStyle::setDropCap(int newHeight)
188
{
189
        setDropCap(true);
190
        dropCapHeight = newHeight;
191
}
192
 
193
int gtParagraphStyle::getDropCapHeight()
194
{
195
        return dropCapHeight;
196
}
197
 
198
void   gtParagraphStyle::setDropCapHeight(int newHeight)
199
{
200
        dropCapHeight = newHeight;
201
}
202
 
203
bool gtParagraphStyle::isAdjToBaseline()
204
{
205
        return adjToBaseline;
206
}
207
 
208
void gtParagraphStyle::setAdjToBaseline(bool newAdjToBaseline)
209
{
210
        adjToBaseline = newAdjToBaseline;
211
}
212
 
213
void gtParagraphStyle::getStyle(gtStyle* style)
214
{
215
        *style = gtStyle(*this);
216
}
217
 
218
gtParagraphStyle::~gtParagraphStyle()
219
{
220
 
221
}