xref: /aoo42x/main/vcl/inc/vcl/font.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SV_FONT_HXX
29 #define _SV_FONT_HXX
30 
31 #include <vcl/dllapi.h>
32 #include <tools/gen.hxx>
33 #include <tools/string.hxx>
34 #include <i18npool/lang.h>
35 #include <tools/color.hxx>
36 #include <vcl/vclenum.hxx>
37 #include <vcl/fntstyle.hxx>
38 
39 class SvStream;
40 #define FontAlign TextAlign
41 
42 class Impl_Font;
43 class ImplFontAttributes;
44 
45 // --------
46 // - Font -
47 // --------
48 
49 class VCL_DLLPUBLIC Font
50 {
51 private:
52 	Impl_Font*			mpImplFont;
53 	void				MakeUnique();
54 
55 public:
56 						Font();
57 						Font( const Font& );
58 						Font( const String& rFamilyName, const Size& );
59 						Font( const String& rFamilyName, const String& rStyleName, const Size& );
60 						Font( FontFamily eFamily, const Size& );
61 						~Font();
62 
63 	void				SetColor( const Color& );
64 	const Color&		GetColor() const;
65 	void				SetFillColor( const Color& );
66 	const Color&		GetFillColor() const;
67 	void				SetTransparent( sal_Bool bTransparent );
68 	sal_Bool				IsTransparent() const;
69 	void				SetAlign( FontAlign );
70 	FontAlign			GetAlign() const;
71 
72 	void				SetName( const String& rFamilyName );
73 	const String&		GetName() const;
74 	void				SetStyleName( const String& rStyleName );
75 	const String&		GetStyleName() const;
76 	void				SetSize( const Size& );
77 	const Size& 		GetSize() const;
78 	void				SetHeight( long nHeight );
79 	long				GetHeight() const;
80 	void				SetWidth( long nWidth );
81 	long				GetWidth() const;
82 
83 	void				SetFamily( FontFamily );
84 	FontFamily			GetFamily() const;
85 	void				SetCharSet( rtl_TextEncoding );
86 	rtl_TextEncoding	GetCharSet() const;
87 	void				SetLanguage( LanguageType );
88 	LanguageType		GetLanguage() const;
89 	void				SetCJKContextLanguage( LanguageType );
90 	LanguageType		GetCJKContextLanguage() const;
91 	void				SetPitch( FontPitch ePitch );
92 	FontPitch			GetPitch() const;
93 
94 	void				SetOrientation( short nLineOrientation );
95 	short				GetOrientation() const;
96 	void				SetVertical( sal_Bool bVertical );
97 	sal_Bool				IsVertical() const;
98 	void				SetKerning( FontKerning nKerning );
99 	FontKerning 		GetKerning() const;
100 	sal_Bool				IsKerning() const;
101 
102 	void				SetWeight( FontWeight );
103 	FontWeight			GetWeight() const;
104 	void				SetWidthType( FontWidth );
105 	FontWidth			GetWidthType() const;
106 	void				SetItalic( FontItalic );
107 	FontItalic			GetItalic() const;
108 	void				SetOutline( sal_Bool bOutline );
109 	sal_Bool				IsOutline() const;
110 	void				SetShadow( sal_Bool bShadow );
111 	sal_Bool				IsShadow() const;
112 	void				SetRelief( FontRelief );
113 	FontRelief			GetRelief() const;
114 	void				SetUnderline( FontUnderline );
115 	FontUnderline		GetUnderline() const;
116 	void				SetOverline( FontUnderline );
117 	FontUnderline		GetOverline() const;
118 	void				SetStrikeout( FontStrikeout );
119 	FontStrikeout		GetStrikeout() const;
120 	void				SetEmphasisMark( FontEmphasisMark );
121 	FontEmphasisMark	GetEmphasisMark() const;
122 	void				SetWordLineMode( sal_Bool bWordLine );
123 	sal_Bool				IsWordLineMode() const;
124 
125 	void				Merge( const Font& rFont );
126 	void                GetFontAttributes( ImplFontAttributes& rAttrs ) const;
127 
128 	Font&				operator=( const Font& );
129 	sal_Bool				operator==( const Font& ) const;
130 	sal_Bool				operator!=( const Font& rFont ) const
131 							{ return !(Font::operator==( rFont )); }
132 	sal_Bool				IsSameInstance( const Font& ) const;
133 
134 	friend VCL_DLLPUBLIC SvStream&	operator>>( SvStream& rIStm, Font& );
135 	friend VCL_DLLPUBLIC SvStream&	operator<<( SvStream& rOStm, const Font& );
136 
137     static Font identifyFont( const void* pBuffer, sal_uInt32 nLen );
138 };
139 
140 #endif	// _VCL_FONT_HXX
141