1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation ([email protected])
|
---|
6 | **
|
---|
7 | ** This file is part of the QtGui module of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
14 | ** a written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Lesser General Public License Usage
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
18 | ** General Public License version 2.1 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
20 | ** packaging of this file. Please review the following information to
|
---|
21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
23 | **
|
---|
24 | ** In addition, as a special exception, Nokia gives you certain additional
|
---|
25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
---|
26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you have questions regarding the use of this file, please contact
|
---|
37 | ** Nokia at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #include "qtextformat.h"
|
---|
43 | #include "qtextformat_p.h"
|
---|
44 |
|
---|
45 | #include <qvariant.h>
|
---|
46 | #include <qdatastream.h>
|
---|
47 | #include <qdebug.h>
|
---|
48 | #include <qmap.h>
|
---|
49 | #include <qhash.h>
|
---|
50 |
|
---|
51 | QT_BEGIN_NAMESPACE
|
---|
52 |
|
---|
53 | /*!
|
---|
54 | \class QTextLength
|
---|
55 | \reentrant
|
---|
56 |
|
---|
57 | \brief The QTextLength class encapsulates the different types of length
|
---|
58 | used in a QTextDocument.
|
---|
59 |
|
---|
60 | \ingroup richtext-processing
|
---|
61 |
|
---|
62 | When we specify a value for the length of an element in a text document,
|
---|
63 | we often need to provide some other information so that the length is
|
---|
64 | used in the way we expect. For example, when we specify a table width,
|
---|
65 | the value can represent a fixed number of pixels, or it can be a percentage
|
---|
66 | value. This information changes both the meaning of the value and the way
|
---|
67 | it is used.
|
---|
68 |
|
---|
69 | Generally, this class is used to specify table widths. These can be
|
---|
70 | specified either as a fixed amount of pixels, as a percentage of the
|
---|
71 | containing frame's width, or by a variable width that allows it to take
|
---|
72 | up just the space it requires.
|
---|
73 |
|
---|
74 | \sa QTextTable
|
---|
75 | */
|
---|
76 |
|
---|
77 | /*!
|
---|
78 | \fn explicit QTextLength::QTextLength()
|
---|
79 |
|
---|
80 | Constructs a new length object which represents a variable size.
|
---|
81 | */
|
---|
82 |
|
---|
83 | /*!
|
---|
84 | \fn QTextLength::QTextLength(Type type, qreal value)
|
---|
85 |
|
---|
86 | Constructs a new length object of the given \a type and \a value.
|
---|
87 | */
|
---|
88 |
|
---|
89 | /*!
|
---|
90 | \fn Type QTextLength::type() const
|
---|
91 |
|
---|
92 | Returns the type of this length object.
|
---|
93 |
|
---|
94 | \sa QTextLength::Type
|
---|
95 | */
|
---|
96 |
|
---|
97 | /*!
|
---|
98 | \fn qreal QTextLength::value(qreal maximumLength) const
|
---|
99 |
|
---|
100 | Returns the effective length, constrained by the type of the length object
|
---|
101 | and the specified \a maximumLength.
|
---|
102 |
|
---|
103 | \sa type()
|
---|
104 | */
|
---|
105 |
|
---|
106 | /*!
|
---|
107 | \fn qreal QTextLength::rawValue() const
|
---|
108 |
|
---|
109 | Returns the constraint value that is specific for the type of the length.
|
---|
110 | If the length is QTextLength::PercentageLength then the raw value is in
|
---|
111 | percent, in the range of 0 to 100. If the length is QTextLength::FixedLength
|
---|
112 | then that fixed amount is returned. For variable lengths, zero is returned.
|
---|
113 | */
|
---|
114 |
|
---|
115 | /*!
|
---|
116 | \fn bool QTextLength::operator==(const QTextLength &other) const
|
---|
117 |
|
---|
118 | Returns true if this text length is the same as the \a other text
|
---|
119 | length.
|
---|
120 | */
|
---|
121 |
|
---|
122 | /*!
|
---|
123 | \fn bool QTextLength::operator!=(const QTextLength &other) const
|
---|
124 |
|
---|
125 | Returns true if this text length is different from the \a other text
|
---|
126 | length.
|
---|
127 | */
|
---|
128 |
|
---|
129 | /*!
|
---|
130 | \enum QTextLength::Type
|
---|
|
---|