Subversion Repositories Scribus

Rev

Rev 2714 | Rev 5184 | 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
{
37
        lineSpacing     = p.lineSpacing;
38
        alignment       = p.alignment;
39
        indent          = p.indent;
40
        firstLineIndent = p.firstLineIndent;
41
        spaceAbove      = p.spaceAbove;
42
        spaceBelow      = p.spaceBelow;
43
        dropCap         = p.dropCap;
44
        dropCapHeight   = p.dropCapHeight;
45
        adjToBaseline   = p.adjToBaseline;
411 Franz 46
        autoLineSpacing = p.autoLineSpacing;
47
        isVisible       = p.isVisible;
364 Franz 48
}
49
 
50
gtParagraphStyle::gtParagraphStyle(const gtStyle& s) : gtStyle(s)
51
{
52
        init();
53
}
54
 
55
void gtParagraphStyle::init()
56
{
57
        lineSpacing     = 15;
58
        alignment       = LEFT;
59
        indent          = 0;
60
        firstLineIndent = 0;
61
        spaceAbove      = 0;
62
        spaceBelow      = 0;
63
        dropCap         = false;
64
        dropCapHeight   = 2;
65
        adjToBaseline   = false;
411 Franz 66
        autoLineSpacing = false;
67
        isVisible       = true;
364 Franz 68
}
69
 
70
QString gtParagraphStyle::target()
71
{
72
        return QString("paragraph");
73
}
74
 
75
double gtParagraphStyle::getLineSpacing()
76
{
77
        return lineSpacing;
78
}
79
 
80
void gtParagraphStyle::setLineSpacing(double newLineSpacing)
81
{
82
        lineSpacing = newLineSpacing;
83
}
84
 
411 Franz 85
bool gtParagraphStyle::getAutoLineSpacing()
86
{
87
        return autoLineSpacing;
88
}
89
 
90
void gtParagraphStyle::setAutoLineSpacing(bool newALS)
91
{
92
        autoLineSpacing = newALS;
93
}
94
 
364 Franz 95
int gtParagraphStyle::getAlignment()
96
{
97
        return alignment;
98
}
99
 
100
void gtParagraphStyle::setAlignment(Alignment newAlignment)
101
{
102
        alignment = newAlignment;
103
}
104
 
105
void gtParagraphStyle::setAlignment(int newAlignment)
106
{
107
        if ((newAlignment > -1) && (newAlignment < AlignmentMAX))
108
                alignment = newAlignment;
109
}
110
 
111
double gtParagraphStyle::getIndent()
112
{
113
        return indent;
114
}
115
 
116
void gtParagraphStyle::setIndent(double newIndent)
117
{
118
        indent = newIndent;
119
}
120
 
121
double gtParagraphStyle::getFirstLineIndent()
122
{
123
        return firstLineIndent;
124
}
125
 
126
void gtParagraphStyle::setFirstLineIndent(double newFirstLineIndent)
127
{
128
        firstLineIndent = newFirstLineIndent;
129
}
130
 
131
double gtParagraphStyle::getSpaceAbove()
132
{
133
        return spaceAbove;
134
}
135
 
136
void gtParagraphStyle::setSpaceAbove(double newSpaceAbove)
137
{
138
        spaceAbove = newSpaceAbove;
139
}
140
 
141
double gtParagraphStyle::getSpaceBelow()
142
{
143
        return spaceBelow;
144
}
145
 
146
void gtParagraphStyle::setSpaceBelow(double newSpaceBelow)
147
{
148
        spaceBelow = newSpaceBelow;
149
}
150
 
2282 fschmid 151
QValueList<PageItem::TabRecord>* gtParagraphStyle::getTabValues()
364 Franz 152
{
153
        return &tabValues;
154
}
155
 
375 Franz 156
void gtParagraphStyle::setTabValue(double newTabValue, TabType ttype)
364 Franz 157
{
2282 fschmid 158
        struct PageItem::TabRecord tb;
159
        tb.tabPosition = newTabValue;
160
        tb.tabType = ttype;
161
        tb.tabFillChar =  QChar();
162
        tabValues.append(tb);
364 Franz 163
}
164
 
165
bool gtParagraphStyle::hasDropCap()
166
{
167
        return dropCap;
168
}
169
 
170
void gtParagraphStyle::setDropCap(bool newDropCap)
171
{
172
        dropCap = newDropCap;
173
}
174
 
175
void gtParagraphStyle::setDropCap(int newHeight)
176
{
177
        setDropCap(true);
178
        dropCapHeight = newHeight;
179
}
180
 
181
int gtParagraphStyle::getDropCapHeight()
182
{
183
        return dropCapHeight;
184
}
185
 
186
void   gtParagraphStyle::setDropCapHeight(int newHeight)
187
{
188
        dropCapHeight = newHeight;
189
}
190
 
191
bool gtParagraphStyle::isAdjToBaseline()
192
{
193
        return adjToBaseline;
194
}
195
 
196
void gtParagraphStyle::setAdjToBaseline(bool newAdjToBaseline)
197
{
198
        adjToBaseline = newAdjToBaseline;
199
}
200
 
201
void gtParagraphStyle::getStyle(gtStyle* style)
202
{
203
        *style = gtStyle(*this);
204
}
205
 
206
gtParagraphStyle::~gtParagraphStyle()
207
{
208
 
209
}