Subversion Repositories Scribus

Rev

Rev 12337 | 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
*/
3878 cbradney 7
#ifndef SCTEXTSTRUCT_H
8
#define SCTEXTSTRUCT_H
9
 
10
#ifdef HAVE_CONFIG_H
11
#include "scconfig.h"
12
#endif
13
 
4689 mrdocs 14
#include "scribusapi.h"
5184 avox 15
#include "text/nlsconfig.h"
4689 mrdocs 16
 
4670 avox 17
#ifdef NLS_CONFORMANCE
18
#define NLS_PRIVATE private
19
#else
20
#define NLS_PRIVATE public
21
#endif
22
 
10028 cbradney 23
#include <QString>
3878 cbradney 24
 
5559 avox 25
#include "scfonts.h"
5691 avox 26
#include "style.h"
12337 pierre 27
// #include "styles/charstyle.h"
28
// #include "styles/paragraphstyle.h"
29
#include "styles/styleslibrary.h"
5559 avox 30
 
3878 cbradney 31
class PageItem;
32
 
33
/* Struktur fuer Pageitem Text */
4670 avox 34
 
35
 
36
/*
37
 *  sctext.h
38
 *  Scribus
39
 *
40
 *  Created by Andreas Vox on 29.07.05.
41
 *  Copyright 2005 under GPL2. All rights reserved.
42
 *
43
 */
44
 
45
 
46
 
5691 avox 47
/**
48
 * This struct stores a positioned glyph. This is the result of the layout process.
49
 * If a char gets translated to more than one glyph, a linked list is built.
50
 */
51
struct SCRIBUS_API GlyphLayout {
52
        float xadvance;
53
        float yadvance;
54
        float xoffset;
55
        float yoffset;
56
        double scaleV;
57
        double scaleH;
58
        uint glyph;
59
        GlyphLayout* more;
6144 avox 60
 
5691 avox 61
        GlyphLayout() : xadvance(0.0f), yadvance(0.0f), xoffset(0.0f), yoffset(0.0f),
6144 avox 62
                scaleV(1.0), scaleH(1.0), glyph(0), more(NULL)
63
        { }
64
        double wide() const
65
        {
66
                double ret = 0;
67
                for(const GlyphLayout* p=this; p; p=p->more)
68
                        ret += p->xadvance;
69
                return ret;
70
        }
71
        GlyphLayout* last()
72
        {
73
                if (more)
74
                        return more->last();
75
                else
76
                        return this;
77
        }
78
        void shrink()
79
        {
80
                if (more) {
81
                        more->shrink();
82
                        delete more;
83
                        more = NULL;
84
                }
85
        }
86
        void grow()
87
        {
88
                if (!more) {
89
                        more = new GlyphLayout();
90
                }
91
        }
92
 
4670 avox 93
};
94
 
9987 jghali 95
struct InlineFrameData;
8174 avox 96
 
97
class SCRIBUS_API InlineFrame
98
{
99
public:
100
        InlineFrame(PageItem* item);
101
        InlineFrame(const InlineFrame& other);
102
        InlineFrame& operator= (const InlineFrame& other);
103
        virtual ~InlineFrame();
104
 
105
        bool hasItem();
106
        bool isShared();
107
        PageItem* getItem();
9856 fschmid 108
        QList<PageItem*> getGroupedItems();
8174 avox 109
private:
110
        InlineFrameData* d;
111
};
112
 
113
 
5184 avox 114
#ifndef NLS_PROTO
4689 mrdocs 115
class SCRIBUS_API ScText : public CharStyle
4670 avox 116
{
117
public:
12340 pierre 118
        QString parstyle; // only for parseps
5691 avox 119
        GlyphLayout glyph;
3878 cbradney 120
        float PtransX;
121
        float PtransY;
122
        float PRot;
11750 jghali 123
        float PDx;
8174 avox 124
        InlineFrame embedded;
9737 jghali 125
        QChar ch;
8775 cbradney 126
        ScText() :
127
                CharStyle(),
5721 avox 128
                parstyle(NULL), glyph(),
11750 jghali 129
                PtransX(0.0f), PtransY(0.0f), PRot(0.0f), PDx(0.0f), embedded(NULL), ch() {}
6144 avox 130
        ScText(const ScText& other) :
7005 avox 131
                CharStyle(other),
12340 pierre 132
                parstyle(other.parstyle), glyph(other.glyph),
11750 jghali 133
                PtransX(other.PtransX), PtransY(other.PtransY), PRot(other.PRot), PDx(other.PDx),
8174 avox 134
                embedded(other.embedded), ch(other.ch)
6144 avox 135
        {
136
        }
5691 avox 137
        ~ScText();
3878 cbradney 138
};
5184 avox 139
#endif
140
 
12269 cbradney 141
 
142
/** @brief First Line Offset Policy
143
 * Set wether the first line offset is based on max glyph height
144
 * or some of predefined height.
145
 * I put a prefix because it could easily conflict
146
 */
147
enum FirstLineOffsetPolicy
148
{
149
    FLOPRealGlyphHeight = 0, // Historical
150
    FLOPFontAscent      = 1,
151
    FLOPLineSpacing     = 2
152
};
153
 
154
 
3878 cbradney 155
#endif // SCTEXTSTRUCT_H
156