Subversion Repositories Scribus

Rev

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