Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_VCL_METRIC_HXX
21 : #define INCLUDED_VCL_METRIC_HXX
22 :
23 : #include <vcl/dllapi.h>
24 : #include <vcl/font.hxx>
25 :
26 : class ImplFontMetric;
27 : class ImplFontCharMap;
28 :
29 : typedef sal_uInt32 sal_UCS4;
30 :
31 :
32 : // - FontInfo -
33 :
34 :
35 : class VCL_DLLPUBLIC FontInfo : public Font
36 : {
37 : friend class OutputDevice;
38 :
39 : protected:
40 : ImplFontMetric* mpImplMetric; // Implementation
41 :
42 : public:
43 : FontInfo();
44 : FontInfo( const FontInfo& );
45 : ~FontInfo();
46 :
47 : FontType GetType() const;
48 :
49 : FontInfo& operator=( const FontInfo& );
50 : bool operator==( const FontInfo& ) const;
51 : bool operator!=( const FontInfo& rInfo ) const
52 : { return !operator==( rInfo ); }
53 : };
54 :
55 :
56 : // - FontMetric -
57 :
58 :
59 : class VCL_DLLPUBLIC FontMetric : public FontInfo
60 : {
61 : public:
62 0 : FontMetric() {}
63 : FontMetric( const FontMetric& );
64 0 : ~FontMetric() {}
65 :
66 : long GetAscent() const;
67 : long GetDescent() const;
68 : long GetIntLeading() const;
69 : long GetExtLeading() const;
70 : long GetLineHeight() const;
71 : long GetSlant() const;
72 :
73 : FontMetric& operator=( const FontMetric& rMetric );
74 : bool operator==( const FontMetric& rMetric ) const;
75 : bool operator!=( const FontMetric& rMetric ) const
76 : { return !operator==( rMetric ); }
77 : };
78 :
79 :
80 : // - FontCharMap -
81 :
82 :
83 : class VCL_DLLPUBLIC FontCharMap
84 : {
85 : private:
86 : const ImplFontCharMap* mpImpl;
87 :
88 : public:
89 : FontCharMap();
90 : ~FontCharMap();
91 :
92 : bool IsDefaultMap( void ) const;
93 : bool HasChar( sal_UCS4 ) const;
94 : int CountCharsInRange( sal_UCS4 cMin, sal_UCS4 cMax ) const;
95 : int GetCharCount( void ) const;
96 :
97 : sal_UCS4 GetFirstChar() const;
98 :
99 : sal_UCS4 GetNextChar( sal_UCS4 ) const;
100 : sal_UCS4 GetPrevChar( sal_UCS4 ) const;
101 :
102 : int GetIndexFromChar( sal_UCS4 ) const;
103 : sal_UCS4 GetCharFromIndex( int ) const;
104 :
105 :
106 : private:
107 : friend class OutputDevice;
108 : void Reset( const ImplFontCharMap* pNewMap = NULL );
109 :
110 : // prevent assignment and copy construction
111 : FontCharMap( const FontCharMap& );
112 : void operator=( const FontCharMap& );
113 : };
114 :
115 :
116 : // - TextRectInfo -
117 :
118 :
119 : class VCL_DLLPUBLIC TextRectInfo
120 : {
121 : friend class OutputDevice;
122 :
123 : private:
124 : long mnMaxWidth;
125 : sal_uInt16 mnLineCount;
126 : bool mbEllipsis;
127 :
128 : public:
129 : TextRectInfo();
130 :
131 0 : sal_uInt16 GetLineCount() const { return mnLineCount; }
132 0 : long GetMaxLineWidth() const { return mnMaxWidth; }
133 0 : bool IsEllipses() const { return mbEllipsis; }
134 :
135 : bool operator ==( const TextRectInfo& rInfo ) const
136 : { return ((mnMaxWidth == rInfo.mnMaxWidth) &&
137 : (mnLineCount == rInfo.mnLineCount) &&
138 : (mbEllipsis == rInfo.mbEllipsis)); }
139 : bool operator !=( const TextRectInfo& rInfo ) const
140 : { return !(TextRectInfo::operator==( rInfo )); }
141 : };
142 :
143 0 : inline TextRectInfo::TextRectInfo()
144 : {
145 0 : mnMaxWidth = 0;
146 0 : mnLineCount = 0;
147 0 : mbEllipsis = false;
148 0 : }
149 :
150 : #endif // INCLUDED_VCL_METRIC_HXX
151 :
152 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|