Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SV_METRIC_HXX
30 : : #define _SV_METRIC_HXX
31 : :
32 : : #include <vcl/dllapi.h>
33 : : #include <vcl/font.hxx>
34 : :
35 : : class ImplFontMetric;
36 : : class ImplFontCharMap;
37 : :
38 : : typedef sal_uInt32 sal_UCS4;
39 : :
40 : : // ------------
41 : : // - FontInfo -
42 : : // ------------
43 : :
44 : : class VCL_DLLPUBLIC FontInfo : public Font
45 : : {
46 : : friend class OutputDevice;
47 : :
48 : : protected:
49 : : ImplFontMetric* mpImplMetric; // Implementation
50 : :
51 : : public:
52 : : FontInfo();
53 : : FontInfo( const FontInfo& );
54 : : ~FontInfo();
55 : :
56 : : FontType GetType() const;
57 : :
58 : : FontInfo& operator=( const FontInfo& );
59 : : sal_Bool operator==( const FontInfo& ) const;
60 : : sal_Bool operator!=( const FontInfo& rInfo ) const
61 : : { return !operator==( rInfo ); }
62 : : };
63 : :
64 : : // --------------
65 : : // - FontMetric -
66 : : // --------------
67 : :
68 : : class VCL_DLLPUBLIC FontMetric : public FontInfo
69 : : {
70 : : public:
71 : 510765 : FontMetric() {}
72 : : FontMetric( const FontMetric& );
73 : 510765 : ~FontMetric() {}
74 : :
75 : : long GetAscent() const;
76 : : long GetDescent() const;
77 : : long GetIntLeading() const;
78 : : long GetExtLeading() const;
79 : : long GetLineHeight() const;
80 : : long GetSlant() const;
81 : :
82 : : FontMetric& operator=( const FontMetric& rMetric );
83 : : sal_Bool operator==( const FontMetric& rMetric ) const;
84 : : sal_Bool operator!=( const FontMetric& rMetric ) const
85 : : { return !operator==( rMetric ); }
86 : : };
87 : :
88 : : // ---------------
89 : : // - FontCharMap -
90 : : // ---------------
91 : :
92 : : class VCL_DLLPUBLIC FontCharMap
93 : : {
94 : : private:
95 : : const ImplFontCharMap* mpImpl;
96 : :
97 : : public:
98 : : FontCharMap();
99 : : ~FontCharMap();
100 : :
101 : : sal_Bool IsDefaultMap() const;
102 : : sal_Bool HasChar( sal_uInt32 ) const;
103 : : int CountCharsInRange( sal_uInt32 cMin, sal_uInt32 cMax ) const;
104 : : int GetCharCount() const;
105 : :
106 : : sal_uInt32 GetFirstChar() const;
107 : :
108 : : sal_uInt32 GetNextChar( sal_uInt32 ) const;
109 : : sal_uInt32 GetPrevChar( sal_uInt32 ) const;
110 : :
111 : : int GetIndexFromChar( sal_uInt32 ) const;
112 : : sal_uInt32 GetCharFromIndex( int ) const;
113 : :
114 : :
115 : : private:
116 : : friend class OutputDevice;
117 : : void Reset( const ImplFontCharMap* pNewMap = NULL );
118 : :
119 : : // prevent assignment and copy construction
120 : : FontCharMap( const FontCharMap& );
121 : : void operator=( const FontCharMap& );
122 : : };
123 : :
124 : : // ----------------
125 : : // - TextRectInfo -
126 : : // ----------------
127 : :
128 : : class VCL_DLLPUBLIC TextRectInfo
129 : : {
130 : : friend class OutputDevice;
131 : :
132 : : private:
133 : : long mnMaxWidth;
134 : : sal_uInt16 mnLineCount;
135 : : sal_Bool mbEllipsis;
136 : :
137 : : public:
138 : : TextRectInfo();
139 : :
140 : 0 : sal_uInt16 GetLineCount() const { return mnLineCount; }
141 : 0 : long GetMaxLineWidth() const { return mnMaxWidth; }
142 : 0 : sal_Bool IsEllipses() const { return mbEllipsis; }
143 : :
144 : : sal_Bool operator ==( const TextRectInfo& rInfo ) const
145 : : { return ((mnMaxWidth == rInfo.mnMaxWidth) &&
146 : : (mnLineCount == rInfo.mnLineCount) &&
147 : : (mbEllipsis == rInfo.mbEllipsis)); }
148 : : sal_Bool operator !=( const TextRectInfo& rInfo ) const
149 : : { return !(TextRectInfo::operator==( rInfo )); }
150 : : };
151 : :
152 : 0 : inline TextRectInfo::TextRectInfo()
153 : : {
154 : 0 : mnMaxWidth = 0;
155 : 0 : mnLineCount = 0;
156 : 0 : mbEllipsis = sal_False;
157 : 0 : }
158 : :
159 : : #endif // _SV_METRIC_HXX
160 : :
161 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|