~ubuntu-branches/debian/sid/scribus/sid

« back to all changes in this revision

Viewing changes to scribus/sctextstruct.h

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2008-07-02 13:42:07 UTC
  • mto: (4.1.1 sid) (1.2.1) (20.1.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20080702134207-h9h384v0wxjmaf8y
Tags: upstream-1.3.3.12.dfsg
ImportĀ upstreamĀ versionĀ 1.3.3.12.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
*/
 
7
#ifndef SCTEXTSTRUCT_H
 
8
#define SCTEXTSTRUCT_H
 
9
 
 
10
#ifdef HAVE_CONFIG_H
 
11
#include "scconfig.h"
 
12
#endif
 
13
 
 
14
#include "scribusapi.h"
 
15
 
 
16
#ifdef NLS_CONFORMANCE
 
17
#define NLS_PRIVATE private
 
18
#else
 
19
#define NLS_PRIVATE public
 
20
#endif
 
21
 
 
22
#include <qstring.h>
 
23
 
 
24
class Foi;
 
25
class PageItem;
 
26
 
 
27
/* Struktur fuer Pageitem Text */
 
28
 
 
29
 
 
30
/*
 
31
 *  sctext.h
 
32
 *  Scribus
 
33
 *
 
34
 *  Created by Andreas Vox on 29.07.05.
 
35
 *  Copyright 2005 under GPL2. All rights reserved.
 
36
 *
 
37
 */
 
38
 
 
39
enum StyleFlag {
 
40
        ScStyle_Default       = 0,
 
41
    ScStyle_Superscript   = 1,
 
42
    ScStyle_Subcript      = 2,
 
43
    ScStyle_Outline       = 4,
 
44
    ScStyle_Underline     = 8,
 
45
    ScStyle_Strikethrough = 16,
 
46
    ScStyle_AllCaps       = 32,
 
47
    ScStyle_SmallCaps     = 64,
 
48
    ScStyle_HyphenationPossible=128, //Hyphenation possible here (Smart Hyphen)
 
49
    ScStyle_Shadowed      = 256,
 
50
    ScStyle_UnderlineWords=512,
 
51
    ScStyle_Reserved01    = 1024, //free, not used in the moment
 
52
    ScStyle_DropCap       = 2048,
 
53
    ScStyle_SuppressSpace = 4096,//internal use in PageItem (Suppresses spaces when in Block alignment)
 
54
    ScStyle_SmartHyphenVisible=8192, //Smart Hyphen visible at line end
 
55
    ScStyle_StartOfLine   = 16384,
 
56
        ScStyle_UserStyles    = 1919
 
57
};
 
58
 
 
59
 
 
60
class SCRIBUS_API CharStyle {
 
61
public:
 
62
        static const short NOVALUE = -16000;
 
63
        static const QString NOCOLOR;
 
64
        
 
65
    CharStyle() {
 
66
        csize = NOVALUE;
 
67
        cshade = NOVALUE;
 
68
        cshade2 = NOVALUE;
 
69
        cstyle = NOVALUE;
 
70
        cscale = NOVALUE;
 
71
        cscalev = NOVALUE;
 
72
        cbase = NOVALUE;
 
73
        cshadowx = NOVALUE;
 
74
        cshadowy = NOVALUE;
 
75
        coutline = NOVALUE;
 
76
        cunderpos = NOVALUE;
 
77
        cunderwidth = NOVALUE;
 
78
        cstrikepos = NOVALUE;
 
79
        cstrikewidth = NOVALUE;
 
80
        cextra = NOVALUE;
 
81
 
 
82
        cfont = NULL; 
 
83
        ccolor = NOCOLOR;
 
84
        cstroke = NOCOLOR;
 
85
    };
 
86
 
 
87
    CharStyle(Foi * font, int size, int style = ScStyle_Default) {
 
88
        csize = size;
 
89
        cshade = 0;
 
90
        cshade2 = 0;
 
91
        cstyle = style;
 
92
        cscale = 1000;
 
93
        cscalev = 1000;
 
94
        cbase = 0;
 
95
        cshadowx = 0;
 
96
        cshadowy = 0;
 
97
        coutline = 0;
 
98
        cunderpos = 0;
 
99
        cunderwidth = 0;
 
100
        cstrikepos = 0;
 
101
        cstrikewidth = 0;
 
102
        cextra = 0;
 
103
 
 
104
        cfont = font; 
 
105
        ccolor = "Black";
 
106
        cstroke = "Black";
 
107
    };
 
108
 
 
109
        CharStyle(const CharStyle & other);
 
110
        
 
111
        bool operator==(const CharStyle & other) const;
 
112
        bool operator!=(const CharStyle & other) const { return ! (*this==other); }
 
113
        CharStyle & operator=(const CharStyle & other);
 
114
 
 
115
        void applyStyle(const CharStyle & other);
 
116
        void eraseStyle(const CharStyle & other);
 
117
        
 
118
NLS_PRIVATE:
 
119
    int csize;
 
120
    short cshade;
 
121
    short cshade2;
 
122
    short cstyle; // see enum StyleFlag
 
123
    short cscale;
 
124
    short cscalev;
 
125
    short cbase;
 
126
    short cshadowx;
 
127
    short cshadowy;
 
128
    short coutline;
 
129
    short cunderpos;
 
130
    short cunderwidth;
 
131
    short cstrikepos;
 
132
    short cstrikewidth;
 
133
    short cextra;
 
134
 
 
135
    Foi* cfont;
 
136
    QString ccolor;
 
137
    QString cstroke;
 
138
 
 
139
};
 
140
 
 
141
inline bool CharStyle::operator==(const CharStyle & other) const
 
142
{
 
143
        return  (csize == other.csize &&
 
144
                         cshade == other.cshade &&
 
145
                         cshade2 == other.cshade2 &&
 
146
                         cstyle == other.cstyle &&
 
147
                         cscale == other.cscale &&
 
148
                         cscalev == other.cscalev &&
 
149
                         cbase == other.cbase &&
 
150
                         cshadowx == other.cshadowx &&
 
151
                         cshadowy == other.cshadowy &&
 
152
                         coutline == other.coutline &&
 
153
                         cunderpos == other.cunderpos &&
 
154
                         cunderwidth == other.cunderwidth &&
 
155
                         cstrikepos == other.cstrikepos &&
 
156
                         cstrikewidth == other.cstrikewidth &&
 
157
                         cextra == other.cextra &&
 
158
                         cfont == other.cfont &&
 
159
                         ccolor == other.ccolor &&
 
160
                         cstroke == other.cstroke );    
 
161
}
 
162
 
 
163
inline CharStyle & CharStyle::operator=(const CharStyle & other)
 
164
{
 
165
        csize = other.csize;
 
166
        cshade = other.cshade;
 
167
        cshade2 = other.cshade2;
 
168
        cstyle = other.cstyle;
 
169
        cscale = other.cscale;
 
170
        cscalev = other.cscalev;
 
171
        cbase = other.cbase;
 
172
        cshadowx = other.cshadowx;
 
173
        cshadowy = other.cshadowy;
 
174
        coutline = other.coutline;
 
175
        cunderpos = other.cunderpos;
 
176
        cunderwidth = other.cunderwidth;
 
177
        cstrikepos = other.cstrikepos;
 
178
        cstrikewidth = other.cstrikewidth;
 
179
        cextra = other.cextra;
 
180
        cfont = other.cfont;
 
181
        ccolor = other.ccolor;
 
182
        cstroke = other.cstroke;
 
183
        return *this;
 
184
}
 
185
 
 
186
inline CharStyle::CharStyle(const CharStyle & other)
 
187
{
 
188
        csize = other.csize;
 
189
        cshade = other.cshade;
 
190
        cshade2 = other.cshade2;
 
191
        cstyle = other.cstyle;
 
192
        cscale = other.cscale;
 
193
        cscalev = other.cscalev;
 
194
        cbase = other.cbase;
 
195
        cshadowx = other.cshadowx;
 
196
        cshadowy = other.cshadowy;
 
197
        coutline = other.coutline;
 
198
        cunderpos = other.cunderpos;
 
199
        cunderwidth = other.cunderwidth;
 
200
        cstrikepos = other.cstrikepos;
 
201
        cstrikewidth = other.cstrikewidth;
 
202
        cextra = other.cextra;
 
203
        cfont = other.cfont;
 
204
        ccolor = other.ccolor;
 
205
        cstroke = other.cstroke;
 
206
}
 
207
 
 
208
 
 
209
inline void CharStyle::applyStyle(const CharStyle & other)
 
210
{
 
211
        if (other.csize != NOVALUE)
 
212
                csize = other.csize;
 
213
        if (other.cshade != NOVALUE)
 
214
                cshade = other.cshade;
 
215
        if (other.cshade2 != NOVALUE)
 
216
                cshade2 = other.cshade2;
 
217
        if (other.cstyle != NOVALUE)
 
218
                cstyle = (cstyle & ScStyle_UserStyles) | (other.cstyle & ScStyle_UserStyles);
 
219
        if (other.cscale != NOVALUE)
 
220
                cscale = other.cscale;
 
221
        if (other.cscalev != NOVALUE)
 
222
                cscalev = other.cscalev;
 
223
        if (other.cbase != NOVALUE)
 
224
                cbase = other.cbase;
 
225
        if (other.cshadowx != NOVALUE)
 
226
                cshadowx = other.cshadowx;
 
227
        if (other.cshadowy != NOVALUE)
 
228
                cshadowy = other.cshadowy;
 
229
        if (other.coutline != NOVALUE)
 
230
                coutline = other.coutline;
 
231
        if (other.cunderpos != NOVALUE)
 
232
                cunderpos = other.cunderpos;
 
233
        if (other.cunderwidth != NOVALUE)
 
234
                cunderwidth = other.cunderwidth;
 
235
        if (other.cstrikepos != NOVALUE)
 
236
                cstrikepos = other.cstrikepos;
 
237
        if (other.cstrikewidth != NOVALUE)
 
238
                cstrikewidth = other.cstrikewidth;
 
239
        if (other.cextra != NOVALUE)
 
240
                cextra = other.cextra;
 
241
        if (other.cfont != NULL)
 
242
                cfont = other.cfont;
 
243
        if (other.ccolor != NOCOLOR)
 
244
                ccolor = other.ccolor;
 
245
        if (other.cstroke != NOCOLOR)
 
246
                cstroke = other.cstroke;
 
247
}
 
248
 
 
249
inline void CharStyle::eraseStyle(const CharStyle & other)
 
250
{
 
251
        if (other.csize == csize)
 
252
                csize = NOVALUE;
 
253
        if (other.cshade == cshade)
 
254
                cshade = NOVALUE;
 
255
        if (other.cshade2 == cshade2)
 
256
                cshade2 = NOVALUE;
 
257
        if ((other.cstyle  & ScStyle_UserStyles) == (cstyle & ScStyle_UserStyles))
 
258
                cstyle = NOVALUE;
 
259
        if (other.cscale == cscale)
 
260
                cscale = NOVALUE;
 
261
        if (other.cscalev == cscalev)
 
262
                cscalev = NOVALUE;
 
263
        if (other.cbase == cbase)
 
264
                cbase = NOVALUE;
 
265
        if (other.cshadowx == cshadowx)
 
266
                cshadowx = NOVALUE;
 
267
        if (other.cshadowy == cshadowy)
 
268
                cshadowy = NOVALUE;
 
269
        if (other.coutline == coutline)
 
270
                coutline = NOVALUE;
 
271
        if (other.cunderpos == cunderpos)
 
272
                cunderpos = NOVALUE;
 
273
        if (other.cunderwidth == cunderwidth)
 
274
                cunderwidth = NOVALUE;
 
275
        if (other.cstrikepos == cstrikepos)
 
276
                cstrikepos = NOVALUE;
 
277
        if (other.cstrikewidth == cstrikewidth)
 
278
                cstrikewidth = NOVALUE;
 
279
        if (other.cextra == cextra)
 
280
                cextra = NOVALUE;
 
281
        if (other.cfont == cfont)
 
282
                cfont = NULL;
 
283
        if (other.ccolor == ccolor)
 
284
                ccolor = NOCOLOR;
 
285
        if (other.cstroke == cstroke)
 
286
                cstroke = NOCOLOR;
 
287
}
 
288
 
 
289
 
 
290
 
 
291
class SCRIBUS_API ScText : public CharStyle
 
292
{
 
293
public:
 
294
        bool cselect;
 
295
        short cab;
 
296
        float xp;
 
297
        float yp;
 
298
        float PtransX;
 
299
        float PtransY;
 
300
        float PRot;
 
301
        PageItem* cembedded;
 
302
        QString ch;
 
303
};
 
304
#endif // SCTEXTSTRUCT_H
 
305