Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / src / qtquick1 / graphicsitems / qdeclarativetext_p_p.h
1 /****************************************************************************
2 **
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
16 **
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
20 **
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
28 **
29 ** Other Usage
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
32 **
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41
42 #ifndef QDECLARATIVETEXT_P_H
43 #define QDECLARATIVETEXT_P_H
44
45 //
46 //  W A R N I N G
47 //  -------------
48 //
49 // This file is not part of the Qt API.  It exists purely as an
50 // implementation detail.  This header file may change from version to
51 // version without notice, or even be removed.
52 //
53 // We mean it.
54 //
55
56 #include "qdeclarativeitem.h"
57 #include "private/qdeclarativeimplicitsizeitem_p_p.h"
58 #include "QtQuick1/private/qdeclarativetextlayout_p.h"
59
60 #include <QtDeclarative/qdeclarative.h>
61
62 #include <QtGui/qtextlayout.h>
63
64 QT_BEGIN_NAMESPACE
65
66 class QTextLayout;
67 class QTextDocumentWithImageResources_1;
68
69 class Q_AUTOTEST_EXPORT QDeclarative1TextPrivate : public QDeclarative1ImplicitSizeItemPrivate
70 {
71     Q_DECLARE_PUBLIC(QDeclarative1Text)
72 public:
73     QDeclarative1TextPrivate();
74
75     ~QDeclarative1TextPrivate();
76
77     void updateSize();
78     void updateLayout();
79     bool determineHorizontalAlignment();
80     bool setHAlign(QDeclarative1Text::HAlignment, bool forceAlign = false);
81     void mirrorChange();
82     QTextDocument *textDocument();
83
84     QString text;
85     QFont font;
86     QFont sourceFont;
87     QColor  color;
88     QDeclarative1Text::TextStyle style;
89     QColor  styleColor;
90     QString activeLink;
91     QDeclarative1Text::HAlignment hAlign;
92     QDeclarative1Text::VAlignment vAlign;
93     QDeclarative1Text::TextElideMode elideMode;
94     QDeclarative1Text::TextFormat format;
95     QDeclarative1Text::WrapMode wrapMode;
96     qreal lineHeight;
97     QDeclarative1Text::LineHeightMode lineHeightMode;
98     int lineCount;
99     bool truncated;
100     int maximumLineCount;
101     int maximumLineCountValid;
102     QPointF elidePos;
103
104     static QString elideChar;
105
106     void invalidateImageCache();
107     void checkImageCache();
108     QPixmap imageCache;
109
110     bool imageCacheDirty:1;
111     bool updateOnComponentComplete:1;
112     bool richText:1;
113     bool singleline:1;
114     bool cacheAllTextAsImage:1;
115     bool internalWidthUpdate:1;
116     bool requireImplicitWidth:1;
117     bool hAlignImplicit:1;
118     bool rightToLeftText:1;
119     bool layoutTextElided:1;
120
121     QRect layedOutTextRect;
122     QSize paintedSize;
123     qreal naturalWidth;
124     virtual qreal implicitWidth() const;
125     void ensureDoc();
126     QPixmap textDocumentImage(bool drawStyle);
127     QTextDocumentWithImageResources_1 *doc;
128
129     QRect setupTextLayout();
130     QPixmap textLayoutImage(bool drawStyle);
131     void drawTextLayout(QPainter *p, const QPointF &pos, bool drawStyle);
132     QDeclarative1TextLayout layout;
133
134     static QPixmap drawOutline(const QPixmap &source, const QPixmap &styleSource);
135     static QPixmap drawOutline(const QPixmap &source, const QPixmap &styleSource, int yOffset);
136
137     static inline QDeclarative1TextPrivate *get(QDeclarative1Text *t) {
138         return t->d_func();
139     }
140 };
141
142 QT_END_NAMESPACE
143 #endif