xref: /aoo42x/main/vcl/inc/vcl/font.hxx (revision 8681e0b5)
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_FONT_HXX
25 #define _SV_FONT_HXX
26 
27 #include <vcl/dllapi.h>
28 #include <tools/gen.hxx>
29 #include <tools/string.hxx>
30 #include <i18npool/lang.h>
31 #include <tools/color.hxx>
32 #include <vcl/vclenum.hxx>
33 #include <vcl/fntstyle.hxx>
34 
35 class SvStream;
36 #define FontAlign TextAlign
37 
38 class Impl_Font;
39 class ImplFontAttributes;
40 
41 // --------
42 // - Font -
43 // --------
44 
45 class VCL_DLLPUBLIC Font
46 {
47 private:
48 	Impl_Font*			mpImplFont;
49 	void				MakeUnique();
50 
51 public:
52 						Font();
53 						Font( const Font& );
54 						Font( const String& rFamilyName, const Size& );
55 						Font( const String& rFamilyName, const String& rStyleName, const Size& );
56 						Font( FontFamily eFamily, const Size& );
57 						~Font();
58 
59 	// setting the color on the font is obsolete, the only remaining
60 	// valid use is for keeping backward compatibility with old MetaFiles
61 	void				SetColor( const Color& );
62 	const Color&		GetColor() const;
63 	void				SetFillColor( const Color& );
64 	const Color&		GetFillColor() const;
65 	void				SetTransparent( sal_Bool bTransparent );
66 	sal_Bool				IsTransparent() const;
67 
68 	void				SetAlign( FontAlign );
69 	FontAlign			GetAlign() const;
70 
71 	void				SetName( const String& rFamilyName );
72 	const String&		GetName() const;
73 	void				SetStyleName( const String& rStyleName );
74 	const String&		GetStyleName() const;
75 	void				SetSize( const Size& );
76 	const Size& 		GetSize() const;
77 	void				SetHeight( long nHeight );
78 	long				GetHeight() const;
79 	void				SetWidth( long nWidth );
80 	long				GetWidth() const;
81 
82 	void				SetFamily( FontFamily );
83 	FontFamily			GetFamily() const;
84 	void				SetCharSet( rtl_TextEncoding );
85 	rtl_TextEncoding	GetCharSet() const;
86 	void				SetLanguage( LanguageType );
87 	LanguageType		GetLanguage() const;
88 	void				SetCJKContextLanguage( LanguageType );
89 	LanguageType		GetCJKContextLanguage() const;
90 	void				SetPitch( FontPitch ePitch );
91 	FontPitch			GetPitch() const;
92 
93 	void				SetOrientation( short nLineOrientation );
94 	short				GetOrientation() const;
95 	void				SetVertical( sal_Bool bVertical );
96 	sal_Bool				IsVertical() const;
97 	void				SetKerning( FontKerning nKerning );
98 	FontKerning 		GetKerning() const;
99 	sal_Bool				IsKerning() const;
100 
101 	void				SetWeight( FontWeight );
102 	FontWeight			GetWeight() const;
103 	void				SetWidthType( FontWidth );
104 	FontWidth			GetWidthType() const;
105 	void				SetItalic( FontItalic );
106 	FontItalic			GetItalic() const;
107 	void				SetOutline( sal_Bool bOutline );
108 	sal_Bool				IsOutline() const;
109 	void				SetShadow( sal_Bool bShadow );
110 	sal_Bool				IsShadow() const;
111 	void				SetRelief( FontRelief );
112 	FontRelief			GetRelief() const;
113 	void				SetUnderline( FontUnderline );
114 	FontUnderline		GetUnderline() const;
115 	void				SetOverline( FontUnderline );
116 	FontUnderline		GetOverline() const;
117 	void				SetStrikeout( FontStrikeout );
118 	FontStrikeout		GetStrikeout() const;
119 	void				SetEmphasisMark( FontEmphasisMark );
120 	FontEmphasisMark	GetEmphasisMark() const;
121 	void				SetWordLineMode( sal_Bool bWordLine );
122 	sal_Bool				IsWordLineMode() const;
123 
124 	void				Merge( const Font& rFont );
125 	void                GetFontAttributes( ImplFontAttributes& rAttrs ) const;
126 
127 	Font&				operator=( const Font& );
128 	sal_Bool				operator==( const Font& ) const;
operator !=(const Font & rFont) const129 	sal_Bool				operator!=( const Font& rFont ) const
130 							{ return !(Font::operator==( rFont )); }
131 	sal_Bool				IsSameInstance( const Font& ) const;
132 
133 	friend VCL_DLLPUBLIC SvStream&	operator>>( SvStream& rIStm, Font& );
134 	friend VCL_DLLPUBLIC SvStream&	operator<<( SvStream& rOStm, const Font& );
135 
136     static Font identifyFont( const void* pBuffer, sal_uInt32 nLen );
137 };
138 
139 #endif	// _VCL_FONT_HXX
140