Subversion Repositories Scribus

Rev

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