1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SV_METRIC_HXX 25 #define _SV_METRIC_HXX 26 27 #include <vcl/dllapi.h> 28 #include <vcl/font.hxx> 29 30 class ImplFontMetric; 31 class ImplFontCharMap; 32 33 typedef sal_uInt32 sal_UCS4; 34 35 // ------------ 36 // - FontInfo - 37 // ------------ 38 39 class VCL_DLLPUBLIC FontInfo : public Font 40 { 41 friend class OutputDevice; 42 43 protected: 44 ImplFontMetric* mpImplMetric; // Implementation 45 46 public: 47 FontInfo(); 48 FontInfo( const FontInfo& ); 49 ~FontInfo(); 50 51 FontType GetType() const; 52 sal_Bool IsDeviceFont() const; 53 sal_Bool SupportsLatin() const; 54 sal_Bool SupportsCJK() const; 55 sal_Bool SupportsCTL() const; 56 57 FontInfo& operator=( const FontInfo& ); 58 sal_Bool operator==( const FontInfo& ) const; operator !=(const FontInfo & rInfo) const59 sal_Bool operator!=( const FontInfo& rInfo ) const 60 { return !operator==( rInfo ); } 61 }; 62 63 // -------------- 64 // - FontMetric - 65 // -------------- 66 67 class VCL_DLLPUBLIC FontMetric : public FontInfo 68 { 69 public: FontMetric()70 FontMetric() {} 71 FontMetric( const FontMetric& ); ~FontMetric()72 ~FontMetric() {} 73 74 long GetAscent() const; 75 long GetDescent() const; 76 long GetIntLeading() const; 77 long GetExtLeading() const; 78 long GetLineHeight() const; 79 long GetSlant() const; 80 81 FontMetric& operator=( const FontMetric& rMetric ); 82 sal_Bool operator==( const FontMetric& rMetric ) const; operator !=(const FontMetric & rMetric) const83 sal_Bool operator!=( const FontMetric& rMetric ) const 84 { return !operator==( rMetric ); } 85 }; 86 87 // --------------- 88 // - FontCharMap - 89 // --------------- 90 91 class VCL_DLLPUBLIC FontCharMap 92 { 93 private: 94 const ImplFontCharMap* mpImpl; 95 96 public: 97 FontCharMap(); 98 ~FontCharMap(); 99 100 bool IsDefaultMap( void ) const; 101 bool HasChar( sal_UCS4 ) const; 102 int CountCharsInRange( sal_UCS4 cMin, sal_UCS4 cMax ) const; 103 int GetCharCount( void ) const; 104 105 sal_UCS4 GetFirstChar( void ) const; 106 sal_UCS4 GetLastChar( void ) const; 107 108 sal_UCS4 GetNextChar( sal_UCS4 ) const; 109 sal_UCS4 GetPrevChar( sal_UCS4 ) const; 110 111 int GetIndexFromChar( sal_UCS4 ) const; 112 sal_UCS4 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 GetLineCount() const140 sal_uInt16 GetLineCount() const { return mnLineCount; } GetMaxLineWidth() const141 long GetMaxLineWidth() const { return mnMaxWidth; } IsEllipses() const142 sal_Bool IsEllipses() const { return mbEllipsis; } 143 operator ==(const TextRectInfo & rInfo) const144 sal_Bool operator ==( const TextRectInfo& rInfo ) const 145 { return ((mnMaxWidth == rInfo.mnMaxWidth) && 146 (mnLineCount == rInfo.mnLineCount) && 147 (mbEllipsis == rInfo.mbEllipsis)); } operator !=(const TextRectInfo & rInfo) const148 sal_Bool operator !=( const TextRectInfo& rInfo ) const 149 { return !(TextRectInfo::operator==( rInfo )); } 150 }; 151 TextRectInfo()152inline TextRectInfo::TextRectInfo() 153 { 154 mnMaxWidth = 0; 155 mnLineCount = 0; 156 mbEllipsis = sal_False; 157 } 158 159 #endif // _SV_METRIC_HXX 160